onTakePictureButtonPressed method
void
onTakePictureButtonPressed()
Implementation
void onTakePictureButtonPressed() {
isTake = true;
takePicture().then((XFile? file) {
if (mounted) {
setState(() {
imageFile = file;
HapticFeedback.mediumImpact();
List<ImageModulModel> imageSelected = [];
Future.delayed(Duration(microseconds: 300)).then((value) async {
File file = File(imageFile!.path);
// var pathTarget = await getTemporaryDirectory();
isTake = false;
setState(() {});
imageSelected.add(ImageModulModel(isSelected: true, file: file));
gotPreview(imageSelected);
// await FlutterImageCompress.compressAndGetFile(
// file!.path, pathTarget.path,
// format: CompressFormat.jpeg,
// quality: Config.compresValue ?? 75)
// .then((valueCompress) {
// File file = File(valueCompress!.path);
// isTake = false;
// setState(() {});
// imageSelected.add(ImageModulModel(isSelected: true, file: file));
// gotPreview(imageSelected);
// });
});
});
if (file != null) {
// showInSnackBar('Picture saved to ${file.path}');
}
}
});
}