cmdrootaccess / another-flushbar

A flexible widget for user notification. Customize your text, button, duration, animations and much more. For Android devs, it is made to replace Snackbars and Toasts.
https://pub.dev/packages/another_flushbar
MIT License
145 stars 89 forks source link

Navigator.pop does not work #52

Open petrnymsa opened 2 years ago

petrnymsa commented 2 years ago

Common usage of classic snackbar is display snackbar and pop current page.

However when using Flushbar like this

ElevatedButton(
    child: Text('Show Flushbar and pop!'),
    onPressed: () {
      Flushbar(
        message: 'Pop!',
        onStatusChanged: print,
        duration: Duration(seconds: 4),
      )..show(context);
      Navigator.of(context).pop();
    },
  ),
 )

Nothing happens. No flushbar is displayed nor current page is popped.

When I try to listen for Flushbar's status changes, the states are

I/flutter (18959): FlushbarStatus.IS_APPEARING
I/flutter (18959): FlushbarStatus.DISMISSED

However when I remove Navigator.of(context).pop() line. The printed status is:

I/flutter (18959): FlushbarStatus.IS_APPEARING
I/flutter (18959): FlushbarStatus.SHOWING
I/flutter (18959): FlushbarStatus.IS_HIDING
I/flutter (18959): FlushbarStatus.DISMISSED

I think this should be considered as a bug. With normal Flutter's snackbar this is not issue.

anamba commented 2 years ago

This confused me for quite a while until I finally realized what was happening.

I tried reversing the order of the statements (pop, then show flushbar), which seemed like it shouldn't work, but it did.

mkbsugita commented 1 year ago

I also want Navigator.pop ignore option...

adminant commented 1 year ago

Is it possible for flushbar not react on Navigator.pop?

waqadArshad commented 1 year ago

Is it possible for flushbar not react on Navigator.pop?

@cmdrootaccess @mkbsugita @robinbonnes

is there any way to achieve this?

Linaks commented 1 year ago

I'd be glad if this worked somehow

akucherk commented 11 months ago

It is impossible to use independent of navigation messages: on call pop it closes flushbar instead of pop the current page