YYFlutter/flutter-custom-dialog

dismiss dialog when user press button inside it

brizaldi opened this issue · 6 comments

so i have this dialog with 2 button inside : CANCEL and DISCARD

Annotation 2020-04-26 142102

my question is, how can i dismiss the dialog when user press one of those button? should i use Navigator.pop ?

var yyDialog = YYDialog();
yyDialog?.dismiss();

I tried the same but not working.

  1. make sure your context is scaffold.
  2. you can clone my code,run my project,i have a example.

@dhalloop7 instead of using dismiss, try this:

Navigator.of(context, rootNavigator: true).pop();

dont forget to pass context from the your root widget

I tried all above solutions but still it's not dismiss the dialog. Even I am getting callback as well but it's not dismissing the dialog and If I try to dismiss dialog inside callback sometime it's close the current page

try v1.0.20 'useRootNavigator' property