sweetalertv2
sweetalertv2 for flutter.
showcases
getting started
add dependency
sweetalertv2: any
usage
basic usage
sweetalertv2.show(context, title: "just show a message");
with a subtitle
sweetalertv2.show(context,
title: "just show a message",
subtitle: "sweet alert is pretty");
with a success state
sweetalertv2.show(context,
title: "just show a message",
subtitle: "sweet alert is pretty",
style: sweetalertv2style.success);
with a confirm state
sweetalertv2.show(context,
title: "just show a message",
subtitle: "sweet alert is pretty",
style: sweetalertv2style.confirm,
showcancelbutton: true, onpress: (bool isconfirm) {
if (isconfirm) {
sweetalertv2.show(context,style: sweetalertv2style.success,title: "success");
// return false to keep dialog
return false;
}
});
do some job
sweetalertv2.show(context,
subtitle: "do you want to delete this message",
style: sweetalertv2style.confirm,
showcancelbutton: true, onpress: (bool isconfirm) {
if(isconfirm){
sweetalertv2.show(context,subtitle: "deleting...", style: sweetalertv2style.loading);
new future.delayed(new duration(seconds: 2),(){
sweetalertv2.show(context,subtitle: "success!", style: sweetalertv2style.success);
});
}else{
sweetalertv2.show(context,subtitle: "canceled!", style: sweetalertv2style.error);
}
// return false to keep dialog
return false;
});
special thanks
- best-flutter (initial project)
Comments are closed.