pickImageFromCamera method
Future<File?>
pickImageFromCamera({
- required BuildContext context,
- required dynamic onCropImage(
- File croppedImage
- SeniorImageCropperStyle? style,
- int? maxSizeMb,
- VoidCallback? onPermissionCameraDenied,
- dynamic onException(
- Object e
Implementation
Future<File?> pickImageFromCamera({
required BuildContext context,
required Function(File croppedImage) onCropImage,
SeniorImageCropperStyle? style,
int? maxSizeMb,
VoidCallback? onPermissionCameraDenied,
Function(Object e)? onException,
}) async {
try {
final pickedFile = await _picker.pickImage(
source: ImageSource.camera,
imageQuality: 50,
);
if (pickedFile != null) {
return await _cropImage(
imgFile: File(pickedFile.path),
context: context,
onCropImage: onCropImage,
style: style,
maxSizeMb: maxSizeMb,
);
}
} on PlatformException catch (e) {
if (e.code == 'camera_access_denied') {
onPermissionCameraDenied?.call();
}
} catch (e) {
onException?.call(e);
}
return null;
}