Skip to content

Commit 9147ab2

Browse files
style: apply new dart format
1 parent da5558f commit 9147ab2

33 files changed

+1867
-1694
lines changed

lib/src/fields/form_builder_checkbox.dart

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -120,39 +120,40 @@ class FormBuilderCheckbox extends FormBuilderFieldDecoration<bool> {
120120
this.shape,
121121
this.side,
122122
}) : super(
123-
builder: (FormFieldState<bool?> field) {
124-
final state = field as _FormBuilderCheckboxState;
125-
126-
return InputDecorator(
127-
decoration: state.decoration,
128-
isFocused: state.effectiveFocusNode.hasFocus,
129-
child: CheckboxListTile(
130-
dense: true,
131-
isThreeLine: false,
132-
focusNode: state.effectiveFocusNode,
133-
title: title,
134-
subtitle: subtitle,
135-
value: tristate ? state.value : (state.value ?? false),
136-
onChanged: state.enabled
137-
? (value) {
138-
state.didChange(value);
139-
}
140-
: null,
141-
checkColor: checkColor,
142-
activeColor: activeColor,
143-
secondary: secondary,
144-
controlAffinity: controlAffinity,
145-
autofocus: autofocus,
146-
tristate: tristate,
147-
contentPadding: contentPadding,
148-
visualDensity: visualDensity,
149-
selected: selected,
150-
checkboxShape: shape,
151-
side: side,
152-
),
153-
);
154-
},
155-
);
123+
builder: (FormFieldState<bool?> field) {
124+
final state = field as _FormBuilderCheckboxState;
125+
126+
return InputDecorator(
127+
decoration: state.decoration,
128+
isFocused: state.effectiveFocusNode.hasFocus,
129+
child: CheckboxListTile(
130+
dense: true,
131+
isThreeLine: false,
132+
focusNode: state.effectiveFocusNode,
133+
title: title,
134+
subtitle: subtitle,
135+
value: tristate ? state.value : (state.value ?? false),
136+
onChanged:
137+
state.enabled
138+
? (value) {
139+
state.didChange(value);
140+
}
141+
: null,
142+
checkColor: checkColor,
143+
activeColor: activeColor,
144+
secondary: secondary,
145+
controlAffinity: controlAffinity,
146+
autofocus: autofocus,
147+
tristate: tristate,
148+
contentPadding: contentPadding,
149+
visualDensity: visualDensity,
150+
selected: selected,
151+
checkboxShape: shape,
152+
side: side,
153+
),
154+
);
155+
},
156+
);
156157

157158
@override
158159
FormBuilderFieldDecorationState<FormBuilderCheckbox, bool> createState() =>

