Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/best-flutter/sweetalert
sweetalert for flutter
https://github.com/best-flutter/sweetalert
alert flutter flutter-package
Last synced: about 2 months ago
JSON representation
sweetalert for flutter
- Host: GitHub
- URL: https://github.com/best-flutter/sweetalert
- Owner: best-flutter
- License: other
- Created: 2018-12-22T13:14:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T08:34:07.000Z (over 1 year ago)
- Last Synced: 2024-06-21T18:07:06.282Z (3 months ago)
- Topics: alert, flutter, flutter-package
- Language: Dart
- Size: 1.2 MB
- Stars: 56
- Watchers: 2
- Forks: 35
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# sweetalert
sweetalert for flutter.
## Showcases
![](images/preview.gif)
## Getting started
### Add dependency
```
sweetalert: any
```### Usage
#### Basic usage
![](images/1.png)```
SweetAlert.show(context, title: "Just show a message");
```#### With a subtitle
![](images/2.png)
```
SweetAlert.show(context,
title: "Just show a message",
subtitle: "Sweet alert is pretty");
```#### With a success state
![](images/3.png)
```
SweetAlert.show(context,
title: "Just show a message",
subtitle: "Sweet alert is pretty",
style: SweetAlertStyle.success);
```#### With a confirm state
![](images/4.png)
```
SweetAlert.show(context,
title: "Just show a message",
subtitle: "Sweet alert is pretty",
style: SweetAlertStyle.confirm,
showCancelButton: true, onPress: (bool isConfirm) {
if (isConfirm) {
SweetAlert.show(context,style: SweetAlertStyle.success,title: "Success");
// return false to keep dialog
return false;
}
});
```#### Do some job
```
SweetAlert.show(context,
subtitle: "Do you want to delete this message",
style: SweetAlertStyle.confirm,
showCancelButton: true, onPress: (bool isConfirm) {
if(isConfirm){
SweetAlert.show(context,subtitle: "Deleting...", style: SweetAlertStyle.loading);
new Future.delayed(new Duration(seconds: 2),(){
SweetAlert.show(context,subtitle: "Success!", style: SweetAlertStyle.success);
});
}else{
SweetAlert.show(context,subtitle: "Canceled!", style: SweetAlertStyle.error);
}
// return false to keep dialog
return false;
});
```