Closed adminant closed 1 year ago
@adminant Hi
Flushbar is a Future, in my case I used Navigator.pop(context), it caused errors. I recommend you to do an await
This is actually a serious issue. A toast like notification should never rely on or affect the router stack. Since there's no way around it, I actually decided to remove Flushbar altogether.
@cmkramer And what is your alternative?!
As for me, I ended up not using Flushbar at all and use my own overlay-based widget, and that required some work to do. It's a pity such a useful plugin like Flushbar has such a confusing bug
This is actually a serious issue. A toast like notification should never rely on or affect the router stack. Since there's no way around it, I actually decided to remove Flushbar altogether.
@cmkramer is there any alternative that you used?
I think the issue is that this package is a continuation of a the discontinued flushbar package so it uses a somehow similar API. Though I agree that it's worth exploring different approaches
as far as i know Navigator.pop() is a future. if flushbar is being dismissed by it, you can make your own checks so that its not dismissed.
Also its best to understand what Navigator.pop() does beyond the basic understanding .
this library cant support every developers custom needs. if you feel like this is a bug in the library implementation please add your code snippet so others can review and advise
as far as i know Navigator.pop() is a future. if flushbar is being dismissed by it, you can make your own checks so that its not dismissed.
Could you explain, how this check could be made? And where it should be located?
As per request above @AliEasy and @silverhairs . I switched to overlay_support. This package creates a global overlay that can easily be styled just like Flushbar. It actually provides an easy way to implement other styles of modal user feedback as well. I've been using it since I placed my previous comment and I'm quite happy with the switch.
you can show flushbar after a navigation action:
SchedulerBinding.instance.addPostFrameCallback((_) {
Flushbar(
flushbarStyle: FlushbarStyle.GROUNDED,
flushbarPosition: FlushbarPosition.TOP,
messageColor: Theme.of(context).colorScheme.onPrimary,
backgroundColor: Theme.of(context).colorScheme.primary,
duration: const Duration(seconds: 3),
message: i18n.loginSuccessful(userFullName))
.show(context);
});
I use flushbar in my appbar, so it appears throughout all my app and works as expected except one thing - when somewhere in my app I use modal windows which are dismissed by Navigator.pop() the flushbar disappears first instead of that modal window. How can I have flushbar to be always on screen and not disappear with Navigator.pop() calls?