Skip to content

Commit e6b1059

Browse files
Merge pull request #1284 from nicks258/main
Need visual density option in grouped_checkbox
2 parents 4e16275 + 9900591 commit e6b1059

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/src/fields/form_builder_checkbox_group.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'package:flutter_form_builder/flutter_form_builder.dart';
66
class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
77
final List<FormBuilderFieldOption<T>> options;
88
final Color? activeColor;
9+
final VisualDensity? visualDensity;
910
final Color? checkColor;
1011
final Color? focusColor;
1112
final Color? hoverColor;
@@ -28,6 +29,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
2829
FormBuilderCheckboxGroup({
2930
super.key,
3031
required super.name,
32+
this.visualDensity,
3133
super.validator,
3234
super.initialValue,
3335
super.decoration,
@@ -75,6 +77,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
7577
? disabled
7678
: options.map((e) => e.value).toList(),
7779
activeColor: activeColor,
80+
visualDensity: visualDensity,
7881
focusColor: focusColor,
7982
checkColor: checkColor,
8083
materialTapTargetSize: materialTapTargetSize,

lib/src/widgets/grouped_checkbox.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
2424
///
2525
/// Defaults to [ColorScheme.secondary].
2626
final Color? activeColor;
27+
final VisualDensity? visualDensity;
2728

2829
/// The color to use for the check icon when this checkbox is checked.
2930
///
@@ -203,6 +204,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
203204
this.wrapVerticalDirection = VerticalDirection.down,
204205
this.separator,
205206
this.controlAffinity = ControlAffinity.leading,
207+
this.visualDensity,
206208
});
207209

208210
@override
@@ -252,6 +254,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
252254
final optionValue = option.value;
253255
final isOptionDisabled = true == disabled?.contains(optionValue);
254256
final control = Checkbox(
257+
visualDensity: visualDensity,
255258
activeColor: activeColor,
256259
checkColor: checkColor,
257260
focusColor: focusColor,

0 commit comments

Comments
 (0)