diff --git a/forui/lib/src/widgets/select_group/select_group.dart b/forui/lib/src/widgets/select_group/select_group.dart index 5062f8c72..f3feb7376 100644 --- a/forui/lib/src/widgets/select_group/select_group.dart +++ b/forui/lib/src/widgets/select_group/select_group.dart @@ -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. /// @@ -61,7 +61,7 @@ class FSelectGroup extends StatelessWidget { error: error, child: ListenableBuilder( listenable: controller, - builder: (context, child) => Column( + builder: (context, _) => Column( children: [ for (final item in items) item.builder( diff --git a/forui/lib/src/widgets/select_group/select_group_controller.dart b/forui/lib/src/widgets/select_group/select_group_controller.dart index 07b152797..95dffe823 100644 --- a/forui/lib/src/widgets/select_group/select_group_controller.dart +++ b/forui/lib/src/widgets/select_group/select_group_controller.dart @@ -12,11 +12,11 @@ abstract class FSelectGroupController with ChangeNotifier { void onChange(T value, bool selected); /// The values that are shallow copied. - Set get values => {..._values}; - - /// Whether a value is selected. + /// Returns true if a value is selected. bool contains(T value) => _values.contains(value); + Set get values => {..._values}; + @override bool operator ==(Object other) => identical(this, other) || @@ -52,8 +52,9 @@ class FMultiSelectGroupController extends FSelectGroupController { /// 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, diff --git a/forui/lib/src/widgets/select_group/select_group_item.dart b/forui/lib/src/widgets/select_group/select_group_item.dart index 7b369a058..82ac7b872 100644 --- a/forui/lib/src/widgets/select_group/select_group_item.dart +++ b/forui/lib/src/widgets/select_group/select_group_item.dart @@ -18,7 +18,7 @@ class FSelectGroupItem 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, @@ -32,7 +32,7 @@ class FSelectGroupItem with Diagnosticable { ValueChanged? onFocusChange, Key? key, }) => - FSelectGroupItem( + FSelectGroupItem( value: value, builder: (context, onChange, selected) { final computedStyle = style ?? context.theme.selectGroupStyle.checkboxStyle;