slovnicki / beamer

A routing package built on top of Router and Navigator's pages API, supporting arbitrary nested navigation, guards and more.
MIT License
589 stars 130 forks source link

Q: Push pages with- and without bottom navigation #595

Open jasonlessenich opened 1 year ago

jasonlessenich commented 1 year ago

Hello, I've been trying to implement beamer into my project for the last few days now, but can't get it to work for my use case. I've been looking through the bottom_navigation examples, but they either don't help me at all or do some hacky stuff which doesn't seem right (manually updating the URL in bottom_navigation_2)

What I need is some sort of Login Page (/login) (got that working with the guards example), which redirects to some sort of HomeScreen (/*), which features a bottom navigation bar. From there, I want to push pages with AND without the bottom navigation bar. (For example; /article/:articleId should feature a bottom navbar, while /settings should not)

I come from using https://github.com/jb3rndt/PersistentBottomNavBarV2, which made that behavior really really easy, but I can't think of a fitting solution using beamer

karvulf commented 1 year ago

You could beam inside your BottomNavigationBar just by calling context.beamToNamed(... or when you want to beam to pages outside your BottomNavigationBar, you could use Beamer.of(context, root: true).beamToNamed(.... @DynxstyGIT

slovnicki commented 1 year ago

Hey @DynxstyGIT :wave: Thanks for creating an issue and sorry for my absence lately.

@karvulf is right; whether we want to push pages above navigation bar or nested depends only on which Navigator are we using to show the page. If we're using the same Navigator that contains the page with navigation bar, it will be on top of it. If we use the nested Navigator that is above the navigation bar, the page will be there. (Beamer ~= Router ~= Navigator)

Now to only thing left is to carefully organize routes, or just use Beamer.of(context, root: true/false).navigator.push(...) if you don't care about the route for that page specifically and just want to do a regular push.