@@ -75,34 +75,35 @@ class FormBuilderFilePicker
75
75
final Widget Function (List <Widget > types)? customTypeViewerBuilder;
76
76
77
77
/// Creates field for image(s) from user device storage
78
- FormBuilderFilePicker ({
79
- //From Super
80
- super .key,
81
- required super .name,
82
- super .validator,
83
- super .initialValue,
84
- super .decoration,
85
- super .onChanged,
86
- super .valueTransformer,
87
- super .enabled,
88
- super .onSaved,
89
- super .autovalidateMode = AutovalidateMode .disabled,
90
- super .onReset,
91
- super .focusNode,
92
- this .maxFiles,
93
- this .withData = kIsWeb,
94
- this .withReadStream = false ,
95
- this .allowMultiple = false ,
96
- this .previewImages = true ,
97
- this .typeSelectors = const [
98
- TypeSelector (type: FileType .any, selector: Icon (Icons .add_circle))
99
- ],
100
- this .allowedExtensions,
101
- this .onFileLoading,
102
- this .allowCompression = true ,
103
- this .customFileViewerBuilder,
104
- this .customTypeViewerBuilder
105
- }) : super (
78
+ FormBuilderFilePicker (
79
+ {
80
+ //From Super
81
+ super .key,
82
+ required super .name,
83
+ super .validator,
84
+ super .initialValue,
85
+ super .decoration,
86
+ super .onChanged,
87
+ super .valueTransformer,
88
+ super .enabled,
89
+ super .onSaved,
90
+ super .autovalidateMode = AutovalidateMode .disabled,
91
+ super .onReset,
92
+ super .focusNode,
93
+ this .maxFiles,
94
+ this .withData = kIsWeb,
95
+ this .withReadStream = false ,
96
+ this .allowMultiple = false ,
97
+ this .previewImages = true ,
98
+ this .typeSelectors = const [
99
+ TypeSelector (type: FileType .any, selector: Icon (Icons .add_circle))
100
+ ],
101
+ this .allowedExtensions,
102
+ this .onFileLoading,
103
+ this .allowCompression = true ,
104
+ this .customFileViewerBuilder,
105
+ this .customTypeViewerBuilder})
106
+ : super (
106
107
builder: (FormFieldState <List <PlatformFile >?> field) {
107
108
final state = field as _FormBuilderFilePickerState ;
108
109
@@ -114,11 +115,13 @@ class FormBuilderFilePicker
114
115
child: Column (
115
116
children: < Widget > [
116
117
customTypeViewerBuilder != null
117
- ? customTypeViewerBuilder (state.getTypeSelectorActions (typeSelectors, field))
118
+ ? customTypeViewerBuilder (
119
+ state.getTypeSelectorActions (typeSelectors, field))
118
120
: Row (
119
- mainAxisAlignment: MainAxisAlignment .spaceBetween,
120
- children: state.getTypeSelectorActions (typeSelectors, field),
121
- ),
121
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
122
+ children: state.getTypeSelectorActions (
123
+ typeSelectors, field),
124
+ ),
122
125
const SizedBox (height: 3 ),
123
126
customFileViewerBuilder != null
124
127
? customFileViewerBuilder.call (state._files,
@@ -300,18 +303,17 @@ class _FormBuilderFilePickerState extends FormBuilderFieldDecorationState<
300
303
);
301
304
}
302
305
303
- List <Widget > getTypeSelectorActions (List <TypeSelector > typeSelectors, FormFieldState <List <PlatformFile >?> field) {
306
+ List <Widget > getTypeSelectorActions (List <TypeSelector > typeSelectors,
307
+ FormFieldState <List <PlatformFile >?> field) {
304
308
return < Widget > [
305
309
...typeSelectors.map (
306
- (typeSelector) =>
307
- InkWell (
308
- onTap: enabled &&
309
- (null == _remainingItemCount ||
310
- _remainingItemCount! > 0 )
311
- ? () => pickFiles (field, typeSelector.type)
312
- : null ,
313
- child: typeSelector.selector,
314
- ),
310
+ (typeSelector) => InkWell (
311
+ onTap: enabled &&
312
+ (null == _remainingItemCount || _remainingItemCount! > 0 )
313
+ ? () => pickFiles (field, typeSelector.type)
314
+ : null ,
315
+ child: typeSelector.selector,
316
+ ),
315
317
),
316
318
];
317
319
}
0 commit comments