Skip to content

Commit c95d25a

Browse files
style: apply new dart format
1 parent b26aa20 commit c95d25a

30 files changed

+417
-429
lines changed

example/lib/code_page.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@ class CodePage extends StatelessWidget {
44
final String title;
55
final Widget child;
66

7-
const CodePage({
8-
super.key,
9-
required this.title,
10-
required this.child,
11-
});
7+
const CodePage({super.key, required this.title, required this.child});
128

139
@override
1410
Widget build(BuildContext context) {
1511
return Scaffold(
1612
appBar: AppBar(title: Text(title), elevation: 0),
17-
body: Padding(
18-
padding: const EdgeInsets.all(24),
19-
child: child,
20-
),
13+
body: Padding(padding: const EdgeInsets.all(24), child: child),
2114
);
2215
}
2316
}

example/lib/main.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ class MyApp extends StatelessWidget {
2929
],
3030
supportedLocales: FormBuilderLocalizations.supportedLocales,
3131
theme: ThemeData.light().copyWith(
32-
appBarTheme: const AppBarTheme()
33-
.copyWith(backgroundColor: Colors.blue.shade200)),
32+
appBarTheme: const AppBarTheme().copyWith(
33+
backgroundColor: Colors.blue.shade200,
34+
),
35+
),
3436
home: const _HomePage(),
3537
);
3638
}

example/lib/minimal_code_example.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class _ExamplePageState extends State<_ExamplePage> {
8484
debugPrint(_formKey.currentState?.value.toString());
8585
},
8686
child: const Text('Print'),
87-
)
87+
),
8888
],
8989
),
9090
),

