I'm creating an application with the bottom navigator.
I used a ShellRoute
but our requirement is to hide bottom navigator on screen
For example:
main page can have bottom navigator when i go to another screen (such an user profile page)
I have to hide bottom navigator but i use ShellRoute
and sub route in the same ShellRoute
, it doesn't hide bottom navigator.
ShellRoute(
navigatorKey: _shellNavigatorKey,
builder: (context, state, child) {
return MainScreen(child: child);
},
routes: [
GoRoute(
path: '/$dashboardRouteName',
name: dashboardRouteName,
pageBuilder: (context, state) => CustomPageRouteBuilder.route(
key: UniqueKey(),
child: const DashboardScreen(),
),
routes: [
GoRoute(
path: leaveRequestRouteName,
name: '$dashboardRouteName/$leaveRequestRouteName',
pageBuilder: (context, state) => CustomPageRouteBuilder.route(
key: state.pageKey,
child: const LeaveRequestScreen(),
),
),
GoRoute(
path: switchHolidayRouteName,
name: '$dashboardRouteName/$switchHolidayRouteName',
pageBuilder: (context, state) => CustomPageRouteBuilder.route(
key: state.pageKey,
child: const SwitchHolidayScreen(),
),
),
],
),
after that, i separate sub route into general route like below:
ShellRoute(
navigatorKey: _shellNavigatorKey,
builder: (context, state, child) {
return MainScreen(child: child);
},
routes: [
GoRoute(
path: '/$dashboardRouteName',
name: dashboardRouteName,
pageBuilder: (context, state) => CustomPageRouteBuilder.route(
key: UniqueKey(),
child: const DashboardScreen(),
),
),
....
GoRoute(
path: '/$switchHolidayRouteName',
name: switchHolidayRouteName,
pageBuilder: (context, state) => CustomPageRouteBuilder.route(
key: state.pageKey,
child: const SwitchHolidayScreen(),
),
),
GoRoute(
path: '/$leaveRequestRouteName',
name: leaveRequestRouteName,
pageBuilder: (context, state) => CustomPageRouteBuilder.route(
key: state.pageKey,
child: const LeaveRequestScreen(),
),
),
and i use context.go()
, it works but i can't back to previous screen with context.pop()
.
anyone has any idea?