@@ -195,27 +195,24 @@ class FormBuilderImagePicker extends FormBuilderFieldDecoration<List<dynamic>> {
195195 placeholderWidget ??
196196 SizedBox (
197197 width: previewWidth,
198- child:
199- placeholderImage != null
200- ? Image (image: placeholderImage)
201- : Container (
202- color:
203- (state.enabled
204- ? backgroundColor ??
205- primaryColor.withAlpha (50 )
206- : disabledColor),
207- child: Icon (
208- icon ?? Icons .camera_enhance,
209- color:
210- state.enabled
211- ? iconColor ?? primaryColor
212- : disabledColor,
213- ),
198+ child: placeholderImage != null
199+ ? Image (image: placeholderImage)
200+ : Container (
201+ color: (state.enabled
202+ ? backgroundColor ?? primaryColor.withAlpha (50 )
203+ : disabledColor),
204+ child: Icon (
205+ icon ?? Icons .camera_enhance,
206+ color: state.enabled
207+ ? iconColor ?? primaryColor
208+ : disabledColor,
214209 ),
210+ ),
215211 ),
216212 onTap: () async {
217- final remainingImages =
218- maxImages == null ? null : maxImages - value.length;
213+ final remainingImages = maxImages == null
214+ ? null
215+ : maxImages - value.length;
219216
220217 final imageSourceSheet = ImageSourceBottomSheet (
221218 maxHeight: maxHeight,
@@ -240,12 +237,12 @@ class FormBuilderImagePicker extends FormBuilderFieldDecoration<List<dynamic>> {
240237 onTap != null
241238 ? onTap (imageSourceSheet)
242239 : await showModalBottomSheet <void >(
243- context: state.context,
244- clipBehavior: optionsClipBehavior,
245- builder: (_) {
246- return imageSourceSheet;
247- },
248- );
240+ context: state.context,
241+ clipBehavior: optionsClipBehavior,
242+ builder: (_) {
243+ return imageSourceSheet;
244+ },
245+ );
249246 },
250247 );
251248
@@ -268,20 +265,19 @@ class FormBuilderImagePicker extends FormBuilderFieldDecoration<List<dynamic>> {
268265 'Consider using displayCustomType to handle the type: ${displayItem .runtimeType }' ,
269266 );
270267
271- final displayWidget =
272- displayItem is Widget
273- ? displayItem
274- : displayItem is ImageProvider
275- ? Image (image: displayItem, fit: fit)
276- : displayItem is Uint8List
277- ? Image .memory (displayItem, fit: fit)
278- : displayItem is String
279- ? Image .network (displayItem, fit: fit)
280- : XFileImage (
281- file: displayItem,
282- fit: fit,
283- loadingWidget: loadingWidget,
284- );
268+ final displayWidget = displayItem is Widget
269+ ? displayItem
270+ : displayItem is ImageProvider
271+ ? Image (image: displayItem, fit: fit)
272+ : displayItem is Uint8List
273+ ? Image .memory (displayItem, fit: fit)
274+ : displayItem is String
275+ ? Image .network (displayItem, fit: fit)
276+ : XFileImage (
277+ file: displayItem,
278+ fit: fit,
279+ loadingWidget: loadingWidget,
280+ );
285281 return Stack (
286282 key: ObjectKey (item),
287283 children: < Widget > [
@@ -320,10 +316,9 @@ class FormBuilderImagePicker extends FormBuilderFieldDecoration<List<dynamic>> {
320316 if (previewBuilder != null ) {
321317 return Builder (
322318 builder: (context) {
323- final widgets =
324- value
325- .mapIndexed ((i, v) => itemBuilder (context, v, i))
326- .toList ();
319+ final widgets = value
320+ .mapIndexed ((i, v) => itemBuilder (context, v, i))
321+ .toList ();
327322
328323 return previewBuilder (
329324 context,
@@ -336,36 +331,35 @@ class FormBuilderImagePicker extends FormBuilderFieldDecoration<List<dynamic>> {
336331
337332 final child = SizedBox (
338333 height: previewHeight,
339- child:
340- itemCount == 0
341- ? null //empty list
342- : itemCount ==
343- 1 //has a single item,
344- ? canUpload
345- ? addButtonBuilder (state.context) //upload button
346- : SizedBox (
334+ child: itemCount == 0
335+ ? null //empty list
336+ : itemCount ==
337+ 1 //has a single item,
338+ ? canUpload
339+ ? addButtonBuilder (state.context) //upload button
340+ : SizedBox (
347341 width: previewAutoSizeWidth ? null : previewWidth,
348342 child: itemBuilder (state.context, value.first, 0 ),
349343 )
350- : ListView .builder (
351- itemExtent: previewAutoSizeWidth ? null : previewWidth,
352- scrollDirection: Axis .horizontal,
353- itemCount: itemCount,
354- itemBuilder: (context, index) {
355- return Container (
356- margin: previewMargin,
357- child: Builder (
358- builder: (context) {
359- if (index < value.length) {
360- final item = value[index];
361- return itemBuilder (context, item, index);
362- }
363- return addButtonBuilder (context);
364- },
365- ),
366- );
367- },
368- ),
344+ : ListView .builder (
345+ itemExtent: previewAutoSizeWidth ? null : previewWidth,
346+ scrollDirection: Axis .horizontal,
347+ itemCount: itemCount,
348+ itemBuilder: (context, index) {
349+ return Container (
350+ margin: previewMargin,
351+ child: Builder (
352+ builder: (context) {
353+ if (index < value.length) {
354+ final item = value[index];
355+ return itemBuilder (context, item, index);
356+ }
357+ return addButtonBuilder (context);
358+ },
359+ ),
360+ );
361+ },
362+ ),
369363 );
370364 return showDecoration
371365 ? InputDecorator (decoration: state.decoration, child: child)
0 commit comments