fix(mobile-app): 修复合同签署页面定时检查仍弹窗的问题

使用 GoRouter.of(context).routerDelegate.currentConfiguration 获取全局路由状态,
而不是 GoRouterState.of(context),因为后者只能获取 ShellRoute 内部的路由状态,
当用户在顶级路由(如 /contract-signing/:orderNo)时无法正确检测。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-25 23:38:55 -08:00
parent 89a2700fc9
commit ce75e68d5e
1 changed files with 7 additions and 1 deletions

View File

@ -109,14 +109,20 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
}
// 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;
}
}