Closed murad-alm closed 2 years ago
Trying the following code, but the return statements are not being executed for some reason.
onDissmissCallback: (dismissType) {
Navigator.of(context).pop();
log(dismissType.toString());
if (dismissType == DismissType.BTN_OK) {
return true;
} else if (dismissType == DismissType.BTN_CANCEL) {
return false;
} else {
return null;
}
},
I got it now. As I said in the previous comment, the return statements didn't get executed for some reason, so I figured out this:
Future<bool?> _askForImageSource(BuildContext context) async {
bool? source = null;
await AwesomeDialog(
context: context,
dialogType: DialogType.QUESTION,
animType: AnimType.SCALE,
title: 'Some Title'
btnCancelText: 'Camera',
btnOkText: 'Gallery',
desc: 'Some Description',
btnCancelOnPress: () {},
btnOkOnPress: () {},
autoDismiss: false,
onDissmissCallback: (dismissType) {
Navigator.of(context).pop();
if (dismissType == DismissType.BTN_OK) {
source = true;
} else if (dismissType == DismissType.BTN_CANCEL) {
source = false;
}
}).show();
return source;
}
Hi there, thanks for the awesome package!
I am trying to return a bool? from the AwesomeDialog. The function is supposed to return true on OK press or false on CANCEL. When the Dialog is dismissed (via back press or a click outside), null should be returned.
I tried doing it this way but unfortunately, it didn't work..
Thanks again! edit: code