camera method
dynamic
camera()
Implementation
camera() async {
if (await AppUtils.isNetConnected()) {
final XFile? photo = await _picker.pickImage(source: ImageSource.camera);
if (photo != null) {
isImageSelected.value = true;
NavUtils.to(CropImage(
imageFile: File(photo.path),
))?.then((value) {
debugPrint("Profile Controller Got Image from Crop Image $value");
if (value != null) {
value as MemoryImage;
imageBytes = value.bytes;
var name = "${DateTime.now().millisecondsSinceEpoch}.jpg";
MessageUtils.writeImageTemp(value.bytes, name).then((value) {
if (from == Routes.login) {
debugPrint("Profile Controller from login");
imagePath(value.path);
changed(true);
} else {
debugPrint("Profile Controller not from login");
imagePath(value.path);
// changed(true);
updateProfileImage(value.path, update: false);
}
});
}
});
} else {
// User canceled the Camera
isImageSelected.value = false;
}
} else {
toToast(getTranslated("noInternetConnection"));
}
}