How To Dismiss Dialog in Flutter - Flutter Agency
How To Dismiss Dialog in Flutter - Flutter Agency
< https://flutteragency.com/>
When a user needs to perform some operation on data from the mobile application.
Users need to get permission that may ask the user to confirm the action. So once the
Enquiry
user is displayed a DialogBox it needs to dismiss after getting confirmation. So in this
article, we will go through How to Dismiss Dialog In Flutter?
The dialog route created by this method is pushed to the root navigator.
Enquiry
BuildContext dialogContext;
showDialog(
context: context,
barrierDismissible: false,
dialogContext = context;
return Dialog(
mainAxisSize: MainAxisSize.min,
children: [
new CircularProgressIndicator(),
new Text("Loading"),
],
),
);
},
);
await _longOperation();
Navigator.pop(dialogContext);
If you don’t want to return any result after showDialog is closed, you can use it.
Navigator.pop(context);
Enquiry
showDialog(
context: context,
builder: (_) {
return AlertDialog(
actions: [
FlatButton(
child: Text('No'),
),
FlatButton(
child: Text('Yes'),
),
],
);
}).then((exit) {
if (exit) {
} else {
});
Conclusion:
In this article, We have been through How to Dismiss Dialog In Flutter?
Keep Learning !!! Keep Fluttering !!!
Share this:
< https://flutteragency.com/how-to-dismiss-dialog-in-flutter/?share=twitter&nb=1>
< https://flutteragency.com/how-to-dismiss-dialog-in-flutter/?share=facebook&nb=1>
< https://flutteragency.com/how-to-dismiss-dialog-in-flutter/?share=linkedin&nb=1>
Enquiry
< https://flutteragency.com/how-to-dismiss-dialog-in-flutter/?share=reddit&nb=1>
< https://flutteragency.com/how-to-dismiss-dialog-in-flutter/?share=tumblr&nb=1>
< https://flutteragency.com/how-to-dismiss-dialog-in-flutter/?share=jetpack-whatsapp&nb=1>
Popular Posts
For VSCode ?
In Flutter ?
License Status Unknown
< https://flutteragency.com/setup-emulator-for-vscode/> In Flutter?
< https://flutteragency.com/how-to-format-datetime-in-flutter/>
November 24, 2020 · 5 min read January 14, 2021 · 3 min read
< https://flutteragency.com/fix-android-license-sta
October 23, 2020 · 6 min read
< https://flutteragency.com/how-to-call-method-in-one-stateful-widget-from-another-statef
December 16, 2020 · 5 min read
Copyright ©
2021 All right reserved to
Flutter Agency < https://flutteragency.com/> < < <
https://www.facebook.com
https://twitter.com/A
https://www.lin
agency/>
Enquiry