payam-zahedi / toastification

Toastification is a Flutter package for displaying customizable toast messages. It provides predefined widgets for success, error, warning, and info messages, as well as a custom widget for flexibility. With Toastification, you can add and manage multiple toast messages at the same time with ease.
https://payamzahedi.com/toastification/
BSD 3-Clause "New" or "Revised" License
539 stars 40 forks source link

DismisAll doesn't work if multiple toasts called at the same time #119

Open amxDusT opened 1 month ago

amxDusT commented 1 month ago

Describe the bug I'm trying to show only one toast at a time in my application by dismissing all before showing new toasts, but whenever 2 or more toasts get called at around the same time, they all show instead of dismissing.

To Reproduce

toastification
    ..dismissAll(delayForAnimation: false)
    ..show(
      title: const Text('test 1'),
    )
    ..dismissAll(delayForAnimation: false)
    ..show(
      title: const Text('test 2'),
    );

Expected behavior The first toast ('test 1') should be dismissed

Flutter information:

payam-zahedi commented 4 weeks ago

Hey @amxDusT

Thanks for opening this issue

what exactly you want to achive here?

To only show one notification?

amxDusT commented 3 weeks ago

Exactly. The problem seems to be in the toastification_manager: it has a delay in showing the toast, apparently waiting for the overlay. Though when dismiss/dismissAll is called these delays don't get removed. The following pull is an attempt to fix that #123

payam-zahedi commented 3 weeks ago

Alright, I got your point

but I'm not sure the best way to solve it is to keep some toast as idle and keep them in a separate list

let me investigate on this and will let you know what's my plan.