When you click on the button to show awesome dialog, transparency appears over the application screen, but awesome dialog does not appear
void askDoAgain() {
AwesomeDialog(
context: context,
headerAnimationLoop: false,
dialogType: DialogType.question,
animType: AnimType.topSlide,
title: trans(context, 'make_another_transaction'),
desc: trans(context, 'start_new_transaction'),
btnCancelText: trans(context, 'cancel'),
btnOkText: trans(context, 'ok'),
btnCancelOnPress: () {
// Navigator.pop(context);
},
btnCancelColor: Colors.grey[600],
btnOkColor: colors.primaryColor,
btnOkOnPress: () async {
customerName.clear();
customerPhone.clear();
customerLocation.clear();
_btnController.reset();
},
).show();
}
function: () {
askDoAgain();
}
2
Answers
i think using the wrong context which show the AwesomeDialog.Make sure you have access to the correct context within the scope of the function askDoAgain().i modified your code just check it
The following code seems to work for me, I had to comment some of your code because I was missing the functions/classes:
What I think what was going wrong is that you were not providing the right context. Whenever you want to display a Dialog you need to make sure that the provided context is from a
Material
widget. In the case of this example, I am providing the context from theScaffold
widget which is aMaterial
widget.