Skip to content

Commit 0323c7b

Browse files
committed
Fix bug in ChoiceChip & FilterChip where using FieldOption label instead of child breaks app. Closes #348
1 parent 72f099f commit 0323c7b

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

lib/src/fields/form_builder_chips_choice.dart

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,35 @@ class FormBuilderChoiceChip extends StatefulWidget {
3333
final TextDirection textDirection;
3434
final VerticalDirection verticalDirection;
3535

36-
FormBuilderChoiceChip(
37-
{Key key,
38-
@required this.attribute,
39-
@required this.options,
40-
this.initialValue,
41-
this.validators = const [],
42-
this.readOnly = false,
43-
this.decoration = const InputDecoration(),
44-
this.onChanged,
45-
this.valueTransformer,
46-
this.onSaved,
47-
this.selectedColor,
48-
this.disabledColor,
49-
this.backgroundColor,
50-
this.shadowColor,
51-
this.selectedShadowColor,
52-
this.shape,
53-
this.elevation,
54-
this.pressElevation,
55-
this.materialTapTargetSize,
56-
this.direction = Axis.horizontal,
57-
this.alignment = WrapAlignment.start,
58-
this.crossAxisAlignment = WrapCrossAlignment.start,
59-
this.runAlignment = WrapAlignment.start,
60-
this.runSpacing = 0.0,
61-
this.spacing = 0.0,
62-
this.textDirection,
63-
this.verticalDirection = VerticalDirection.down})
64-
: super(key: key);
36+
FormBuilderChoiceChip({
37+
Key key,
38+
@required this.attribute,
39+
@required this.options,
40+
this.initialValue,
41+
this.validators = const [],
42+
this.readOnly = false,
43+
this.decoration = const InputDecoration(),
44+
this.onChanged,
45+
this.valueTransformer,
46+
this.onSaved,
47+
this.selectedColor,
48+
this.disabledColor,
49+
this.backgroundColor,
50+
this.shadowColor,
51+
this.selectedShadowColor,
52+
this.shape,
53+
this.elevation,
54+
this.pressElevation,
55+
this.materialTapTargetSize,
56+
this.direction = Axis.horizontal,
57+
this.alignment = WrapAlignment.start,
58+
this.crossAxisAlignment = WrapCrossAlignment.start,
59+
this.runAlignment = WrapAlignment.start,
60+
this.runSpacing = 0.0,
61+
this.spacing = 0.0,
62+
this.textDirection,
63+
this.verticalDirection = VerticalDirection.down,
64+
}) : super(key: key);
6565

6666
@override
6767
_FormBuilderChoiceChipState createState() => _FormBuilderChoiceChipState();
@@ -139,7 +139,7 @@ class _FormBuilderChoiceChipState extends State<FormBuilderChoiceChip> {
139139
elevation: widget.elevation,
140140
pressElevation: widget.pressElevation,
141141
materialTapTargetSize: widget.materialTapTargetSize,
142-
label: option.child,
142+
label: option,
143143
selected: field.value == option.value,
144144
onSelected: _readOnly
145145
? null

lib/src/fields/form_builder_chips_filter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class _FormBuilderFilterChipState extends State<FormBuilderFilterChip> {
144144
children: <Widget>[
145145
for (FormBuilderFieldOption option in widget.options)
146146
FilterChip(
147-
label: option.child,
147+
label: option,
148148
selected: field.value.contains(option.value),
149149
onSelected: _readOnly
150150
? null

0 commit comments

Comments
 (0)