Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Ngeo <[email protected]>
  • Loading branch information
kawaijoe and Pante authored Sep 8, 2024
1 parent 9156ac7 commit ade8f06
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions forui/lib/src/widgets/select_group/select_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:meta/meta.dart';

import 'package:forui/forui.dart';

/// A group of form fields that represent a single selection.
/// A set of items that are treated as a single selection.
///
/// Typically used to group multiple [FSelectGroupItem.checkbox]s.
///
Expand Down Expand Up @@ -61,7 +61,7 @@ class FSelectGroup<T> extends StatelessWidget {
error: error,
child: ListenableBuilder(
listenable: controller,
builder: (context, child) => Column(
builder: (context, _) => Column(
children: [
for (final item in items)
item.builder(
Expand Down
11 changes: 6 additions & 5 deletions forui/lib/src/widgets/select_group/select_group_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ abstract class FSelectGroupController<T> with ChangeNotifier {
void onChange(T value, bool selected);

/// The values that are shallow copied.
Set<T> get values => {..._values};

/// Whether a value is selected.
/// Returns true if a value is selected.
bool contains(T value) => _values.contains(value);

Set<T> get values => {..._values};

@override
bool operator ==(Object other) =>
identical(this, other) ||
Expand Down Expand Up @@ -52,8 +52,9 @@ class FMultiSelectGroupController<T> extends FSelectGroupController<T> {

/// Creates a [FMultiSelectGroupController].
///
/// The [min] and [max] values are the minimum and maximum number of selections allowed. The [min] value must be
/// greater than or equal to 0. If the [max] value is negative, there is no maximum.
/// The [min] and [max] values are the minimum and maximum number of selections allowed. Defaults to no minimum or maximum.
/// # Contract
/// Throws [AssertionError] if [min] < 0 or [max] < [min].
FMultiSelectGroupController({
int min = 0,
int max = -1,
Expand Down
4 changes: 2 additions & 2 deletions forui/lib/src/widgets/select_group/select_group_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FSelectGroupItem<T> with Diagnosticable {
required this.builder,
});

/// Creates a [FSelectGroupItem] with a [FCheckbox] as the builder.
/// Creates a [FSelectGroupItem] that wraps a [FCheckbox].
factory FSelectGroupItem.checkbox({
required T value,
FCheckboxSelectGroupStyle? style,
Expand All @@ -32,7 +32,7 @@ class FSelectGroupItem<T> with Diagnosticable {
ValueChanged<bool>? onFocusChange,
Key? key,
}) =>
FSelectGroupItem<T>(
FSelectGroupItem(
value: value,
builder: (context, onChange, selected) {
final computedStyle = style ?? context.theme.selectGroupStyle.checkboxStyle;
Expand Down

0 comments on commit ade8f06

Please sign in to comment.