Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Example] Botton navigation with Riverpod #601

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

vduseev
Copy link
Contributor

@vduseev vduseev commented Mar 14, 2023

New example that implements bottom navigation using Riverpod.

Main things that this example demonstrates:

  • Persistent navigation state in nested routes and for the entire app using Riverpod and Shared Preferences. The navigation state persists between app launches and sign ins / sign outs.
  • Global login guard that relies on a Riverpod based provider.

I was desperately looking for an example like this to implement in my app but failed to find one.

@vduseev vduseev changed the title Botton navigation with Riverpod [Example] Botton navigation with Riverpod Mar 14, 2023
@slovnicki slovnicki self-assigned this Mar 18, 2023
@slovnicki slovnicki self-requested a review March 18, 2023 17:33
@slovnicki
Copy link
Owner

Hey @vduseev! 👋
Thanks for the PR and support 🙂

This example looks great at a first glance.
I'll take a closer look during the next few days and review it so we can merge.

@vduseev
Copy link
Contributor Author

vduseev commented Mar 19, 2023

Hi @slovnicki, glad too hear that! Let me know if you think there is a room for improvement. I was mostly concerned about the need to use a constructor in a state object to pass initialization parameters to the nested router delegates.

Copy link
Owner

@slovnicki slovnicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vduseev, Thanks again for this amazingly documented example.
Everything works as described 👌

I thought we could separate the code into more files for readability, but then again - we don't do that in other similar examples, so let's just stay structurally unbiased on this one too.

I don't see a problem in constructor usage you mentioned, but maybe we figure something more convenient in the future. Your idea of storing initial paths sounds really useful and I'm interested in adding some optional storage strategies into Beamer itself. If defined on the root Beamer, then its children could read/write from there even implicitly.

Are you interested in helping me out on that feature?

@slovnicki slovnicki merged commit 4ee658e into slovnicki:master Mar 23, 2023
@vduseev
Copy link
Contributor Author

vduseev commented Mar 24, 2023

@slovnicki, Thank you very much for accepting the PR.

The use of constructors in a State object is something I've considered to be a bad practice, simply based on a general sentiment across the flutter industry. Which is why I've tried to avoid doing that, but, unfortunately, couldn't find a way around.

I'd be really happy to assist in implementation of the idea of storing persistent locations using Beamer. If you could, maybe, lay down your creative approach to this vision in a separate issue, so that all contributors could understand the concept better, that would be awesome.
With Beamer being the best feature-rich navigation package at the moment, we'd have to be able to code an agnostic implementation of such capability. Which means no riverpod or provider ties. Probably a pure InheritedWidget based solution or something similar in spirit? I'd be glad to follow your direction in this regard.

@slovnicki
Copy link
Owner

slovnicki commented Mar 28, 2023

@vduseev Thanks for the kind words and interest in contributing.

I plan to publish a somewhat lengthy roadmap to Beamer v2 where I'll describe a couple of new big features in separate issues and various improvements I have in mind.

Something always gets in my way so this roadmap has been postponed for some time now, but I feel confident to publish it by the end of this week. (edit: it will be done by 7.4. and officially announced on 10.4.)

I'll let you know when it's out 🙂

@dleurs
Copy link

dleurs commented Apr 5, 2023

Thank you @vduseev for your example, I was really looking for this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants