Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dismiss dialog when user press button inside it #37

Closed
brizaldi opened this issue Apr 26, 2020 · 6 comments
Closed

dismiss dialog when user press button inside it #37

brizaldi opened this issue Apr 26, 2020 · 6 comments

Comments

@brizaldi
Copy link

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 ?

@AndroidHensen
Copy link
Contributor

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

@dhalloop7
Copy link

I tried the same but not working.

@AndroidHensen
Copy link
Contributor

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

@brizaldi
Copy link
Author

@dhalloop7 instead of using dismiss, try this:

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

dont forget to pass context from the your root widget

@dhalloop7
Copy link

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

@AndroidHensen
Copy link
Contributor

try v1.0.20 'useRootNavigator' property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants