Closed HeropolisDa2ny closed 2 months ago
I'm not sure if I understand you correctly, but I think that you want that the user confirm before closing the editor. If this is the case, the confirmation should be implemented inside the onCloseEditor
function, not in onImageEditingComplete
. The onImageEditingComplete
function is responsible for displaying the loading-dialog, which allows users to see the same loading-dialog when uploading an image to the server. Below is an example of the correct implementation:
Uint8List? _newImage;
Future<void> _onImageEditionCompleted(
Uint8List bytes,
) async {
_newImage = bytes;
}
void _onCloseEditor() {
final shouldClose = await MyDialog();
if (shouldClose) {
Navigator.pop(context, _newImage);
}
}
The problem with your method onCloseEditor is that you cannot differentiate if either I'm exiting my editor from my onImageEditionCompleted or my cancelButton, except if I'am doing a variable instantiation on onImageEditionCompleted but it's fine I've just removed my dialog, it is more fluid now.
Package Version
5.0.2
Flutter Version
3.24.0
Platforms
Android, iOS, Web
How to reproduce?
Edit an image with Image Editor - await for a dialog response on onImageEditingComplete that will make you either stay on the editor or leave.
The error starts acting since the new versions > 4.3.3
Logs (optional)
No response
Example code (optional)
Device Model (optional)
No response