Skip to content

AutoCloseDuration causing multiple renders of popup. #45

@Vargas-E

Description

@Vargas-E
CoolAlert.show(
              context: somekey.currentContext!,
              type: CoolAlertType.error,
              title: e.response?.statusCode != 200 ? "Server error" : "Device Error",
              text: "error text",
              autoCloseDuration: const Duration(seconds: 5),
              backgroundColor: Colors.red,
              barrierDismissible: true,
              width: 400,
              confirmBtnColor: Colors.red,
            );```

I was using coolAlert just like this and i noticed that when this triggers, the alert pops up several times (from 10 to 30 times).  I initially thought that this was happening because with each rerender of the currentContext widget the alert triggered again. 

I compared the implementation changing the coolAlert for a simple Showdialog with an AlertDialog and it worked properly. That got me thinking about how the coolAlert.show is a future and that would be the main difference with an AlertDialog. I commented the autoCloseDuration and it worked fine, just showing it once.

Currently i'm using it without the autoCloseDuration, but it would be nice if this could be checked.

Apologies in advance for any english grammar mistake, english is not my native language.

 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions