Open
Description
Use case
In our app we are using a TabBar with TabView. This create a nice animation when using the tabs.
Now with go_router
5.0.0 we can use a ShellRoute but it returns the child in a Navigator. This works but we are losing the nice animation when switching tabs with a TabView.
I was thinking maybe we can create a TabBarShellRoute
which gets wrapped in a DefaultTabController
and then returns a child as a TabView
with all the child routes inside of which each have their own Navigator
.
Then maybe create a TabViewGoRoute
which doesn't have a pageBuilder and of which the child routes
are a list of the normal GoRoute
objects.
Proposal
TabBarShellRoute(
navigatorKey: _homeTabBarShellNavigatorKey,
builder: (context, state, child, controller) => HomeTabShell(
controller: controller,
child: child,
),
routes: [
TabViewGoRoute(
name: TransactionsTab.name,
path: '/transactions',
builder: (context, state) => const TransactionsTab(),
),
TabViewGoRoute(
name: SavingsBalancesTab.name,
path: '/savings-balances',
builder: (context, state) => const SavingsBalancesTab(),
routes: [
GoRoute(
name: OpenSavingsPage.name,
path: 'open-new',
parentNavigatorKey: _rootNavigatorKey,
builder: (context, state) => const OpenSavingsPage(),
),
],
),
],
),