getImageFromCamera function
dynamic
getImageFromCamera({})
Implementation
getImageFromCamera({
required Color buttonColor,
double? imageHeight,
double? imageWidth,
int? imageQuality,
}) async {
bool cameraEnabled = await fxCanAccessCamera();
File? file;
if (cameraEnabled) {
final imagePicker = ImagePicker();
final pickedFile = await imagePicker.pickImage(
source: ImageSource.camera,
maxHeight: imageHeight,
maxWidth: imageWidth,
imageQuality: imageQuality,
);
if (pickedFile != null) {
file = File(pickedFile.path);
}
} else {
Get.dialog(
FXAlertDialog(
title: 'กรุณาตรวจสอบสิทธิ์ในการใช้งานกล้อง',
buttonColor: buttonColor,
),
);
}
return file;
}