@@ -16,12 +16,11 @@ class MyApp extends StatelessWidget {
16
16
theme: ThemeData (
17
17
primarySwatch: Colors .blue,
18
18
// brightness: Brightness.dark,
19
- inputDecorationTheme: InputDecorationTheme (
19
+ inputDecorationTheme: const InputDecorationTheme (
20
20
// labelStyle: TextStyle(color: Colors.purple),
21
21
border: OutlineInputBorder (
22
22
gapPadding: 10 ,
23
23
),
24
-
25
24
),
26
25
),
27
26
home: MyHomePage (),
@@ -55,7 +54,7 @@ class MyHomePageState extends State<MyHomePage> {
55
54
title: Text ('FormBuilder Example' ),
56
55
),
57
56
body: Padding (
58
- padding: EdgeInsets .all (10 ),
57
+ padding: const EdgeInsets .all (10 ),
59
58
child: ListView (
60
59
children: < Widget > [
61
60
FormBuilder (
@@ -70,7 +69,7 @@ class MyHomePageState extends State<MyHomePage> {
70
69
children: < Widget > [
71
70
FormBuilderFilterChip (
72
71
attribute: 'filter_chip' ,
73
- decoration: InputDecoration (
72
+ decoration: const InputDecoration (
74
73
labelText: 'Select many options' ,
75
74
),
76
75
options: [
@@ -89,7 +88,7 @@ class MyHomePageState extends State<MyHomePage> {
89
88
SizedBox (height: 15 ),
90
89
FormBuilderChoiceChip (
91
90
attribute: 'choice_chip' ,
92
- decoration: InputDecoration (
91
+ decoration: const InputDecoration (
93
92
labelText: 'Select an option' ,
94
93
),
95
94
options: [
@@ -111,11 +110,11 @@ class MyHomePageState extends State<MyHomePage> {
111
110
attribute: 'color_picker' ,
112
111
// initialValue: Colors.yellow,
113
112
colorPickerType: ColorPickerType .SlidePicker ,
114
- decoration: InputDecoration (labelText: 'Pick Color' ),
113
+ decoration: const InputDecoration (labelText: 'Pick Color' ),
115
114
),
116
115
SizedBox (height: 15 ),
117
116
FormBuilderChipsInput (
118
- decoration: InputDecoration (labelText: 'Chips' ),
117
+ decoration: const InputDecoration (labelText: 'Chips' ),
119
118
attribute: 'chips_test' ,
120
119
onChanged: _onChanged,
121
120
initialValue: [
@@ -172,7 +171,7 @@ class MyHomePageState extends State<MyHomePage> {
172
171
attribute: 'date' ,
173
172
onChanged: _onChanged,
174
173
inputType: InputType .time,
175
- decoration: InputDecoration (
174
+ decoration: const InputDecoration (
176
175
labelText: 'Appointment Time' ,
177
176
),
178
177
validator: (val) => null ,
@@ -185,10 +184,13 @@ class MyHomePageState extends State<MyHomePage> {
185
184
attribute: 'date_range' ,
186
185
firstDate: DateTime (1970 ),
187
186
lastDate: DateTime .now (),
188
- initialValue: [DateTime .now ().subtract (Duration (days: 30 )), DateTime .now ().subtract (Duration (seconds: 10 ))],
187
+ initialValue: [
188
+ DateTime .now ().subtract (Duration (days: 30 )),
189
+ DateTime .now ().subtract (Duration (seconds: 10 ))
190
+ ],
189
191
format: DateFormat ('yyyy-MM-dd' ),
190
192
onChanged: _onChanged,
191
- decoration: InputDecoration (
193
+ decoration: const InputDecoration (
192
194
labelText: 'Date Range' ,
193
195
helperText: 'Helper text' ,
194
196
hintText: 'Hint text' ,
@@ -205,7 +207,7 @@ class MyHomePageState extends State<MyHomePage> {
205
207
divisions: 20 ,
206
208
activeColor: Colors .red,
207
209
inactiveColor: Colors .pink[100 ],
208
- decoration: InputDecoration (
210
+ decoration: const InputDecoration (
209
211
labelText: 'Number of things' ,
210
212
),
211
213
),
@@ -220,7 +222,7 @@ class MyHomePageState extends State<MyHomePage> {
220
222
divisions: 20 ,
221
223
activeColor: Colors .red,
222
224
inactiveColor: Colors .pink[100 ],
223
- decoration: InputDecoration (
225
+ decoration: const InputDecoration (
224
226
labelText: 'Price Range' ,
225
227
),
226
228
),
@@ -261,7 +263,7 @@ class MyHomePageState extends State<MyHomePage> {
261
263
),
262
264
FormBuilderTextField (
263
265
attribute: 'age' ,
264
- decoration: InputDecoration (
266
+ decoration: const InputDecoration (
265
267
labelText:
266
268
'This value is passed along to the [Text.maxLines] attribute of the [Text] widget used to display the hint text.' ,
267
269
),
@@ -280,7 +282,7 @@ class MyHomePageState extends State<MyHomePage> {
280
282
SizedBox (height: 15 ),
281
283
FormBuilderDropdown (
282
284
attribute: 'gender' ,
283
- decoration: InputDecoration (
285
+ decoration: const InputDecoration (
284
286
labelText: 'Gender' ,
285
287
border: UnderlineInputBorder (
286
288
borderSide: BorderSide (
@@ -301,7 +303,7 @@ class MyHomePageState extends State<MyHomePage> {
301
303
),
302
304
SizedBox (height: 15 ),
303
305
FormBuilderTypeAhead (
304
- decoration: InputDecoration (
306
+ decoration: const InputDecoration (
305
307
labelText: 'Country' ,
306
308
),
307
309
attribute: 'country' ,
@@ -331,7 +333,7 @@ class MyHomePageState extends State<MyHomePage> {
331
333
),
332
334
SizedBox (height: 15 ),
333
335
FormBuilderTypeAhead <Contact >(
334
- decoration: InputDecoration (
336
+ decoration: const InputDecoration (
335
337
labelText: 'Contact Person' ,
336
338
),
337
339
initialValue: contacts[0 ],
@@ -380,7 +382,7 @@ class MyHomePageState extends State<MyHomePage> {
380
382
),
381
383
SizedBox (height: 15 ),
382
384
/*FormBuilderRadioGroup(
383
- decoration: InputDecoration(labelText: 'Pick a number'),
385
+ decoration: const InputDecoration(labelText: 'Pick a number'),
384
386
attribute: 'number',
385
387
readOnly: true,
386
388
options: [
@@ -424,17 +426,18 @@ class MyHomePageState extends State<MyHomePage> {
424
426
),
425
427
SizedBox (height: 15 ),
426
428
FormBuilderTouchSpin (
427
- decoration: InputDecoration (labelText: 'Stepper' ),
429
+ decoration: const InputDecoration (labelText: 'Stepper' ),
428
430
attribute: 'stepper' ,
429
431
initialValue: 10 ,
430
432
step: 1 ,
431
433
iconSize: 48.0 ,
432
- addIcon: Icon (Icons .arrow_right),
433
- subtractIcon: Icon (Icons .arrow_left),
434
+ addIcon: const Icon (Icons .arrow_right),
435
+ subtractIcon: const Icon (Icons .arrow_left),
434
436
),
435
437
SizedBox (height: 15 ),
436
438
FormBuilderRate (
437
- decoration: InputDecoration (labelText: 'Rate this form' ),
439
+ decoration:
440
+ const InputDecoration (labelText: 'Rate this form' ),
438
441
attribute: 'rate' ,
439
442
iconSize: 32.0 ,
440
443
initialValue: 1.0 ,
@@ -464,7 +467,7 @@ class MyHomePageState extends State<MyHomePage> {
464
467
SizedBox (height: 15 ),
465
468
FormBuilderImagePicker (
466
469
attribute: 'images' ,
467
- decoration: InputDecoration (
470
+ decoration: const InputDecoration (
468
471
labelText: 'Images' ,
469
472
),
470
473
maxImages: 3 ,
@@ -490,8 +493,10 @@ class MyHomePageState extends State<MyHomePage> {
490
493
valueTransformer: (value) {
491
494
return value.isoCode;
492
495
},
493
- decoration: InputDecoration (
494
- border: OutlineInputBorder (), labelText: 'Country' ),
496
+ decoration: const InputDecoration (
497
+ border: OutlineInputBorder (),
498
+ labelText: 'Country' ,
499
+ ),
495
500
validators: [
496
501
FormBuilderValidators .required (
497
502
errorText: 'This field required.' ),
@@ -504,7 +509,7 @@ class MyHomePageState extends State<MyHomePage> {
504
509
// defaultSelectedCountryIsoCode: 'KE',
505
510
cursorColor: Colors .black,
506
511
// style: TextStyle(color: Colors.black, fontSize: 18),
507
- decoration: InputDecoration (
512
+ decoration: const InputDecoration (
508
513
border: OutlineInputBorder (),
509
514
labelText: 'Phone Number' ,
510
515
),
@@ -519,7 +524,7 @@ class MyHomePageState extends State<MyHomePage> {
519
524
),
520
525
SizedBox (height: 15 ),
521
526
FormBuilderSignaturePad (
522
- decoration: InputDecoration (labelText: 'Signature' ),
527
+ decoration: const InputDecoration (labelText: 'Signature' ),
523
528
attribute: 'signature' ,
524
529
// height: 250,
525
530
clearButtonText: 'Start Over' ,
@@ -528,11 +533,15 @@ class MyHomePageState extends State<MyHomePage> {
528
533
SizedBox (height: 15 ),
529
534
FormBuilderRadioGroup (
530
535
attribute: 'radio_group' ,
531
- decoration: InputDecoration (labelText: 'Radio Group' ),
536
+ decoration: const InputDecoration (labelText: 'Radio Group' ),
532
537
onChanged: _onChanged,
533
538
options: [
534
- FormBuilderFieldOption (value: 'Male' ,),
535
- FormBuilderFieldOption (value: 'Female' ,),
539
+ FormBuilderFieldOption (
540
+ value: 'Male' ,
541
+ ),
542
+ FormBuilderFieldOption (
543
+ value: 'Female' ,
544
+ ),
536
545
],
537
546
),
538
547
SizedBox (height: 15 ),
@@ -548,8 +557,10 @@ class MyHomePageState extends State<MyHomePage> {
548
557
return InputDecorator (
549
558
decoration: InputDecoration (
550
559
labelText: 'FormBuilderCustomField' ,
551
- contentPadding:
552
- EdgeInsets .only (top: 10.0 , bottom: 0.0 ),
560
+ contentPadding: const EdgeInsets .only (
561
+ top: 10.0 ,
562
+ bottom: 0.0 ,
563
+ ),
553
564
border: InputBorder .none,
554
565
errorText: field.errorText,
555
566
),
@@ -558,7 +569,7 @@ class MyHomePageState extends State<MyHomePage> {
558
569
child: CupertinoPicker (
559
570
itemExtent: 30 ,
560
571
children:
561
- allCountries.map ((c) => Text (c)).toList (),
572
+ allCountries.map ((c) => Text (c)).toList (),
562
573
onSelectedItemChanged: (index) {
563
574
print (index);
564
575
field.didChange (allCountries[index]);
0 commit comments