@@ -87,7 +87,7 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
87
87
this .type = FileType .any,
88
88
this .allowedExtensions,
89
89
this .onFileLoading,
90
- this .allowCompression = false ,
90
+ this .allowCompression = true ,
91
91
this .customFileViewerBuilder,
92
92
}) : super (
93
93
key: key,
@@ -129,7 +129,7 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
129
129
? customFileViewerBuilder.call (state._files,
130
130
(files) => state._setFiles (files ?? [], field))
131
131
: state.defaultFileViewer (state._files,
132
- field as FormFieldState < List < PlatformFile >> ),
132
+ (files) => state. _setFiles (files ?? [], field) ),
133
133
],
134
134
),
135
135
);
@@ -206,11 +206,8 @@ class _FormBuilderFilePickerState
206
206
207
207
void _setFiles (
208
208
List <PlatformFile > files, FormFieldState <List <PlatformFile >?> field) {
209
- setState (() {
210
- _files = files;
211
- });
209
+ setState (() => _files = files);
212
210
field.didChange (_files);
213
- widget.onChanged? .call (_files);
214
211
}
215
212
216
213
void removeFileAtIndex (int index, FormFieldState <List <PlatformFile >> field) {
@@ -219,7 +216,7 @@ class _FormBuilderFilePickerState
219
216
}
220
217
221
218
Widget defaultFileViewer (
222
- List <PlatformFile > files, FormFieldState <List <PlatformFile >> field ) {
219
+ List <PlatformFile > files, FormFieldSetter <List <PlatformFile >> setter ) {
223
220
final theme = Theme .of (context);
224
221
225
222
return LayoutBuilder (
@@ -277,7 +274,10 @@ class _FormBuilderFilePickerState
277
274
top: 0 ,
278
275
right: 0 ,
279
276
child: InkWell (
280
- onTap: () => removeFileAtIndex (index, field),
277
+ onTap: () {
278
+ files.removeAt (index);
279
+ setter.call ([...files]);
280
+ },
281
281
child: Container (
282
282
margin: const EdgeInsets .all (3 ),
283
283
decoration: BoxDecoration (
0 commit comments