File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import 'package:image_picker/image_picker.dart';
3
3
4
4
import 'image_source_option.dart' ;
5
5
6
+ typedef FutureVoidCallBack = Future <void > Function ();
7
+
6
8
class ImageSourceBottomSheet extends StatefulWidget {
7
9
/// Optional maximum height of image
8
10
final double ? maxHeight;
@@ -37,6 +39,10 @@ class ImageSourceBottomSheet extends StatefulWidget {
37
39
final EdgeInsets ? bottomSheetPadding;
38
40
final bool preventPop;
39
41
42
+ final Widget Function (
43
+ FutureVoidCallBack cameraPicker, FutureVoidCallBack galleryPicker)?
44
+ optionsBuilder;
45
+
40
46
const ImageSourceBottomSheet ({
41
47
Key ? key,
42
48
this .remainingImages,
@@ -51,6 +57,7 @@ class ImageSourceBottomSheet extends StatefulWidget {
51
57
this .cameraLabel,
52
58
this .galleryLabel,
53
59
this .bottomSheetPadding,
60
+ this .optionsBuilder,
54
61
required this .availableImageSources,
55
62
}) : super (key: key);
56
63
@@ -97,6 +104,12 @@ class ImageSourceBottomSheetState extends State<ImageSourceBottomSheet> {
97
104
98
105
@override
99
106
Widget build (BuildContext context) {
107
+ if (widget.optionsBuilder != null ) {
108
+ return widget.optionsBuilder !(
109
+ () => _onPickImage (ImageSource .camera),
110
+ () => _onPickImage (ImageSource .gallery),
111
+ );
112
+ }
100
113
Widget res = Container (
101
114
padding: widget.bottomSheetPadding,
102
115
child: Wrap (
You can’t perform that action at this time.
0 commit comments