Skip to content

Commit a11b887

Browse files
style: apply new dart format
1 parent 9bacc60 commit a11b887

11 files changed

+81
-100
lines changed

example/lib/main.dart

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ class _MyHomePageState extends State<MyHomePage> {
8484
autovalidateMode: AutovalidateMode.onUserInteraction,
8585
min: 1,
8686
max: 100,
87-
validator:
88-
(value) =>
89-
value != null && value < 50 && value > 5
90-
? null
91-
: 'Required value between 5 and 50',
87+
validator: (value) => value != null && value < 50 && value > 5
88+
? null
89+
: 'Required value between 5 and 50',
9290
),
9391
const SizedBox(height: 16),
9492
FormBuilderCupertinoTextField(
@@ -98,11 +96,8 @@ class _MyHomePageState extends State<MyHomePage> {
9896
borderRadius: BorderRadius.circular(8),
9997
),
10098
autovalidateMode: AutovalidateMode.onUserInteraction,
101-
validator:
102-
(value) =>
103-
value != null && value.length > 4
104-
? null
105-
: 'Write a text',
99+
validator: (value) =>
100+
value != null && value.length > 4 ? null : 'Write a text',
106101
),
107102
],
108103
),

lib/src/fields/form_builder_cupertino_checkbox.dart

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -158,28 +158,25 @@ class FormBuilderCupertinoCheckbox extends FormBuilderField<bool> {
158158
autofocus: autofocus,
159159
mouseCursor: mouseCursor,
160160
semanticLabel: semanticLabel,
161-
onChanged:
162-
state.enabled
163-
? (value) {
164-
field.didChange(value);
165-
}
166-
: null,
161+
onChanged: state.enabled
162+
? (value) {
163+
field.didChange(value);
164+
}
165+
: null,
167166
activeColor: activeColor,
168167
);
169168
return CupertinoFormRow(
170-
error:
171-
state.hasError
172-
? errorBuilder != null
173-
? errorBuilder(state.context, state.errorText ?? '')
174-
: Text(state.errorText ?? '')
175-
: null,
169+
error: state.hasError
170+
? errorBuilder != null
171+
? errorBuilder(state.context, state.errorText ?? '')
172+
: Text(state.errorText ?? '')
173+
: null,
176174
helper: helper,
177175
padding: contentPadding,
178176
prefix: prefix,
179-
child:
180-
shouldExpandedField
181-
? SizedBox(width: double.infinity, child: fieldWidget)
182-
: fieldWidget,
177+
child: shouldExpandedField
178+
? SizedBox(width: double.infinity, child: fieldWidget)
179+
: fieldWidget,
183180
);
184181
},
185182
);

lib/src/fields/form_builder_cupertino_segmented_control.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,17 @@ class FormBuilderCupertinoSegmentedControl<T extends Object>
110110
);
111111

112112
return CupertinoFormRow(
113-
error:
114-
state.hasError
115-
? errorBuilder != null
116-
? errorBuilder(state.context, state.errorText ?? '')
117-
: Text(state.errorText ?? '')
118-
: null,
113+
error: state.hasError
114+
? errorBuilder != null
115+
? errorBuilder(state.context, state.errorText ?? '')
116+
: Text(state.errorText ?? '')
117+
: null,
119118
helper: helper,
120119
padding: contentPadding,
121120
prefix: prefix,
122-
child:
123-
shouldExpandedField
124-
? SizedBox(width: double.infinity, child: fieldWidget)
125-
: fieldWidget,
121+
child: shouldExpandedField
122+
? SizedBox(width: double.infinity, child: fieldWidget)
123+
: fieldWidget,
126124
);
127125
},
128126
);

lib/src/fields/form_builder_cupertino_slider.dart

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,11 @@ class FormBuilderCupertinoSlider extends FormBuilderField<double> {
196196
activeColor: activeColor,
197197
onChangeEnd: onChangeEnd,
198198
onChangeStart: onChangeStart,
199-
onChanged:
200-
state.enabled
201-
? (value) {
202-
field.didChange(value);
203-
}
204-
: null,
199+
onChanged: state.enabled
200+
? (value) {
201+
field.didChange(value);
202+
}
203+
: null,
205204
thumbColor: thumbColor,
206205
),
207206
),
@@ -228,12 +227,11 @@ class FormBuilderCupertinoSlider extends FormBuilderField<double> {
228227
);
229228

230229
return CupertinoFormRow(
231-
error:
232-
state.hasError
233-
? errorBuilder != null
234-
? errorBuilder(state.context, state.errorText ?? '')
235-
: Text(state.errorText ?? '')
236-
: null,
230+
error: state.hasError
231+
? errorBuilder != null
232+
? errorBuilder(state.context, state.errorText ?? '')
233+
: Text(state.errorText ?? '')
234+
: null,
237235
helper: helper,
238236
padding: contentPadding,
239237
prefix: prefix,

lib/src/fields/form_builder_cupertino_sliding_segmented_control.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,17 @@ class FormBuilderCupertinoSlidingSegmentedControl<T extends Object>
9999
);
100100

101101
return CupertinoFormRow(
102-
error:
103-
state.hasError
104-
? errorBuilder != null
105-
? errorBuilder(state.context, state.errorText ?? '')
106-
: Text(state.errorText ?? '')
107-
: null,
102+
error: state.hasError
103+
? errorBuilder != null
104+
? errorBuilder(state.context, state.errorText ?? '')
105+
: Text(state.errorText ?? '')
106+
: null,
108107
helper: helper,
109108
padding: contentPadding,
110109
prefix: prefix,
111-
child:
112-
shouldExpandedField
113-
? SizedBox(width: double.infinity, child: fieldWidget)
114-
: fieldWidget,
110+
child: shouldExpandedField
111+
? SizedBox(width: double.infinity, child: fieldWidget)
112+
: fieldWidget,
115113
);
116114
},
117115
);

