flushbar icon indicating copy to clipboard operation
flushbar copied to clipboard

Routing issues with IOS back swipe and Android back button

Open AndreHaueisen opened this issue 5 years ago • 10 comments

I'm aware of iOS back swipe issue. This issue was fixed here but a recent change on the Flutter platform broke it again. Adding to that, some users don't like the fact that Android back button dismisses Flushbar.

For those reasons I will be working on a different rounting solution to the package. @huzhiren sugested overlays and after some research, it looks like a possible solution.

Any help or feedback are welcome.

AndreHaueisen avatar Jun 01 '19 00:06 AndreHaueisen

@AndreHaueisen hi. Thank you for a good library.

Did you think about implementation like ModalRoute with WillPopScope widget?

https://github.com/flutter/flutter/blob/20e59316b8/packages/flutter/lib/src/widgets/routes.dart#L1079

https://api.flutter.dev/flutter/widgets/WillPopScope-class.html

Creates a widget that registers a callback to veto attempts by the user to dismiss the enclosing ModalRoute.

I think this can resolve the problem with isDismissible = false and hardware button on android.

KonstantinKai avatar Aug 30 '19 06:08 KonstantinKai

@AndreHaueisen I found a more easy way to prevent dismissing route -> https://github.com/KonstantinKai/flushbar/commit/db79b9b1e3b00c26ef7148d4b7b98dc24187cda2#diff-fb0fd4872b6a2ba64ebf8244f3ed33c9

Also can provide aka onFlushbarWillPop callback for more flexible setup...

What do you think about this?

KonstantinKai avatar Aug 30 '19 07:08 KonstantinKai

Any updates on this functionality? I'm mainly referring to a Navigation pop removing the FlushBar instead of the actual Route, this is such a problem with my app. Is there a quicker fix you could do to by-pass the navigator popping the FlushBar?

Lidgett avatar Dec 04 '19 15:12 Lidgett

Still an issue. Navigator.pop. I should have taken more time looking into Flushbar before littering it everywhere in a 40+ screen application.

cyberpwnn avatar Feb 14 '20 17:02 cyberpwnn

Yeah I bailed on this library in the end, I'd advise the same, especially if you have a large application. It's such a simple thing but it completely messes up applications where you need to control the UI (which is actually any app really). My advice, create an overlay instead and drop a custom widget (I designed mine to look exactly the same as Flushbar, because in all fairness it looks really good, much better than toasts...) over the top of it.
Flutter is made for such tasks too. Just some simple widget that animates down from the top (or up from the bottom).
If you really want to do this quickly, there is a package called overlay_support https://pub.dev/packages/overlay_support which even has a notification method for exactly this! And because it is NOT a route, a back press or navigator pop will completely ignore it....result!!!

Lidgett avatar Feb 14 '20 17:02 Lidgett

thanks @Lidgett 🙏

akshaybhange avatar May 15 '20 16:05 akshaybhange

@AndreHaueisen So what's up with this issue? Is the package going to continue using routes or switch to overlays? This behavior is still broken when the users are swiping/tapping back while a Flushbar is shown.

benPesso avatar Oct 01 '20 11:10 benPesso

Same issue

Edit: Fixed with _flushbar?.dismiss(); before Navigator.pop

sayhicoelho avatar Nov 15 '20 18:11 sayhicoelho

Same issue

Edit: Fixed with _flushbar?.dismiss(); before Navigator.pop

@sayhicoelho That only works if you control the popping itself. If you're using a "standard" app bar, for example, you don't have control over the call to Navigator.pop. It will also not work on iOS, where users can pop the route by swiping from the left edge of the screen (without adding a lot of overhead code just to "support" this).

benPesso avatar Nov 15 '20 19:11 benPesso

Same issue Edit: Fixed with _flushbar?.dismiss(); before Navigator.pop

@sayhicoelho That only works if you control the popping itself. If you're using a "standard" app bar, for example, you don't have control over the call to Navigator.pop. It will also not work on iOS, where users can pop the route by swiping from the left edge of the screen (without adding a lot of overhead code just to "support" this).

@benPesso Thank you for pointing me out.

sayhicoelho avatar Nov 16 '20 00:11 sayhicoelho