Home > Mobile >  How to dismiss custom dialog
How to dismiss custom dialog

Time:03-20

i'm using the cool_alert library to show custom alerts to my app. But i can't find any way to dismiss a custom alert.

I'm showing the alert with this code below:

CoolAlert.show(
    context: context,
    type: CoolAlertType.success,
    title: 'Profile updated',
    text: "Your profile informations has been updated successfully!",
    loopAnimation: false,
);

CodePudding user response:

Use this

Navigator.pop(context);

CodePudding user response:

You need to call showCancelBtn:true. Default it is false. Also, you can use onCancelBtnTap

await CoolAlert.show(
  .....
  cancelBtnText: "Cancel",
  showCancelBtn: true,
  onCancelBtnTap: () {
    Navigator.of(context).pop();
     }
);
  • Related