example/lib/sources/complete_form.dart

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _CompleteFormState extends State<CompleteForm> {
4242
'best_language': 'Dart',
4343
'age': '13',
4444
'gender': 'Male',
45-
'languages_filter': ['Dart']
45+
'languages_filter': ['Dart'],
4646
},
4747
skipDisabled: true,
4848
child: Column(
@@ -78,8 +78,9 @@ class _CompleteFormState extends State<CompleteForm> {
7878
suffixIcon: IconButton(
7979
icon: const Icon(Icons.close),
8080
onPressed: () {
81-
_formKey.currentState!.fields['date_range']
82-
?.didChange(null);
81+
_formKey.currentState!.fields['date_range']?.didChange(
82+
null,
83+
);
8384
},
8485
),
8586
),
@@ -123,9 +124,9 @@ class _CompleteFormState extends State<CompleteForm> {
123124
divisions: 20,
124125
maxValueWidget: (max) => TextButton(
125126
onPressed: () {
126-
_formKey.currentState?.patchValue(
127-
{'range_slider': const RangeValues(4, 100)},
128-
);
127+
_formKey.currentState?.patchValue({
128+
'range_slider': const RangeValues(4, 100),
129+
});
129130
},
130131
child: Text(max),
131132
),
@@ -200,21 +201,24 @@ class _CompleteFormState extends State<CompleteForm> {
200201
: const Icon(Icons.check),
201202
hintText: 'Select Gender',
202203
),
203-
validator: FormBuilderValidators.compose(
204-
[FormBuilderValidators.required()]),
204+
validator: FormBuilderValidators.compose([
205+
FormBuilderValidators.required(),
206+
]),
205207
items: genderOptions
206-
.map((gender) => DropdownMenuItem(
207-
alignment: AlignmentDirectional.center,
208-
value: gender,
209-
child: Text(gender),
210-
))
208+
.map(
209+
(gender) => DropdownMenuItem(
210+
alignment: AlignmentDirectional.center,
211+
value: gender,
212+
child: Text(gender),
213+
),
214+
)
211215
.toList(),
212216
onChanged: (val) {
213217
setState(() {
214-
_genderHasError = !(_formKey
215-
.currentState?.fields['gender']
216-
?.validate() ??
217-
false);
218+
_genderHasError =
219+
!(_formKey.currentState?.fields['gender']
220+
?.validate() ??
221+
false);
218222
});
219223
},
220224
valueTransformer: (val) => val?.toString(),
@@ -226,13 +230,16 @@ class _CompleteFormState extends State<CompleteForm> {
226230
initialValue: null,
227231
name: 'best_language',
228232
onChanged: _onChanged,
229-
validator: FormBuilderValidators.compose(
230-
[FormBuilderValidators.required()]),
233+
validator: FormBuilderValidators.compose([
234+
FormBuilderValidators.required(),
235+
]),
231236
options: ['Dart', 'Kotlin', 'Java', 'Swift', 'Objective-C']
232-
.map((lang) => FormBuilderFieldOption(
233-
value: lang,
234-
child: Text(lang),
235-
))
237+
.map(
238+
(lang) => FormBuilderFieldOption(
239+
value: lang,
240+
child: Text(lang),
241+
),
242+
)
236243
.toList(growable: false),
237244
controlAffinity: ControlAffinity.trailing,
238245
),
@@ -245,7 +252,8 @@ class _CompleteFormState extends State<CompleteForm> {
245252
FormBuilderCheckboxGroup<String>(
246253
autovalidateMode: AutovalidateMode.onUserInteraction,
247254
decoration: const InputDecoration(
248-
labelText: 'The language of my people'),
255+
labelText: 'The language of my people',
256+
),
249257
name: 'languages',
250258
// initialValue: const ['Dart'],
251259
options: const [
@@ -269,7 +277,8 @@ class _CompleteFormState extends State<CompleteForm> {
269277
FormBuilderFilterChips<String>(
270278
autovalidateMode: AutovalidateMode.onUserInteraction,
271279
decoration: const InputDecoration(
272-
labelText: 'The language of my people'),
280+
labelText: 'The language of my people',
281+
),
273282
name: 'languages_filter',
274283
selectedColor: Colors.red,
275284
options: const [
@@ -303,8 +312,9 @@ class _CompleteFormState extends State<CompleteForm> {
303312
FormBuilderChoiceChips<String>(
304313
autovalidateMode: AutovalidateMode.onUserInteraction,
305314
decoration: const InputDecoration(
306-
labelText:
307-
'Ok, if I had to choose one language, it would be:'),
315+
labelText:
316+
'Ok, if I had to choose one language, it would be:',
317+
),
308318
name: 'languages_choice',
309319
initialValue: 'Dart',
310320
options: const [
@@ -339,15 +349,16 @@ class _CompleteFormState extends State<CompleteForm> {
339349
children: <Widget>[
340350
Expanded(
341351
child: ElevatedButton(
342-
onPressed: () {
343-
if (_formKey.currentState?.saveAndValidate() ?? false) {
344-
debugPrint(_formKey.currentState?.value.toString());
345-
} else {
346-
debugPrint(_formKey.currentState?.value.toString());
347-
debugPrint('validation failed');
348-
}
349-
},
350-
child: const Text('Submit')),
352+
onPressed: () {
353+
if (_formKey.currentState?.saveAndValidate() ?? false) {
354+
debugPrint(_formKey.currentState?.value.toString());
355+
} else {
356+
debugPrint(_formKey.currentState?.value.toString());
357+
debugPrint('validation failed');
358+
}
359+
},
360+
child: const Text('Submit'),
361+
),
351362
),
352363
const SizedBox(width: 20),
353364
Expanded(

example/lib/sources/conditional_fields.dart

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ class _ConditionalFieldsState extends State<ConditionalFields> {
2323
FormBuilderDropdown<int>(
2424
name: 'options',
2525
validator: FormBuilderValidators.required(),
26-
decoration: const InputDecoration(
27-
label: Text('Select the option'),
28-
),
26+
decoration: const InputDecoration(label: Text('Select the option')),
2927
onChanged: (value) {
3028
setState(() {
3129
option = value;
@@ -44,15 +42,10 @@ class _ConditionalFieldsState extends State<ConditionalFields> {
4442
child: FormBuilderTextField(
4543
name: 'textfield',
4644
validator: FormBuilderValidators.minLength(4),
47-
decoration: const InputDecoration(
48-
label: Text('Magic field'),
49-
),
45+
decoration: const InputDecoration(label: Text('Magic field')),
5046
),
5147
),
52-
Visibility(
53-
visible: option == 1,
54-
child: const Text('Magic info'),
55-
),
48+
Visibility(visible: option == 1, child: const Text('Magic info')),
5649
const SizedBox(height: 10),
5750
ElevatedButton(
5851
child: const Text("Submit"),

0 commit comments

Comments
 (0)