From c65558ef6ccec12275d261f3cbc11aa2936e1c04 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Mon, 11 May 2020 13:38:51 +0200 Subject: [PATCH] Fix pages navigation issue --- lib/ui/routes/main_route/main_route.dart | 4 +++- lib/ui/routes/main_route/page_info.dart | 5 ++++- lib/ui/routes/main_route/tablet_route.dart | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/ui/routes/main_route/main_route.dart b/lib/ui/routes/main_route/main_route.dart index fbbe380..16a64d6 100644 --- a/lib/ui/routes/main_route/main_route.dart +++ b/lib/ui/routes/main_route/main_route.dart @@ -87,7 +87,9 @@ abstract class MainController extends State { /// Open user page void openUserPage(int userID) => pushPage(PageInfo( - type: PageType.USER_PAGE, child: UserPageScreen(userID: userID))); + type: PageType.USER_PAGE, + child: UserPageScreen(userID: userID), + id: userID)); void openUserAccessDeniedPage(int userID) => pushPage(PageInfo(child: UserAccessDeniedScreen(userID: userID))); diff --git a/lib/ui/routes/main_route/page_info.dart b/lib/ui/routes/main_route/page_info.dart index d16425c..e142add 100644 --- a/lib/ui/routes/main_route/page_info.dart +++ b/lib/ui/routes/main_route/page_info.dart @@ -22,7 +22,10 @@ class PageInfo { final bool hideNavBar; final bool canShowAsDialog; - const PageInfo({ + /// Unique identification of this child + final key = UniqueKey(); + + PageInfo({ this.type = PageType.OTHER_PAGE, @required this.child, this.id, diff --git a/lib/ui/routes/main_route/tablet_route.dart b/lib/ui/routes/main_route/tablet_route.dart index f4d3ea2..4fa9186 100644 --- a/lib/ui/routes/main_route/tablet_route.dart +++ b/lib/ui/routes/main_route/tablet_route.dart @@ -73,9 +73,10 @@ class _TabletRouteState extends MainController { ); Widget _buildRightPane() => Container( - width: MediaQuery.of(context).size.width - _SideBarSize, - child: currentPage.child, - ); + key: currentPage.key, + width: MediaQuery.of(context).size.width - _SideBarSize, + child: currentPage.child, + ); @override void pushPage(PageInfo page) {