diff --git a/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart b/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart index c00d7256..7953ff74 100644 --- a/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart +++ b/frontend/mobile-app/lib/features/home/presentation/pages/home_shell_page.dart @@ -8,6 +8,7 @@ import '../../../../core/di/injection_container.dart'; import '../../../../core/services/contract_check_service.dart'; import '../../../../core/updater/update_service.dart'; import '../../../../routes/route_paths.dart'; +import '../../../../routes/app_router.dart'; import '../../../../bootstrap.dart'; import '../widgets/bottom_nav_bar.dart'; @@ -109,13 +110,11 @@ class _HomeShellPageState extends ConsumerState } // 2. 检查是否在合同/KYC页面 - // 使用 GoRouter.of(context) 获取全局路由状态,而不是 GoRouterState.of(context) - // 因为 GoRouterState.of(context) 只能获取到 ShellRoute 内的路由状态 - // 当用户导航到顶级路由(如 /contract-signing/:orderNo)时无法正确检测 + // 使用 appRouterProvider 获取全局路由状态 try { - final router = GoRouter.of(context); + final router = ref.read(appRouterProvider); final location = router.routerDelegate.currentConfiguration.uri.path; - debugPrint('[HomeShellPage] 当前路由: $location'); + debugPrint('[HomeShellPage] 当前路由(provider): $location'); // 合同签署相关页面 if (location.startsWith('/contract-signing')) return true; // KYC 相关页面