admin管理员组文章数量:1241086
I'm looking for a solution which contains exactly what you see described in this article, but with the additional feature of displaying a bottom navigation bar that is specific to the current app state (e.g. display distinct bottom navigation icons pointing to according target screens if the app user is signed in or not, like it is suggested here). As suggested in that link, you would most likely generate the bottom navigation bar icons used by the app dynamically; that's clear and understandable. But my question here is; how you would provide the app-state specific StatefullShellBranch
es for your StatefullShellRoute
?
I first thought about using a single GoRouter
config with a single StatefulShellRoute
, with all of your app's base navigation screens added as the according StatefulShellBranch
es (both the branches shown in the app when the user is signed in and the branches shown when the user is signed out).
Pros:
- Makes it easy to redirect in between private and public app screens based on auth state; which is essential regarding peepz arriving on a specific screen through deep link.
Cons:
- Private app screens requiring authentication are present in the same route configuration as when the app user is signed out. Which feels odd, as network requests related to the private screens should not be executed while the app user is not authenticated, and vice-versa.
I then thought about another possible way: Provide two distinct dynamic go router configurations, and toggle the active configuration when the authentication state changes. But this basically swaps the above-mentioned Pro & Con, hence the solution still does not seem feasible.
I couldn't find anything else online after a significant amount of time; how could you implement this?
本文标签:
版权声明:本文标题:flutter - Provide app-state specific Bottom Navigation Bar with Stateful Nested Routes using GoRouter - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740063422a2222715.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论