Skip to content

Commit 35db911

Browse files
committed
added description for the new field
1 parent f118abd commit 35db911

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,48 @@ Since this package makes use of [file_picker package](https://pub.dev/packages/f
2828
print(val);
2929
},
3030
),
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+
)
3175
```

0 commit comments

Comments
 (0)