Skip to content

Commit f522b45

Browse files
committed
added visualDensity in grouped_checkbox.dart to control visual density.
1 parent 45998fc commit f522b45

File tree

4 files changed

+46
-43
lines changed

4 files changed

+46
-43
lines changed

example/pubspec.lock

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ packages:
3737
dependency: transitive
3838
description:
3939
name: collection
40-
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
40+
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
4141
url: "https://pub.dev"
4242
source: hosted
43-
version: "1.17.1"
43+
version: "1.17.2"
4444
fake_async:
4545
dependency: transitive
4646
description:
@@ -91,18 +91,10 @@ packages:
9191
dependency: "direct main"
9292
description:
9393
name: intl
94-
sha256: a3715e3bc90294e971cb7dc063fbf3cd9ee0ebf8604ffeafabd9e6f16abbdbe6
94+
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
9595
url: "https://pub.dev"
9696
source: hosted
97-
version: "0.18.0"
98-
js:
99-
dependency: transitive
100-
description:
101-
name: js
102-
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
103-
url: "https://pub.dev"
104-
source: hosted
105-
version: "0.6.7"
97+
version: "0.18.1"
10698
lints:
10799
dependency: transitive
108100
description:
@@ -115,18 +107,18 @@ packages:
115107
dependency: transitive
116108
description:
117109
name: matcher
118-
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
110+
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
119111
url: "https://pub.dev"
120112
source: hosted
121-
version: "0.12.15"
113+
version: "0.12.16"
122114
material_color_utilities:
123115
dependency: transitive
124116
description:
125117
name: material_color_utilities
126-
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
118+
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
127119
url: "https://pub.dev"
128120
source: hosted
129-
version: "0.2.0"
121+
version: "0.5.0"
130122
meta:
131123
dependency: transitive
132124
description:
@@ -152,10 +144,10 @@ packages:
152144
dependency: transitive
153145
description:
154146
name: source_span
155-
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
147+
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
156148
url: "https://pub.dev"
157149
source: hosted
158-
version: "1.9.1"
150+
version: "1.10.0"
159151
stack_trace:
160152
dependency: transitive
161153
description:
@@ -192,10 +184,10 @@ packages:
192184
dependency: transitive
193185
description:
194186
name: test_api
195-
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
187+
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
196188
url: "https://pub.dev"
197189
source: hosted
198-
version: "0.5.1"
190+
version: "0.6.0"
199191
vector_math:
200192
dependency: transitive
201193
description:
@@ -204,6 +196,14 @@ packages:
204196
url: "https://pub.dev"
205197
source: hosted
206198
version: "2.1.4"
199+
web:
200+
dependency: transitive
201+
description:
202+
name: web
203+
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
204+
url: "https://pub.dev"
205+
source: hosted
206+
version: "0.1.4-beta"
207207
sdks:
208-
dart: ">=3.0.0 <4.0.0"
208+
dart: ">=3.1.0-185.0.dev <4.0.0"
209209
flutter: ">=3.10.0"

lib/src/fields/form_builder_checkbox_group.dart

Lines changed: 3 additions & 1 deletion
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;
@@ -25,7 +26,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
2526
final OptionsOrientation orientation;
2627

2728
/// Creates a list of Checkboxes for selecting multiple options
28-
FormBuilderCheckboxGroup({
29+
FormBuilderCheckboxGroup(this.visualDensity, {
2930
super.key,
3031
required super.name,
3132
super.validator,
@@ -75,6 +76,7 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
7576
? disabled
7677
: options.map((e) => e.value).toList(),
7778
activeColor: activeColor,
79+
visualDensity: visualDensity,
7880
focusColor: focusColor,
7981
checkColor: checkColor,
8082
materialTapTargetSize: materialTapTargetSize,

lib/src/widgets/grouped_checkbox.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
2424
///
2525
/// Defaults to [ColorScheme.secondary].
2626
final Color? activeColor;
27-
27+
final VisualDensity? visualDensity;
2828
/// The color to use for the check icon when this checkbox is checked.
2929
///
3030
/// Defaults to Color(0xFFFFFFFF)
@@ -202,7 +202,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
202202
this.wrapTextDirection,
203203
this.wrapVerticalDirection = VerticalDirection.down,
204204
this.separator,
205-
this.controlAffinity = ControlAffinity.leading,
205+
this.controlAffinity = ControlAffinity.leading, this.visualDensity,
206206
});
207207

208208
@override
@@ -252,6 +252,7 @@ class GroupedCheckbox<T> extends StatelessWidget {
252252
final optionValue = option.value;
253253
final isOptionDisabled = true == disabled?.contains(optionValue);
254254
final control = Checkbox(
255+
visualDensity: visualDensity,
255256
activeColor: activeColor,
256257
checkColor: checkColor,
257258
focusColor: focusColor,

pubspec.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ packages:
3737
dependency: transitive
3838
description:
3939
name: collection
40-
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
40+
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
4141
url: "https://pub.dev"
4242
source: hosted
43-
version: "1.17.1"
43+
version: "1.17.2"
4444
fake_async:
4545
dependency: transitive
4646
description:
@@ -75,14 +75,6 @@ packages:
7575
url: "https://pub.dev"
7676
source: hosted
7777
version: "0.18.1"
78-
js:
79-
dependency: transitive
80-
description:
81-
name: js
82-
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
83-
url: "https://pub.dev"
84-
source: hosted
85-
version: "0.6.7"
8678
lints:
8779
dependency: transitive
8880
description:
@@ -95,18 +87,18 @@ packages:
9587
dependency: transitive
9688
description:
9789
name: matcher
98-
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
90+
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
9991
url: "https://pub.dev"
10092
source: hosted
101-
version: "0.12.15"
93+
version: "0.12.16"
10294
material_color_utilities:
10395
dependency: transitive
10496
description:
10597
name: material_color_utilities
106-
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
98+
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
10799
url: "https://pub.dev"
108100
source: hosted
109-
version: "0.2.0"
101+
version: "0.5.0"
110102
meta:
111103
dependency: transitive
112104
description:
@@ -132,10 +124,10 @@ packages:
132124
dependency: transitive
133125
description:
134126
name: source_span
135-
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
127+
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
136128
url: "https://pub.dev"
137129
source: hosted
138-
version: "1.9.1"
130+
version: "1.10.0"
139131
stack_trace:
140132
dependency: transitive
141133
description:
@@ -172,10 +164,10 @@ packages:
172164
dependency: transitive
173165
description:
174166
name: test_api
175-
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
167+
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
176168
url: "https://pub.dev"
177169
source: hosted
178-
version: "0.5.1"
170+
version: "0.6.0"
179171
vector_math:
180172
dependency: transitive
181173
description:
@@ -184,6 +176,14 @@ packages:
184176
url: "https://pub.dev"
185177
source: hosted
186178
version: "2.1.4"
179+
web:
180+
dependency: transitive
181+
description:
182+
name: web
183+
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
184+
url: "https://pub.dev"
185+
source: hosted
186+
version: "0.1.4-beta"
187187
sdks:
188-
dart: ">=3.0.0 <4.0.0"
188+
dart: ">=3.1.0-185.0.dev <4.0.0"
189189
flutter: ">=3.10.0"

0 commit comments

Comments
 (0)