PlugFox / octopus

A cross-platform declarative router for Flutter with a focus on state and nested navigation. Made with ❤️ by PlugFox.
https://octopus.plugfox.dev
MIT License
66 stars 1 forks source link

Support bottom navigation bar navigation #8

Open itsJoKr opened 5 months ago

itsJoKr commented 5 months ago

Hey, I really like where this package is going, and this solves my biggest pain point when working with other routers. I would like to give few of my opinions here, you can dismiss them, but they might be helpful.


When talking about bottom navigation bar navigation we identify two cases:

  1. with preserving state of each page
  2. without preserving state of each page

The 1) is more often found in iOS, the 2) is more often found in Android, but there is no rule and user decides in the end what they want.

You've implemented 1) in example with use of an additional query parameter which then persists in navigation.

For 2) I also think it's more natural to have path parameters.

To sum up

If you want to implement something like what I've proposed or potentially many other changes, I think limitation currently is that you return widget based on the route, so you have no additional control of it.

        Routes.signin => const SignInScreen(),

I think long-term it will have to be more closer to how GoRouter, Beamer and other works. Something similar to:

    Routes.signin => OctopusRoute(
        SignInScreen()
    ),
    Routes.statelessHome => StatlessShellRoute(
        StatelessHomeScreen()
    ),
    Routes.statefulHome => StatefulShellRoute(
        StatefulHomeScreen(),
        potentiallyOtherFields: true,
    ),
  };

I know that would make this look more like GoRouter, Beamer (and others), but they have a good reason why they went this way. You need something like that to cover all the cases. But none of them (as far as I know) can solve infinite-routing, and the repeating screens in different URL locations.

daddowzoubair commented 1 month ago

+1