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 ab4d5c88..c00d7256 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 @@ -109,14 +109,20 @@ class _HomeShellPageState extends ConsumerState } // 2. 检查是否在合同/KYC页面 + // 使用 GoRouter.of(context) 获取全局路由状态,而不是 GoRouterState.of(context) + // 因为 GoRouterState.of(context) 只能获取到 ShellRoute 内的路由状态 + // 当用户导航到顶级路由(如 /contract-signing/:orderNo)时无法正确检测 try { - final location = GoRouterState.of(context).uri.path; + final router = GoRouter.of(context); + final location = router.routerDelegate.currentConfiguration.uri.path; + debugPrint('[HomeShellPage] 当前路由: $location'); // 合同签署相关页面 if (location.startsWith('/contract-signing')) return true; // KYC 相关页面 if (location.startsWith('/kyc')) return true; return false; } catch (e) { + debugPrint('[HomeShellPage] 获取路由状态失败: $e'); return false; } }