From 9a8965f56928b3558497ad40db2bc6ac2aa97394 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Fri, 24 Feb 2023 15:13:17 +0300 Subject: [PATCH] fix: Fix BottomBar showing incorrect animation when navigating from sibling routes --- .../root_scaffold_with_navigation.dart | 21 +++++++++---------- lib/ui/pages/root_route.dart | 5 ++++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/ui/layouts/root_scaffold_with_navigation.dart b/lib/ui/layouts/root_scaffold_with_navigation.dart index ca0010d5..ae4574fe 100644 --- a/lib/ui/layouts/root_scaffold_with_navigation.dart +++ b/lib/ui/layouts/root_scaffold_with_navigation.dart @@ -36,18 +36,19 @@ class RootScaffoldWithNavigation extends StatelessWidget { body: Row( children: [ if (Breakpoints.medium.isActive(context)) - MainScreenNavigationRail( + _MainScreenNavigationRail( destinations: destinations, showFab: showFab, ), if (Breakpoints.large.isActive(context)) - MainScreenNavigationDrawer( + _MainScreenNavigationDrawer( destinations: destinations, + showFab: showFab, ), Expanded(child: child), ], ), - bottomNavigationBar: BottomBar( + bottomNavigationBar: _BottomBar( destinations: destinations, hidden: !(Breakpoints.small.isActive(context) && showBottomBar), key: const Key('bottomBar'), @@ -104,11 +105,10 @@ class _RootAppBar extends StatelessWidget { ); } -class MainScreenNavigationRail extends StatelessWidget { - const MainScreenNavigationRail({ +class _MainScreenNavigationRail extends StatelessWidget { + const _MainScreenNavigationRail({ required this.destinations, this.showFab = true, - super.key, }); final List destinations; @@ -173,8 +173,8 @@ class MainScreenNavigationRail extends StatelessWidget { } } -class BottomBar extends StatelessWidget { - const BottomBar({ +class _BottomBar extends StatelessWidget { + const _BottomBar({ required this.destinations, required this.hidden, super.key, @@ -219,11 +219,10 @@ class BottomBar extends StatelessWidget { } } -class MainScreenNavigationDrawer extends StatelessWidget { - const MainScreenNavigationDrawer({ +class _MainScreenNavigationDrawer extends StatelessWidget { + const _MainScreenNavigationDrawer({ required this.destinations, this.showFab = true, - super.key, }); final List destinations; diff --git a/lib/ui/pages/root_route.dart b/lib/ui/pages/root_route.dart index 5fd2645f..80b57ece 100644 --- a/lib/ui/pages/root_route.dart +++ b/lib/ui/pages/root_route.dart @@ -38,11 +38,14 @@ class _RootPageState extends State with TickerProviderStateMixin { (final destination) => context.router.isRouteActive(destination.route.routeName), ); + final isOtherRouterActive = + context.router.root.current.name != RootRoute.name; final routeName = getRouteTitle(context.router.current.name).tr(); return RootScaffoldWithNavigation( title: routeName, destinations: destinations, - showBottomBar: !(currentDestinationIndex == -1), + showBottomBar: + !(currentDestinationIndex == -1 && !isOtherRouterActive), showFab: isReady, child: child, );