File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -28,4 +28,48 @@ Since this package makes use of [file_picker package](https://pub.dev/packages/f
28
28
print(val);
29
29
},
30
30
),
31
+ ```
32
+
33
+ On mobile platforms the file picker will open a default document picker if used with FileType.any.
34
+ If you want to be able to pick documents and images in the same form field you will need to define
35
+ different file types and thus different selectors. To achieve this use the typeSelectors parameter:
36
+ This way the user will see two buttons to open a file picker for documents and a file picker for the photos
37
+ gallery.
38
+
39
+ For example:
40
+
41
+ ``` dart
42
+ FormBuilderFilePicker(
43
+ name: "attachments",
44
+ previewImages: false,
45
+ allowMultiple: true,
46
+ withData: true,
47
+ typeSelectors: [
48
+ TypeSelector(
49
+ type: FileType.any,
50
+ selector: Row(
51
+ children: <Widget>[
52
+ Icon(Icons.add_circle),
53
+ Padding(
54
+ padding: const EdgeInsets.only(left: 8.0),
55
+ child: Text("Add documents"),
56
+ ),
57
+ ],
58
+ ),
59
+ ),
60
+ if (!kIsWeb)
61
+ TypeSelector(
62
+ type: FileType.image,
63
+ selector: Row(
64
+ children: <Widget>[
65
+ Icon(Icons.add_photo_alternate),
66
+ Padding(
67
+ padding: const EdgeInsets.only(left: 8.0),
68
+ child: Text("Add images"),
69
+ ),
70
+ ],
71
+ ),
72
+ ),
73
+ ],
74
+ )
31
75
```
You can’t perform that action at this time.
0 commit comments