Skip to content

Commit

Permalink
Merge pull request #1284 from nicks258/main
Browse files Browse the repository at this point in the history
Need visual density option in grouped_checkbox
  • Loading branch information
deandreamatias authored Sep 21, 2023
2 parents 4e16275 + 9900591 commit e6b1059
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/src/fields/form_builder_checkbox_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
final List<FormBuilderFieldOption<T>> options;
final Color? activeColor;
final VisualDensity? visualDensity;
final Color? checkColor;
final Color? focusColor;
final Color? hoverColor;
Expand All @@ -28,6 +29,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
FormBuilderCheckboxGroup({
super.key,
required super.name,
this.visualDensity,
super.validator,
super.initialValue,
super.decoration,
Expand Down Expand Up @@ -75,6 +77,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
? disabled
: options.map((e) => e.value).toList(),
activeColor: activeColor,
visualDensity: visualDensity,
focusColor: focusColor,
checkColor: checkColor,
materialTapTargetSize: materialTapTargetSize,
Expand Down
3 changes: 3 additions & 0 deletions lib/src/widgets/grouped_checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
///
/// Defaults to [ColorScheme.secondary].
final Color? activeColor;
final VisualDensity? visualDensity;

/// The color to use for the check icon when this checkbox is checked.
///
Expand Down Expand Up @@ -203,6 +204,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
this.wrapVerticalDirection = VerticalDirection.down,
this.separator,
this.controlAffinity = ControlAffinity.leading,
this.visualDensity,
});

@override
Expand Down Expand Up @@ -252,6 +254,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
final optionValue = option.value;
final isOptionDisabled = true == disabled?.contains(optionValue);
final control = Checkbox(
visualDensity: visualDensity,
activeColor: activeColor,
checkColor: checkColor,
focusColor: focusColor,
Expand Down

0 comments on commit e6b1059

Please sign in to comment.