Skip to content

Commit 736be3b

Browse files
committed
Add [side] parameter for ChoiceChip and FilterChip
1 parent 6e9e1dc commit 736be3b

File tree

3 files changed

+42
-15
lines changed

3 files changed

+42
-15
lines changed

lib/src/fields/form_builder_choice_chips.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ class FormBuilderChoiceChip<T> extends FormBuilderFieldDecoration<T> {
5151
/// The default is [Colors.black].
5252
final Color? shadowColor;
5353

54+
/// The color and weight of the chip's outline.
55+
///
56+
/// Defaults to the border side in the ambient [ChipThemeData]. If the theme
57+
/// border side resolves to null and [ThemeData.useMaterial3] is true, then
58+
/// [BorderSide] with a [ColorScheme.outline] color is used when the chip is
59+
/// enabled, and [BorderSide] with a [ColorScheme.onSurface] color with an
60+
/// opacity of 0.12 is used when the chip is disabled. Otherwise, it defaults
61+
/// to null.
62+
///
63+
/// This value is combined with [shape] to create a shape decorated with an
64+
/// outline. To omit the outline entirely, pass [BorderSide.none] to [side].
65+
///
66+
/// If it is a [WidgetStateBorderSide], [WidgetStateProperty.resolve] is
67+
/// used for the following [WidgetState]s:
68+
///
69+
/// * [WidgetState.disabled].
70+
/// * [WidgetState.selected].
71+
/// * [WidgetState.hovered].
72+
/// * [WidgetState.focused].
73+
/// * [WidgetState.pressed].
74+
final BorderSide? side;
75+
5476
/// The [OutlinedBorder] to draw around the chip.
5577
///
5678
/// Defaults to the shape in the ambient [ChipThemeData]. If the theme
@@ -293,6 +315,7 @@ class FormBuilderChoiceChip<T> extends FormBuilderFieldDecoration<T> {
293315
this.selectedColor,
294316
this.selectedShadowColor,
295317
this.shadowColor,
318+
this.side,
296319
this.shape,
297320
this.spacing = 0.0,
298321
this.textDirection,
@@ -317,6 +340,7 @@ class FormBuilderChoiceChip<T> extends FormBuilderFieldDecoration<T> {
317340
for (FormBuilderChipOption<T> option in options)
318341
ChoiceChip(
319342
label: option,
343+
side: side,
320344
shape: shape,
321345
selected: field.value == option.value,
322346
onSelected: state.enabled

lib/src/fields/form_builder_filter_chips.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class FormBuilderFilterChip<T> extends FormBuilderFieldDecoration<List<T>> {
1313
final double? elevation, pressElevation;
1414
final List<FormBuilderChipOption<T>> options;
1515
final MaterialTapTargetSize? materialTapTargetSize;
16+
final BorderSide? side;
1617
final OutlinedBorder? shape;
1718

1819
// Wrap Settings
@@ -66,6 +67,7 @@ class FormBuilderFilterChip<T> extends FormBuilderFieldDecoration<List<T>> {
6667
this.selectedColor,
6768
this.selectedShadowColor,
6869
this.shadowColor,
70+
this.side,
6971
this.shape,
7072
this.showCheckmark = true,
7173
this.spacing = 0.0,
@@ -119,6 +121,7 @@ class FormBuilderFilterChip<T> extends FormBuilderFieldDecoration<List<T>> {
119121
pressElevation: pressElevation,
120122
materialTapTargetSize: materialTapTargetSize,
121123
padding: padding,
124+
side: side,
122125
shape: shape,
123126
checkmarkColor: checkmarkColor,
124127
clipBehavior: clipBehavior,

pubspec.lock

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ packages:
3737
dependency: transitive
3838
description:
3939
name: collection
40-
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
40+
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
4141
url: "https://pub.dev"
4242
source: hosted
43-
version: "1.18.0"
43+
version: "1.19.0"
4444
fake_async:
4545
dependency: transitive
4646
description:
@@ -79,18 +79,18 @@ packages:
7979
dependency: transitive
8080
description:
8181
name: leak_tracker
82-
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
82+
sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec
8383
url: "https://pub.dev"
8484
source: hosted
85-
version: "10.0.5"
85+
version: "10.0.8"
8686
leak_tracker_flutter_testing:
8787
dependency: transitive
8888
description:
8989
name: leak_tracker_flutter_testing
90-
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
90+
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
9191
url: "https://pub.dev"
9292
source: hosted
93-
version: "3.0.5"
93+
version: "3.0.9"
9494
leak_tracker_testing:
9595
dependency: transitive
9696
description:
@@ -143,7 +143,7 @@ packages:
143143
dependency: transitive
144144
description: flutter
145145
source: sdk
146-
version: "0.0.99"
146+
version: "0.0.0"
147147
source_span:
148148
dependency: transitive
149149
description:
@@ -156,10 +156,10 @@ packages:
156156
dependency: transitive
157157
description:
158158
name: stack_trace
159-
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
159+
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
160160
url: "https://pub.dev"
161161
source: hosted
162-
version: "1.11.1"
162+
version: "1.12.0"
163163
stream_channel:
164164
dependency: transitive
165165
description:
@@ -172,10 +172,10 @@ packages:
172172
dependency: transitive
173173
description:
174174
name: string_scanner
175-
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
175+
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
176176
url: "https://pub.dev"
177177
source: hosted
178-
version: "1.2.0"
178+
version: "1.3.0"
179179
term_glyph:
180180
dependency: transitive
181181
description:
@@ -188,10 +188,10 @@ packages:
188188
dependency: transitive
189189
description:
190190
name: test_api
191-
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
191+
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
192192
url: "https://pub.dev"
193193
source: hosted
194-
version: "0.7.2"
194+
version: "0.7.3"
195195
vector_math:
196196
dependency: transitive
197197
description:
@@ -204,10 +204,10 @@ packages:
204204
dependency: transitive
205205
description:
206206
name: vm_service
207-
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
207+
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
208208
url: "https://pub.dev"
209209
source: hosted
210-
version: "14.2.5"
210+
version: "14.3.0"
211211
sdks:
212212
dart: ">=3.5.0 <4.0.0"
213213
flutter: ">=3.24.0"

0 commit comments

Comments
 (0)