mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-09 09:31:13 +00:00
fix: Fix BottomBar showing incorrect animation when navigating from sibling routes
This commit is contained in:
parent
9d6721d58b
commit
9a8965f569
|
@ -36,18 +36,19 @@ class RootScaffoldWithNavigation extends StatelessWidget {
|
||||||
body: Row(
|
body: Row(
|
||||||
children: [
|
children: [
|
||||||
if (Breakpoints.medium.isActive(context))
|
if (Breakpoints.medium.isActive(context))
|
||||||
MainScreenNavigationRail(
|
_MainScreenNavigationRail(
|
||||||
destinations: destinations,
|
destinations: destinations,
|
||||||
showFab: showFab,
|
showFab: showFab,
|
||||||
),
|
),
|
||||||
if (Breakpoints.large.isActive(context))
|
if (Breakpoints.large.isActive(context))
|
||||||
MainScreenNavigationDrawer(
|
_MainScreenNavigationDrawer(
|
||||||
destinations: destinations,
|
destinations: destinations,
|
||||||
|
showFab: showFab,
|
||||||
),
|
),
|
||||||
Expanded(child: child),
|
Expanded(child: child),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomBar(
|
bottomNavigationBar: _BottomBar(
|
||||||
destinations: destinations,
|
destinations: destinations,
|
||||||
hidden: !(Breakpoints.small.isActive(context) && showBottomBar),
|
hidden: !(Breakpoints.small.isActive(context) && showBottomBar),
|
||||||
key: const Key('bottomBar'),
|
key: const Key('bottomBar'),
|
||||||
|
@ -104,11 +105,10 @@ class _RootAppBar extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainScreenNavigationRail extends StatelessWidget {
|
class _MainScreenNavigationRail extends StatelessWidget {
|
||||||
const MainScreenNavigationRail({
|
const _MainScreenNavigationRail({
|
||||||
required this.destinations,
|
required this.destinations,
|
||||||
this.showFab = true,
|
this.showFab = true,
|
||||||
super.key,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final List<RouteDestination> destinations;
|
final List<RouteDestination> destinations;
|
||||||
|
@ -173,8 +173,8 @@ class MainScreenNavigationRail extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BottomBar extends StatelessWidget {
|
class _BottomBar extends StatelessWidget {
|
||||||
const BottomBar({
|
const _BottomBar({
|
||||||
required this.destinations,
|
required this.destinations,
|
||||||
required this.hidden,
|
required this.hidden,
|
||||||
super.key,
|
super.key,
|
||||||
|
@ -219,11 +219,10 @@ class BottomBar extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainScreenNavigationDrawer extends StatelessWidget {
|
class _MainScreenNavigationDrawer extends StatelessWidget {
|
||||||
const MainScreenNavigationDrawer({
|
const _MainScreenNavigationDrawer({
|
||||||
required this.destinations,
|
required this.destinations,
|
||||||
this.showFab = true,
|
this.showFab = true,
|
||||||
super.key,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final List<RouteDestination> destinations;
|
final List<RouteDestination> destinations;
|
||||||
|
|
|
@ -38,11 +38,14 @@ class _RootPageState extends State<RootPage> with TickerProviderStateMixin {
|
||||||
(final destination) =>
|
(final destination) =>
|
||||||
context.router.isRouteActive(destination.route.routeName),
|
context.router.isRouteActive(destination.route.routeName),
|
||||||
);
|
);
|
||||||
|
final isOtherRouterActive =
|
||||||
|
context.router.root.current.name != RootRoute.name;
|
||||||
final routeName = getRouteTitle(context.router.current.name).tr();
|
final routeName = getRouteTitle(context.router.current.name).tr();
|
||||||
return RootScaffoldWithNavigation(
|
return RootScaffoldWithNavigation(
|
||||||
title: routeName,
|
title: routeName,
|
||||||
destinations: destinations,
|
destinations: destinations,
|
||||||
showBottomBar: !(currentDestinationIndex == -1),
|
showBottomBar:
|
||||||
|
!(currentDestinationIndex == -1 && !isOtherRouterActive),
|
||||||
showFab: isReady,
|
showFab: isReady,
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue