Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need visual density option in grouped_checkbox #1284

Merged
merged 6 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion 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 @@ -25,9 +26,10 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
final OptionsOrientation orientation;

/// Creates a list of Checkboxes for selecting multiple options
FormBuilderCheckboxGroup({
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
5 changes: 3 additions & 2 deletions lib/src/widgets/grouped_checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +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.
///
/// Defaults to Color(0xFFFFFFFF)
Expand Down Expand Up @@ -202,7 +202,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
this.wrapTextDirection,
this.wrapVerticalDirection = VerticalDirection.down,
this.separator,
this.controlAffinity = ControlAffinity.leading,
this.controlAffinity = ControlAffinity.leading, this.visualDensity,
});

@override
Expand Down Expand Up @@ -252,6 +252,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
Loading