@@ -39,6 +39,11 @@ class FormBuilderImagePicker extends StatefulWidget {
39
39
40
40
final int maxImages;
41
41
42
+ final Widget cameraIcon;
43
+ final Widget galleryIcon;
44
+ final Widget cameraLabel;
45
+ final Widget galleryLabel;
46
+
42
47
const FormBuilderImagePicker ({
43
48
Key key,
44
49
@required this .attribute,
@@ -59,6 +64,10 @@ class FormBuilderImagePicker extends StatefulWidget {
59
64
this .imageQuality,
60
65
this .preferredCameraDevice = CameraDevice .rear,
61
66
this .maxImages,
67
+ this .cameraIcon = const Icon (Icons .camera_enhance),
68
+ this .galleryIcon = const Icon (Icons .image),
69
+ this .cameraLabel = const Text ('Camera' ),
70
+ this .galleryLabel = const Text ('Gallery' ),
62
71
}) : super (key: key);
63
72
64
73
@override
@@ -121,6 +130,8 @@ class _FormBuilderImagePickerState extends State<FormBuilderImagePicker> {
121
130
}
122
131
},
123
132
builder: (field) {
133
+ var theme = Theme .of (context);
134
+
124
135
return InputDecorator (
125
136
decoration: widget.decoration.copyWith (
126
137
enabled: ! _readOnly,
@@ -131,9 +142,7 @@ class _FormBuilderImagePickerState extends State<FormBuilderImagePicker> {
131
142
child: Column (
132
143
crossAxisAlignment: CrossAxisAlignment .start,
133
144
children: < Widget > [
134
- const SizedBox (
135
- height: 8 ,
136
- ),
145
+ const SizedBox (height: 8 ),
137
146
Container (
138
147
height: widget.imageHeight,
139
148
child: ListView (
@@ -183,24 +192,26 @@ class _FormBuilderImagePickerState extends State<FormBuilderImagePicker> {
183
192
height: widget.imageHeight,
184
193
child: Icon (Icons .camera_enhance,
185
194
color: _readOnly
186
- ? Theme .of (context).disabledColor
187
- : widget.iconColor ??
188
- Theme .of (context).primaryColor),
195
+ ? theme.disabledColor
196
+ : widget.iconColor ?? theme.primaryColor),
189
197
color: (_readOnly
190
- ? Theme .of (context).disabledColor
191
- : widget.iconColor ??
192
- Theme .of (context).primaryColor)
198
+ ? theme.disabledColor
199
+ : widget.iconColor ?? theme.primaryColor)
193
200
.withAlpha (50 )),
194
201
onTap: () {
195
202
showModalBottomSheet (
196
203
context: context,
197
204
builder: (_) {
198
- return ImageSourceSheet (
205
+ return ImageSourceBottomSheet (
199
206
maxHeight: widget.maxHeight,
200
207
maxWidth: widget.maxWidth,
201
208
imageQuality: widget.imageQuality,
202
209
preferredCameraDevice:
203
210
widget.preferredCameraDevice,
211
+ cameraIcon: widget.cameraIcon,
212
+ galleryIcon: widget.galleryIcon,
213
+ cameraLabel: widget.cameraLabel,
214
+ galleryLabel: widget.galleryLabel,
204
215
onImageSelected: (image) {
205
216
field.didChange ([...field.value, image]);
206
217
widget.onChanged? .call (field.value);
0 commit comments