lib/src/fields/form_builder_checkbox_group.dart

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -66,55 +66,57 @@ class FormBuilderCheckboxGroup<T> extends FormBuilderFieldDecoration<List<T>> {
6666
this.orientation = OptionsOrientation.wrap,
6767
this.itemDecoration,
6868
}) : super(
69-
builder: (FormFieldState<List<T>?> field) {
70-
final state = field as _FormBuilderCheckboxGroupState<T>;
69+
builder: (FormFieldState<List<T>?> field) {
70+
final state = field as _FormBuilderCheckboxGroupState<T>;
7171

72-
return Focus(
73-
focusNode: state.effectiveFocusNode,
74-
skipTraversal: true,
75-
canRequestFocus: state.enabled,
76-
debugLabel: 'FormBuilderCheckboxGroup-$name',
77-
child: InputDecorator(
78-
decoration: state.decoration,
79-
isFocused: state.effectiveFocusNode.hasFocus,
80-
child: GroupedCheckbox<T>(
81-
orientation: orientation,
82-
value: state.value,
83-
options: options,
84-
onChanged: (val) {
85-
field.didChange(val);
86-
},
87-
disabled: state.enabled
88-
? disabled
89-
: options.map((e) => e.value).toList(),
90-
activeColor: activeColor,
91-
visualDensity: visualDensity,
92-
focusColor: focusColor,
93-
checkColor: checkColor,
94-
materialTapTargetSize: materialTapTargetSize,
95-
hoverColor: hoverColor,
96-
tristate: tristate,
97-
wrapAlignment: wrapAlignment,
98-
wrapCrossAxisAlignment: wrapCrossAxisAlignment,
99-
wrapDirection: wrapDirection,
100-
wrapRunAlignment: wrapRunAlignment,
101-
wrapRunSpacing: wrapRunSpacing,
102-
wrapSpacing: wrapSpacing,
103-
wrapTextDirection: wrapTextDirection,
104-
wrapVerticalDirection: wrapVerticalDirection,
105-
separator: separator,
106-
controlAffinity: controlAffinity,
107-
itemDecoration: itemDecoration,
108-
),
109-
),
110-
);
111-
},
112-
);
72+
return Focus(
73+
focusNode: state.effectiveFocusNode,
74+
skipTraversal: true,
75+
canRequestFocus: state.enabled,
76+
debugLabel: 'FormBuilderCheckboxGroup-$name',
77+
child: InputDecorator(
78+
decoration: state.decoration,
79+
isFocused: state.effectiveFocusNode.hasFocus,
80+
child: GroupedCheckbox<T>(
81+
orientation: orientation,
82+
value: state.value,
83+
options: options,
84+
onChanged: (val) {
85+
field.didChange(val);
86+
},
87+
disabled:
88+
state.enabled
89+
? disabled
90+
: options.map((e) => e.value).toList(),
91+
activeColor: activeColor,
92+
visualDensity: visualDensity,
93+
focusColor: focusColor,
94+
checkColor: checkColor,
95+
materialTapTargetSize: materialTapTargetSize,
96+
hoverColor: hoverColor,
97+
tristate: tristate,
98+
wrapAlignment: wrapAlignment,
99+
wrapCrossAxisAlignment: wrapCrossAxisAlignment,
100+
wrapDirection: wrapDirection,
101+
wrapRunAlignment: wrapRunAlignment,
102+
wrapRunSpacing: wrapRunSpacing,
103+
wrapSpacing: wrapSpacing,
104+
wrapTextDirection: wrapTextDirection,
105+
wrapVerticalDirection: wrapVerticalDirection,
106+
separator: separator,
107+
controlAffinity: controlAffinity,
108+
itemDecoration: itemDecoration,
109+
),
110+
),
111+
);
112+
},
113+
);
113114

114115
@override
115116
FormBuilderFieldDecorationState<FormBuilderCheckboxGroup<T>, List<T>>
116-
createState() => _FormBuilderCheckboxGroupState<T>();
117+
createState() => _FormBuilderCheckboxGroupState<T>();
117118
}
118119

119-
class _FormBuilderCheckboxGroupState<T> extends FormBuilderFieldDecorationState<
120-
FormBuilderCheckboxGroup<T>, List<T>> {}
120+
class _FormBuilderCheckboxGroupState<T>
121+
extends
122+
FormBuilderFieldDecorationState<FormBuilderCheckboxGroup<T>, List<T>> {}

lib/src/fields/form_builder_choice_chips.dart

