showImagePickerBottomSheet static method
dynamic
showImagePickerBottomSheet(})
Implementation
static showImagePickerBottomSheet(
BuildContext context,
void Function(File image) callback, {
String? galleryName = 'Gallery',
String? cameraName = 'Camera',
String? cameraAssets,
String? galleryAssets,
}) {
showModalBottomSheet(
backgroundColor: Colors.transparent,
isScrollControlled: true,
context: context,
builder: (BuildContext bc) {
return Container(
alignment: Alignment.bottomCenter,
child: Wrap(
children: [
SizedBox(
height: 130.0,
child: Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.0),
topRight: Radius.circular(16.0),
),
),
child: Row(
children: [
Expanded(
child: InkWell(
onTap: () {
Navigator.pop(context);
pickImage(ImageSource.camera).then((imageFile) {
if (imageFile != null) {
callback(imageFile);
}
});
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
cameraAssets == null
? const Icon(
Icons.camera,
size: 40.0,
color: Colors.blue,
)
: SvgPicture.asset(
cameraAssets,
width: 40.0,
height: 40.0,
),
const SizedBox(height: 10.0),
Text(
cameraName ?? 'Camera',
style: GSFormStyle().titleTextStyle,
)
],
),
),
),
Expanded(
child: InkWell(
onTap: () {
Navigator.pop(context);
pickImage(ImageSource.gallery).then((imageFile) {
if (imageFile != null) {
callback(imageFile);
}
});
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
galleryAssets == null
? const Icon(
Icons.photo_library,
size: 40.0,
color: Colors.blue,
)
: SvgPicture.asset(
galleryAssets,
width: 40.0,
height: 40.0,
),
const SizedBox(height: 10.0),
Text(
galleryName ?? 'Gallery',
style: GSFormStyle().titleTextStyle,
)
],
),
),
),
],
),
),
),
],
),
);
},
);
}