Butterfly Alert Dialog
ButterflyAlertDialog allows you to quickly display alert dialogs such as success, error, warning, and delete.
Features
![]() |
![]() |
![]() |
![]() |
Getting started
start using the package. First, add butterfly_dialog as a dependency in your pubspec.yaml file then run flutter pub get
dependencies:
butterfly_dialog:^0.0.3
Usage
To use this Widget -> i: #Call the widget ButterflyAlertDialog.show()
These are required :
1) context
2) title
3)subtitle
4)alertType
5)onConfirm
For Warning Alert Dialog: AlertType.warning
ButterflyAlertDialog.show(
context: context,
title: 'Warning',
subtitle: 'This is the subtitle of the alert.',
alertType: AlertType.warning,
onConfirm: () {
// Your confirm action here
},
);
For Delete Alert Dialog: AlertType.delete
ButterflyAlertDialog.show(
context: context,
title: 'Delete',
subtitle: 'This is the subtitle of the alert.',
alertType: AlertType.delete,
onConfirm: () {
// Your confirm action here
},
);
For Success Alert Dialog: AlertType.success
ButterflyAlertDialog.show(
context: context,
title: 'Success',
subtitle: 'This is the subtitle of the alert.',
alertType: AlertType.success,
onConfirm: () {
// Your confirm action here
},
);
For Error Alert Dialog: AlertType.error
ButterflyAlertDialog.show(
context: context,
title: 'ERROR',
subtitle: 'This is the subtitle of the alert.',
alertType: AlertType.error,
onConfirm: () {
// Your confirm action here
},
);
},
ButterflyAlertDialog Options 📖
These are the options available in ButterflyAlertDialog
Attribute | Data type | Description | Default Value |
---|---|---|---|
context | BuildContext | @required BuildContext | N/A |
alertType | AlertType | @required - Type of alert dialog, ex: AlertType.warning for warning dialogs | NULL |
title | String | @required Set a custom title for dialog | - |
subtitle | String | @required Set a custom subtitle for dialog | - |
cancelText | String | Text of cancel button | 'cancel' |
confirmText | String | Text of ok button | 'ok' |
onConfirm | Function | @required Function that handle click of confirm button | |
confirmTextStyle | TextStyle | Confirm button text theme | TextStyle(color: Colors.black,fontWeight: FontWeight.bold,) |
cancelTextStyle | TextStyle | cancel button text theme | TextStyle(color: Colors.black,fontWeight: FontWeight.bold,) |
barrierDismissible | bool | Dismiss dialog on touch overlay | true |
backgroundColor | Color | Color of dialog background | Colors.white |
titleFontSize | double | font size of title | 20.0 |
subTitleFontSize | double | font size od subtitle | 16.0 |
Some thing went wrong 🤔
Created & Maintained By
Muhammad Rifatul Islam
Libraries
- butterfly_dialog
- A library for creating customizable alert dialogs in Flutter.