Alert popup is a efficient tools to showing some alert or confirmation about some thing to app user.Actualy Its look like a some portion aligned in the middle of the screen an overly over the background. Suppose if we want to close the application alert dialog is the best choice for show closing confirmation. @awesome_dialog is a one type of flutter library and its opensource which is used to create awesome dialogs widgets without doing any additional code.
We can also customize the look and feel of the alert using some property . If you don’t need alert title ,just set body property so the title and description section from the alert will be removed .
Installation
add awesome_dialog as a dependency in your pubspec.yaml file. And add this import to your file.
import ‘package:awesome_dialog/awesome_dialog.dart’;
Example
AwesomeDialog(
context: context,
dialogType: DialogType.INFO,
animType: AnimType.BOTTOMSLIDE,
title: 'Sample heading here',
desc: 'Welcome description',
btnCancelOnPress: () {},
btnOkOnPress: () {},
)..show();
Custom Implementation
If the body is specified, then title and description will be ignored, this allows to further customize the dialogue.
AwesomeDialog(
context: context,
animType: AnimType.SCALE,
dialogType: DialogType.INFO,
body: Center(child: Text(
'Sample Body part',
style: TextStyle(fontStyle: FontStyle.italic),
),),
title: 'Not taken',
desc: 'Ignored property',
btnOkOnPress: () {},
)..show();
Custom Button
To use custom buttons, just specify the buttonOk or btnCancel widget, all text parameters icon etc will be ignored.
Callback
AwesomeDialog has onDissmissCallback() and can be dissmissed at any time using dissmiss() public method.
Demo
