From ae8501dc36fca5f728d8e0925a1663264ad76dba Mon Sep 17 00:00:00 2001 From: amirrezaghabeli Date: Sat, 22 Nov 2025 15:29:46 +0330 Subject: [PATCH] Refactor navigation structure and update asset references - Swapped routes for Profile and Notification branches in the app's navigation structure. - Updated the current index for navigation items in TabletNavigationWidget and related pages to reflect the new routing. - Added a new logo SVG asset to the asset manager for branding consistency. - Adjusted the pubspec.lock file to downgrade several package versions for compatibility. --- lib/core/routes/app_routes.dart | 11 ++--- lib/core/routes/app_routes.g.dart | 38 +++++++++--------- .../routes/app_shell/mobile_shell_page.dart | 24 +++++------ lib/gen/assets.gen.dart | 4 ++ .../pages/t_notification_page.dart | 2 +- lib/views/profile/pages/t_profile_page.dart | 2 +- .../shared/tablet_navigation_widget.dart | 40 +++++++++---------- pubspec.lock | 16 ++++---- 8 files changed, 71 insertions(+), 66 deletions(-) diff --git a/lib/core/routes/app_routes.dart b/lib/core/routes/app_routes.dart index cb0c8d2..f8aa9e6 100644 --- a/lib/core/routes/app_routes.dart +++ b/lib/core/routes/app_routes.dart @@ -113,16 +113,17 @@ class SplashScreenRoute extends GoRouteData with _$SplashScreenRoute { TypedGoRoute(path: '/tenders'), ], ), - TypedStatefulShellBranch( - routes: >[ - TypedGoRoute(path: '/profile'), - ], - ), + TypedStatefulShellBranch( routes: >[ TypedGoRoute(path: '/notification'), ], ), + TypedStatefulShellBranch( + routes: >[ + TypedGoRoute(path: '/profile'), + ], + ), ], ) class AppShellRouteData extends StatefulShellRouteData { diff --git a/lib/core/routes/app_routes.g.dart b/lib/core/routes/app_routes.g.dart index f227601..261a276 100644 --- a/lib/core/routes/app_routes.g.dart +++ b/lib/core/routes/app_routes.g.dart @@ -127,17 +127,6 @@ RouteBase get $appShellRouteData => StatefulShellRouteData.$route( ), ], ), - StatefulShellBranchData.$branch( - navigatorKey: ProfileBranch.$navigatorKey, - - routes: [ - GoRouteData.$route( - path: '/profile', - - factory: _$ProfileRouteData._fromState, - ), - ], - ), StatefulShellBranchData.$branch( navigatorKey: NotificationBranch.$navigatorKey, @@ -149,6 +138,17 @@ RouteBase get $appShellRouteData => StatefulShellRouteData.$route( ), ], ), + StatefulShellBranchData.$branch( + navigatorKey: ProfileBranch.$navigatorKey, + + routes: [ + GoRouteData.$route( + path: '/profile', + + factory: _$ProfileRouteData._fromState, + ), + ], + ), ], ); @@ -198,12 +198,12 @@ mixin _$TendersRouteData on GoRouteData { void replace(BuildContext context) => context.replace(location); } -mixin _$ProfileRouteData on GoRouteData { - static ProfileRouteData _fromState(GoRouterState state) => - const ProfileRouteData(); +mixin _$NotificationRouteData on GoRouteData { + static NotificationRouteData _fromState(GoRouterState state) => + const NotificationRouteData(); @override - String get location => GoRouteData.$location('/profile'); + String get location => GoRouteData.$location('/notification'); @override void go(BuildContext context) => context.go(location); @@ -219,12 +219,12 @@ mixin _$ProfileRouteData on GoRouteData { void replace(BuildContext context) => context.replace(location); } -mixin _$NotificationRouteData on GoRouteData { - static NotificationRouteData _fromState(GoRouterState state) => - const NotificationRouteData(); +mixin _$ProfileRouteData on GoRouteData { + static ProfileRouteData _fromState(GoRouterState state) => + const ProfileRouteData(); @override - String get location => GoRouteData.$location('/notification'); + String get location => GoRouteData.$location('/profile'); @override void go(BuildContext context) => context.go(location); diff --git a/lib/core/routes/app_shell/mobile_shell_page.dart b/lib/core/routes/app_shell/mobile_shell_page.dart index 18ad802..a2cb842 100644 --- a/lib/core/routes/app_shell/mobile_shell_page.dart +++ b/lib/core/routes/app_shell/mobile_shell_page.dart @@ -50,19 +50,19 @@ class MobileShellPage extends StatelessWidget { iconPath: AssetsManager.tenders, activeIconPath: AssetsManager.tendersActive, ), - _bottomNavigationItem( - context: context, - text: TendersStrings.contracts, - isActive: navigationShell.currentIndex == 4, - onTap: () => onTap(4), - iconPath: AssetsManager.contracts, - activeIconPath: AssetsManager.contracts, - ), + // _bottomNavigationItem( + // context: context, + // text: TendersStrings.contracts, + // isActive: navigationShell.currentIndex == 4, + // onTap: () => onTap(4), + // iconPath: AssetsManager.contracts, + // activeIconPath: AssetsManager.contracts, + // ), _bottomNavigationItem( context: context, text: TendersStrings.notifications, - isActive: navigationShell.currentIndex == 3, - onTap: () => onTap(3), + isActive: navigationShell.currentIndex == 2, + onTap: () => onTap(2), iconPath: AssetsManager.notify, activeIconPath: AssetsManager.notifyActive, showBadge: @@ -73,8 +73,8 @@ class MobileShellPage extends StatelessWidget { _bottomNavigationItem( context: context, text: ProfileStrings.profileTitle, - isActive: navigationShell.currentIndex == 2, - onTap: () => onTap(2), + isActive: navigationShell.currentIndex == 3, + onTap: () => onTap(3), iconPath: AssetsManager.profile, activeIconPath: AssetsManager.profileActive, ), diff --git a/lib/gen/assets.gen.dart b/lib/gen/assets.gen.dart index 8eb463b..11c769e 100644 --- a/lib/gen/assets.gen.dart +++ b/lib/gen/assets.gen.dart @@ -98,6 +98,9 @@ class $AssetsIconsGen { /// File path: assets/icons/location.svg String get location => 'assets/icons/location.svg'; + /// File path: assets/icons/logo.svg + String get logo => 'assets/icons/logo.svg'; + /// File path: assets/icons/logo_big.svg String get logoBig => 'assets/icons/logo_big.svg'; @@ -204,6 +207,7 @@ class $AssetsIconsGen { leftArrow, like, location, + logo, logoBig, logoSmall, menu, diff --git a/lib/views/notification/pages/t_notification_page.dart b/lib/views/notification/pages/t_notification_page.dart index f02f58f..b96ff97 100644 --- a/lib/views/notification/pages/t_notification_page.dart +++ b/lib/views/notification/pages/t_notification_page.dart @@ -70,7 +70,7 @@ class _TabletNotificationPageState extends State key: key, context: context, ), - drawer: const TabletNavigationWidget(currentIndex: 3), + drawer: const TabletNavigationWidget(currentIndex: 2), body: Center( child: SizedBox( width: 720, diff --git a/lib/views/profile/pages/t_profile_page.dart b/lib/views/profile/pages/t_profile_page.dart index 75dedf5..ecfb3a0 100644 --- a/lib/views/profile/pages/t_profile_page.dart +++ b/lib/views/profile/pages/t_profile_page.dart @@ -75,7 +75,7 @@ class _TabletProfilePageState extends State { context: context, ), - drawer: const TabletNavigationWidget(currentIndex: 4), + drawer: const TabletNavigationWidget(currentIndex: 3), body: SafeArea( child: Padding( padding: EdgeInsets.symmetric( diff --git a/lib/views/shared/tablet_navigation_widget.dart b/lib/views/shared/tablet_navigation_widget.dart index a33a53b..3b65036 100644 --- a/lib/views/shared/tablet_navigation_widget.dart +++ b/lib/views/shared/tablet_navigation_widget.dart @@ -65,27 +65,27 @@ class TabletNavigationWidget extends StatelessWidget { iconPath: AssetsManager.tenders, activeIconPath: AssetsManager.tendersActive, ), - _navigationItem( - context: context, - text: ProfileStrings.contracts, - isActive: currentIndex == 2, - onTap: () { - if (currentIndex == 2) { - return; - } else { - // context.pop(); - // Router.neglect(context, () => ProfileRouteData().go(context)); - } - }, - iconPath: AssetsManager.contracts, - activeIconPath: AssetsManager.contracts, - ), + // _navigationItem( + // context: context, + // text: ProfileStrings.contracts, + // isActive: currentIndex == 2, + // onTap: () { + // if (currentIndex == 2) { + // return; + // } else { + // // context.pop(); + // // Router.neglect(context, () => ProfileRouteData().go(context)); + // } + // }, + // iconPath: AssetsManager.contracts, + // activeIconPath: AssetsManager.contracts, + // ), _navigationItem( context: context, text: ProfileStrings.notifications, - isActive: currentIndex == 3, + isActive: currentIndex == 2, onTap: () { - if (currentIndex == 3) { + if (currentIndex == 2) { return; } else { context.pop(); @@ -93,7 +93,7 @@ class TabletNavigationWidget extends StatelessWidget { context, () => const NotificationRouteData().go(context), ); - context.read().onTabSelected(3); + context.read().onTabSelected(2); } }, iconPath: AssetsManager.notify, @@ -102,9 +102,9 @@ class TabletNavigationWidget extends StatelessWidget { _navigationItem( context: context, text: ProfileStrings.profileTitle, - isActive: currentIndex == 4, + isActive: currentIndex == 3, onTap: () { - if (currentIndex == 4) { + if (currentIndex == 3) { return; } else { context.pop(); diff --git a/pubspec.lock b/pubspec.lock index e8b0d53..386acf0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: async - sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 url: "https://pub.dev" source: hosted - version: "2.13.0" + version: "2.12.0" boolean_selector: dependency: transitive description: @@ -269,10 +269,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" url: "https://pub.dev" source: hosted - version: "1.3.3" + version: "1.3.2" ffi: dependency: transitive description: @@ -572,10 +572,10 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "10.0.8" leak_tracker_flutter_testing: dependency: transitive description: @@ -1049,10 +1049,10 @@ packages: dependency: transitive description: name: vm_service - sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" url: "https://pub.dev" source: hosted - version: "15.0.0" + version: "14.3.1" watcher: dependency: transitive description: