13-Aug-2022
.
Admin
Hello Friends,
This post will give you an example of how to implement a custom dialog box in a flutter. you can see creating dialog in a flutter. this example will help you flutter alert dialog example. This post will give you a simple example of the alert dialog box in a flutter. So, let's follow a few steps to create an example of how do you use simple dialog flutters.
A dialog is a type of modal window that appears in front of app content to provide critical information or ask for a decision. Dialogs disable all app functionality when they appear, and remain on screen until confirmed, dismissed, or a required action has been taken.
So, let's see the below solution with an output:
Step 1: Create Flutter Project
Follow along with the setup, you will be creating a Flutter app.
- $flutter create flutter_dialog_example
Navigate to the project directory:
- $cd flutter_dialog_example
Step 2: Main File
Create a main.dart file in the lib directory
void main() {
runApp(TabBarIconDemo());
}
class TabBarIconDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: AlertDialog(
title: Text('Welcome'),
ontent: Text('Nice Snippets'),
actions: [
FlatButton(
work like a button
textColor: Colors.black,
onPressed: () {},
button
child: Text('CANCEL'),
),
FlatButton(
textColor: Colors.black,
onPressed: () {},
child: Text('ACCEPT'),
),
],
),
);
}
}
Step 3: Run this Debug App
Output:
#Flutter