Lines changed: 66 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -392,69 +392,72 @@ class FormBuilderChoiceChips<T> extends FormBuilderFieldDecoration<T> {
392392
this.color,
393393
this.iconTheme,
394394
this.tooltip,
395-
}) : super(builder: (FormFieldState<T?> field) {
396-
final state = field as _FormBuilderChoiceChipState<T>;
397-
398-
return Focus(
399-
focusNode: state.effectiveFocusNode,
400-
skipTraversal: true,
401-
canRequestFocus: state.enabled,
402-
debugLabel: 'FormBuilderChoiceChip-$name',
403-
child: InputDecorator(
404-
decoration: state.decoration,
405-
isFocused: state.effectiveFocusNode.hasFocus,
406-
child: Wrap(
407-
direction: direction,
408-
alignment: alignment,
409-
crossAxisAlignment: crossAxisAlignment,
410-
runAlignment: runAlignment,
411-
runSpacing: runSpacing,
412-
spacing: spacing,
413-
textDirection: textDirection,
414-
verticalDirection: verticalDirection,
415-
children: <Widget>[
416-
for (FormBuilderChipOption<T> option in options)
417-
ChoiceChip(
418-
label: option,
419-
side: side,
420-
shape: shape,
421-
selected: field.value == option.value,
422-
onSelected: state.enabled
423-
? (selected) {
424-
final choice = selected ? option.value : null;
425-
state.didChange(choice);
426-
}
427-
: null,
428-
avatar: option.avatar,
429-
selectedColor: selectedColor,
430-
disabledColor: disabledColor,
431-
backgroundColor: backgroundColor,
432-
shadowColor: shadowColor,
433-
selectedShadowColor: selectedShadowColor,
434-
elevation: elevation,
435-
pressElevation: pressElevation,
436-
materialTapTargetSize: materialTapTargetSize,
437-
labelStyle: labelStyle,
438-
labelPadding: labelPadding,
439-
padding: padding,
440-
visualDensity: visualDensity,
441-
avatarBorder: avatarBorder,
442-
showCheckmark: showCheckmark,
443-
surfaceTintColor: surfaceTintColor,
444-
clipBehavior: clipBehavior,
445-
checkmarkColor: checkmarkColor,
446-
autofocus: autofocus,
447-
avatarBoxConstraints: avatarBoxConstraints,
448-
chipAnimationStyle: chipAnimationStyle,
449-
color: color,
450-
iconTheme: iconTheme,
451-
tooltip: tooltip,
452-
),
453-
],
454-
),
455-
),
456-
);
457-
});
395+
}) : super(
396+
builder: (FormFieldState<T?> field) {
397+
final state = field as _FormBuilderChoiceChipState<T>;
398+
399+
return Focus(
400+
focusNode: state.effectiveFocusNode,
401+
skipTraversal: true,
402+
canRequestFocus: state.enabled,
403+
debugLabel: 'FormBuilderChoiceChip-$name',
404+
child: InputDecorator(
405+
decoration: state.decoration,
406+
isFocused: state.effectiveFocusNode.hasFocus,
407+
child: Wrap(
408+
direction: direction,
409+
alignment: alignment,
410+
crossAxisAlignment: crossAxisAlignment,
411+
runAlignment: runAlignment,
412+
runSpacing: runSpacing,
413+
spacing: spacing,
414+
textDirection: textDirection,
415+
verticalDirection: verticalDirection,
416+
children: <Widget>[
417+
for (FormBuilderChipOption<T> option in options)
418+
ChoiceChip(
419+
label: option,
420+
side: side,
421+
shape: shape,
422+
selected: field.value == option.value,
423+
onSelected:
424+
state.enabled
425+
? (selected) {
426+
final choice = selected ? option.value : null;
427+
state.didChange(choice);
428+
}
429+
: null,
430+
avatar: option.avatar,
431+
selectedColor: selectedColor,
432+
disabledColor: disabledColor,
433+
backgroundColor: backgroundColor,
434+
shadowColor: shadowColor,
435+
selectedShadowColor: selectedShadowColor,
436+
elevation: elevation,
437+
pressElevation: pressElevation,
438+
materialTapTargetSize: materialTapTargetSize,
439+
labelStyle: labelStyle,
440+
labelPadding: labelPadding,
441+
padding: padding,
442+
visualDensity: visualDensity,
443+
avatarBorder: avatarBorder,
444+
showCheckmark: showCheckmark,
445+
surfaceTintColor: surfaceTintColor,
446+
clipBehavior: clipBehavior,
447+
checkmarkColor: checkmarkColor,
448+
autofocus: autofocus,
449+
avatarBoxConstraints: avatarBoxConstraints,
450+
chipAnimationStyle: chipAnimationStyle,
451+
color: color,
452+
iconTheme: iconTheme,
453+
tooltip: tooltip,
454+
),
455+
],
456+
),
457+
),
458+
);
459+
},
460+
);
458461

459462
@override
460463
FormBuilderFieldDecorationState<FormBuilderChoiceChips<T>, T> createState() =>

0 commit comments

Comments
 (0)