For questions relating to Flutter's AlertDialog class. Use this tag in combination with the general [flutter] tag. If your question applies to Flutter more generally, use the [flutter] tag only.
Questions tagged [flutter-alertdialog]
157 questions
187
votes
17 answers
How to make an AlertDialog in Flutter?
I am learning to build apps in Flutter. Now I have come to alert dialogs. I have done them before in Android and iOS, but how do I make an alert in Flutter?
Here are some related SO questions:
How to style AlertDialog Actions in Flutter
adding…

Suragch
- 484,302
- 314
- 1,365
- 1,393
173
votes
11 answers
How to refresh an AlertDialog in Flutter?
Currently, I have an AlertDialog with an IconButton. The user can click on the IconButton, I have two colors for each click. The problem is that I need to close the AlertDialog and reopen to see the state change of the color icon. I want to change…

Nitneuq
- 3,866
- 13
- 41
- 64
149
votes
18 answers
How to dismiss an AlertDialog on a FlatButton click?
I have the following AlertDialog.
showDialog(
context: context,
child: new AlertDialog(
title: const Text("Location disabled"),
content: const Text(
"""
Location is disabled on…

Gustash
- 1,523
- 2
- 8
- 5
17
votes
1 answer
Is it possible to pass class as a parameter in a function in Flutter?
Here, I have a utility class in which I have a function for showing DialogBox, so I'm trying to make an AlertDialog Box which can be used anywhere in the whole project.
So, I have to pass Title, description as an argument and also want to pass Class…

guruprakash gupta
- 877
- 4
- 9
- 15
10
votes
3 answers
How to get context in the any function of StatelessWidget?
We want to show an AlertDialog after some asynchronous processing such as network processes.
When calling 'showAlertDialog ()' from an external class, I want to call it without context. Is there a good way?
class SplashPage extends StatelessWidget…

kyeonghwan
- 424
- 3
- 7
- 21
10
votes
3 answers
How to get AlertDialog Callback from method in Flutter?
I have AlertDialog in static method, in that I wants to get callback when user clicks on OK button.
I tried using typedef but can't understand.
Below is My Code:
class DialogUtils{
static void displayDialogOKCallBack(BuildContext context, String…

Sagar Zala
- 4,854
- 9
- 34
- 62
5
votes
1 answer
Disable AlertDialog button on value change of TextFormField Flutter
In My First Flutter Project, I am trying to get value from TextFormField inside a Alert Dialog. I am trying to validate inputs and based on that validation I want to enable/disable button of AlertDialog.
What I have done to display dialog:
…

Kalp Shah
- 279
- 2
- 14
4
votes
1 answer
Flutter Test Cannot Find AlertDialog Widget
I am currently writing a test to enter user information with miss-matching passwords to see if our AlertDialog widget shows up with the text: "Passwords do not match!"
Here is where my alert dialog is:
if (passwordController.text !=…

David DeVore
- 43
- 3
4
votes
5 answers
How to close specific Dialog
I am opening a dialog from another dialog and trying to close the 1st dialog, but it is closing the recent dialog. Similar kind of git issue.
I've tried
putting ValueKey on AlertDialog
using rootNavigator:true while pop
keeping context into…

Md. Yeasin Sheikh
- 54,221
- 7
- 29
- 56
4
votes
2 answers
No MaterialLocalizations found
I am trying to show alert dialog on click of BottomNavigationBarItem button,
inside CupertinoTabBar but it says No MaterialLocalizations found.
Debug Console
The ancestors of this widget were:
CupertinoApp
state: _CupertinoAppState#730fe
MyApp
…

Neeleshwar Kumar
- 335
- 3
- 13
4
votes
1 answer
Define action when AlertDialog is dismissed by clicking outside
I'm making a simple TODO app in Flutter. Next to each item I have an "Edit" icon which opens an AlertDialog with pre-filled description and amount of that item. When I click outside of the dialog, it is dismissed, as expected. For this form I use…

vtomic85
- 590
- 1
- 11
- 32
4
votes
1 answer
Flutter Driver - Does not locate Flutter AlertDialog and its elements
I have a Flutter AlertDiaog that comes up on my flutter app.
Using Flutter Driver, I am unable to tap on either the Flutter AlertDialog or on any element on the AlertDialog.
Is there a way to tap on any AlertDialog that comes up on my app?
I have…

Manmeet Chadha
- 211
- 1
- 6
4
votes
1 answer
Flutter - custom alert dialog not showing
I am building a custom alert dialog using flutter/Dart and a Custom Show Dialog class that I got from Github and for a reason or another the dialog is not showing.
Q: How to get the dialog to show properly?
PS resultsDialog(a,b) is being called on a…

Thorvald
- 3,424
- 6
- 40
- 66
3
votes
1 answer
How to make Alert Dialog shaking animation in Flutter
I want to shake the alert dialog like this: (not only the text, but also the entire pop up dialog)
https://www.youtube.com/watch?v=IaHMoifUBSw
How can I shake the whole alert dialog when user clicks a button?

gurkan stack
- 413
- 1
- 15
- 43
3
votes
1 answer
How to avoid bottom overflow when keyboard open (in alert dialog)
In this screen i'm facing overflow every time I open keyboard in the alert text field. I already tried to put SingleChildScrollVIew in all the places and it didn't resolve. This is the component which have the alertdialog:
Future…
user14789593