How to make the structure of a dashboard (web) with go_router? #141
Replies: 6 comments 2 replies
-
Is it impossible to do this kind of structure with go_router? |
Beta Was this translation helpful? Give feedback.
-
To build this with go_router, I'd start by looking at the nested navigation docs and the navigator builder docs. |
Beta Was this translation helpful? Give feedback.
-
Hey, @devwaywin. I can see how the nested navigation sample would seem complicated. It relies on understanding the |
Beta Was this translation helpful? Give feedback.
-
You can do this imperitive wrapping of different scaffold inside of navigatorBuilder: (_, __, child) {
final authProvider = Provider.of<AuthProvider>(context);
if (authProvider.authStatus == AuthStatus.checking) {
return const SplashLayout();
}
if (authProvider.authStatus == AuthStatus.authenticated) {
return DashboardLayout(child: child!);
} else {
return AuthLayout(child: child!);
}
}, Pretty sure this should work fine... the |
Beta Was this translation helpful? Give feedback.
-
Thank you very much @esDotDev, this may be a correct solution,
however, every time I navigate to another page, an object of the DashboardLayout class is created again, that is, the following code is always executed: However, in the Fluro code
it is only executed ( Do you have any idea how to do this? Thank you very much for your help, you are a crack. :) Regards, |
Beta Was this translation helpful? Give feedback.
-
Well, curiously, in Fluro, in some way, they have optimized this process. |
Beta Was this translation helpful? Give feedback.
-
Hello,
In the examples that you include, I have not seen the typical dashboard, an initial screen to login and when logging in, a base screen that is used to show the rest of the pages in its central zone, that is, the base screen contains a drawer located on the left, a title in the upper central area, and a central area in which the pages you are browsing are shown.
In fluro the code to do this is the following:
How can I do the same with go_router?
Thanks so much for the help.
Regards,
Jose
Beta Was this translation helpful? Give feedback.
All reactions