sososdk / flash

⚡️A highly customizable, powerful and easy-to-use alerting library for Flutter.

Home Page:https://sososdk.github.io/flash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QUESTION: is it possible to push a route or dialog in such a way that the Flash is covered behind the new route ?

gbaccetta opened this issue · comments

Hello! Thanks for the hard work. is this possible ?

Flash base on Overlay and cannot use route.

Yup got it, but even if I do (using same context and navigator):

  • showFlash
  • showGeneralDialog

I would expect the generalDialog to be on top of the Flash, but it remains under it.

Wrap you page with Overlay and set persistent to false.

showFlash(persistent: false)

Usually I use auto_route to automatically wrap all pages with Overlay.

Well I actually achieved what I wanted by using showFlash also for my Route (which act as sort of guard).

However this was intercepting back button press before, using flash, the back button event is passed to the route behind it... is there a way to intercept and block back button in a Flash ?

maybe not the best, but I found a solution, as of all my view inherited from a base view I just wrapped that in a willPopScope looking at a static variable that check if my top guard view is visible as a Flash

showFlash method has onWillPop parameter, you can try it.

showFlash(onWillPop: ...)