@@ -31,9 +31,7 @@ class MyHomePageState extends State<MyHomePage> {
31
31
@override
32
32
Widget build (BuildContext context) {
33
33
return Scaffold (
34
- appBar: AppBar (
35
- title: const Text ('FormBuilder FilePicker Example' ),
36
- ),
34
+ appBar: AppBar (title: const Text ('FormBuilder FilePicker Example' )),
37
35
body: Padding (
38
36
padding: const EdgeInsets .all (10 ),
39
37
child: FormBuilder (
@@ -56,19 +54,21 @@ class MyHomePageState extends State<MyHomePage> {
56
54
Text ('Upload' ),
57
55
],
58
56
),
59
- )
57
+ ),
60
58
],
61
- customTypeViewerBuilder: (children) => Row (
62
- mainAxisAlignment: MainAxisAlignment .end,
63
- children: children,
64
- ),
59
+ customTypeViewerBuilder:
60
+ (children) => Row (
61
+ mainAxisAlignment: MainAxisAlignment .end,
62
+ children: children,
63
+ ),
65
64
onFileLoading: (val) {
66
65
debugPrint (val.toString ());
67
66
},
68
- customFileViewerBuilder: _useCustomFileViewer
69
- ? (files, filesSetter) =>
70
- customFileViewerBuilder (files ?? [], (newValue) {})
71
- : null ,
67
+ customFileViewerBuilder:
68
+ _useCustomFileViewer
69
+ ? (files, filesSetter) =>
70
+ customFileViewerBuilder (files ?? [], (newValue) {})
71
+ : null ,
72
72
),
73
73
const SizedBox (height: 20 ),
74
74
Row (
@@ -83,21 +83,22 @@ class MyHomePageState extends State<MyHomePage> {
83
83
),
84
84
const Spacer (),
85
85
ElevatedButton (
86
- child: Text (_useCustomFileViewer
87
- ? 'Use Default File Viewer'
88
- : 'Use Custom File Viewer' ),
86
+ child: Text (
87
+ _useCustomFileViewer
88
+ ? 'Use Default File Viewer'
89
+ : 'Use Custom File Viewer' ,
90
+ ),
89
91
onPressed: () {
90
92
setState (
91
- () => _useCustomFileViewer = ! _useCustomFileViewer);
93
+ () => _useCustomFileViewer = ! _useCustomFileViewer,
94
+ );
92
95
},
93
96
),
94
97
const Spacer (),
95
98
ElevatedButton (
96
99
child: const Text ('Reset' ),
97
100
onPressed: () {
98
- setState (
99
- () => _formKey.currentState! .reset (),
100
- );
101
+ setState (() => _formKey.currentState! .reset ());
101
102
},
102
103
),
103
104
],
@@ -116,22 +117,22 @@ class MyHomePageState extends State<MyHomePage> {
116
117
return files.isEmpty
117
118
? const Center (child: Text ('No files' ))
118
119
: ListView .separated (
119
- shrinkWrap: true ,
120
- itemBuilder: (context, index) {
121
- return ListTile (
122
- title: Text (files[index].name),
123
- trailing: IconButton (
124
- icon: const Icon (Icons .delete),
125
- onPressed: () {
126
- files.removeAt (index);
127
- setter.call ([...files]);
128
- },
129
- ),
130
- );
131
- },
132
- separatorBuilder: (context, index) =>
133
- const Divider (color: Colors .blueAccent),
134
- itemCount: files.length,
135
- );
120
+ shrinkWrap: true ,
121
+ itemBuilder: (context, index) {
122
+ return ListTile (
123
+ title: Text (files[index].name),
124
+ trailing: IconButton (
125
+ icon: const Icon (Icons .delete),
126
+ onPressed: () {
127
+ files.removeAt (index);
128
+ setter.call ([...files]);
129
+ },
130
+ ),
131
+ );
132
+ },
133
+ separatorBuilder:
134
+ (context, index) => const Divider (color: Colors .blueAccent),
135
+ itemCount: files.length,
136
+ );
136
137
}
137
138
}
0 commit comments