cameraImagePicker static method
Future<File?>
cameraImagePicker(
- BuildContext context, {
- CropStyle? cropStyle,
- CropAspectRatio? aspectRatio,
Implementation
static Future<File?> cameraImagePicker(
BuildContext context, {
CropStyle? cropStyle,
CropAspectRatio? aspectRatio,
}) async
{
return showCupertinoModalPopup(
barrierColor: MyColors.blackColor.withOpacity(0.6),
context: context,
builder: (_) => CupertinoActionSheet(
actions: [
CupertinoActionSheetAction(
onPressed: () async {
File? image;
image = await pickImage(false,
cropStyle: cropStyle, aspectRatio: aspectRatio);
if (image != null) {
Navigator.pop(context, image);
}
},
child: CustomText.buttonText(
'Take a picture',
color: MyColors.secondaryColor,
fontWeight: FontWeight.w500,
fontSize: 20,
)),
CupertinoActionSheetAction(
onPressed: () async {
File? image;
image = await CustomFilePickerServices.pickImage(true,
prefferedCameraDevice: CameraDevice.front,
cropStyle: cropStyle,
aspectRatio: aspectRatio);
Navigator.pop(context, image);
},
child: CustomText.buttonText(
'Gallery',
color: MyColors.secondaryColor,
fontWeight: FontWeight.w500,
fontSize: 20,
)),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () => CustomNavigation.pop(context),
child: CustomText.buttonText(
'Close',
color: MyColors.blackColor,
fontWeight: FontWeight.w500,
fontSize: 20,
)),
));
}