lib/src/fields/form_builder_cupertino_switch.dart

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,11 @@ class FormBuilderCupertinoSwitch extends FormBuilderField<bool> {
332332

333333
final fieldWidget = CupertinoSwitch(
334334
value: state.value ?? false,
335-
onChanged:
336-
state.enabled
337-
? (value) {
338-
field.didChange(value);
339-
}
340-
: null,
335+
onChanged: state.enabled
336+
? (value) {
337+
field.didChange(value);
338+
}
339+
: null,
341340
dragStartBehavior: dragStartBehavior,
342341
thumbColor: thumbColor,
343342
activeTrackColor: activeTrackColor,
@@ -360,19 +359,17 @@ class FormBuilderCupertinoSwitch extends FormBuilderField<bool> {
360359
trackOutlineWidth: trackOutlineWidth,
361360
);
362361
return CupertinoFormRow(
363-
error:
364-
state.hasError
365-
? errorBuilder != null
366-
? errorBuilder(state.context, state.errorText ?? '')
367-
: Text(state.errorText ?? '')
368-
: null,
362+
error: state.hasError
363+
? errorBuilder != null
364+
? errorBuilder(state.context, state.errorText ?? '')
365+
: Text(state.errorText ?? '')
366+
: null,
369367
helper: helper,
370368
padding: contentPadding,
371369
prefix: prefix,
372-
child:
373-
shouldExpandedField
374-
? SizedBox(width: double.infinity, child: fieldWidget)
375-
: fieldWidget,
370+
child: shouldExpandedField
371+
? SizedBox(width: double.infinity, child: fieldWidget)
372+
: fieldWidget,
376373
);
377374
},
378375
);

lib/src/fields/form_builder_cupertino_text_field.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,19 +487,17 @@ class FormBuilderCupertinoTextField extends FormBuilderField<String> {
487487
);
488488

489489
return CupertinoFormRow(
490-
error:
491-
state.hasError
492-
? errorBuilder != null
493-
? errorBuilder(state.context, state.errorText ?? '')
494-
: Text(state.errorText ?? '')
495-
: null,
490+
error: state.hasError
491+
? errorBuilder != null
492+
? errorBuilder(state.context, state.errorText ?? '')
493+
: Text(state.errorText ?? '')
494+
: null,
496495
helper: helper,
497496
padding: contentPadding,
498497
prefix: prefix,
499-
child:
500-
shouldExpandedField
501-
? SizedBox(width: double.infinity, child: fieldWidget)
502-
: fieldWidget,
498+
child: shouldExpandedField
499+
? SizedBox(width: double.infinity, child: fieldWidget)
500+
: fieldWidget,
503501
);
504502
},
505503
);

test/src/fields/form_builder_cupertino_segmented_control_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ void main() {
4040
FormBuilderFieldOption(value: 'AM'),
4141
FormBuilderFieldOption(value: 'PM'),
4242
],
43-
validator:
44-
(value) => value == null || value.isEmpty ? errorTextField : null,
43+
validator: (value) =>
44+
value == null || value.isEmpty ? errorTextField : null,
4545
);
4646
await tester.pumpWidget(buildTestableFieldWidget(testWidget));
4747

@@ -92,8 +92,8 @@ void main() {
9292
FormBuilderFieldOption(value: 'AM'),
9393
FormBuilderFieldOption(value: 'PM'),
9494
],
95-
validator:
96-
(value) => value == null || value.isEmpty ? errorTextField : null,
95+
validator: (value) =>
96+
value == null || value.isEmpty ? errorTextField : null,
9797
);
9898
await tester.pumpWidget(buildTestableFieldWidget(testWidget));
9999

test/src/fields/form_builder_cupertino_slider_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ void main() {
5454
max: 10,
5555
min: 0,
5656
initialValue: 0,
57-
validator:
58-
(value) => value == null || value <= 0 ? errorTextField : null,
57+
validator: (value) =>
58+
value == null || value <= 0 ? errorTextField : null,
5959
);
6060
await tester.pumpWidget(buildTestableFieldWidget(testWidget));
6161

@@ -110,8 +110,8 @@ void main() {
110110
max: 10,
111111
min: 0,
112112
initialValue: 0,
113-
validator:
114-
(value) => value == null || value <= 0 ? errorTextField : null,
113+
validator: (value) =>
114+
value == null || value <= 0 ? errorTextField : null,
115115
);
116116
await tester.pumpWidget(buildTestableFieldWidget(testWidget));
117117

test/src/fields/form_builder_cupertino_sliding_segmented_control_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ void main() {
4040
FormBuilderFieldOption(value: 'AM'),
4141
FormBuilderFieldOption(value: 'PM'),
4242
],
43-
validator:
44-
(value) => value == null || value.isEmpty ? errorTextField : null,
43+
validator: (value) =>
44+
value == null || value.isEmpty ? errorTextField : null,
4545
);
4646
await tester.pumpWidget(buildTestableFieldWidget(testWidget));
4747

@@ -92,8 +92,8 @@ void main() {
9292
FormBuilderFieldOption(value: 'AM'),
9393
FormBuilderFieldOption(value: 'PM'),
9494
],
95-
validator:
96-
(value) => value == null || value.isEmpty ? errorTextField : null,
95+
validator: (value) =>
96+
value == null || value.isEmpty ? errorTextField : null,
9797
);
9898
await tester.pumpWidget(buildTestableFieldWidget(testWidget));
9999

0 commit comments

Comments
 (0)