fix(mobile-app): 遍历路由栈检测当前页面,修复push导航检测问题
之前只检查 currentConfiguration.uri.path,对于 push 导航的页面无法正确检测。 现在遍历整个 matches 路由栈,只要栈中有合同/KYC页面就跳过弹窗。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
73f2b85ddf
commit
aae4f1e360
|
|
@ -110,15 +110,19 @@ class _HomeShellPageState extends ConsumerState<HomeShellPage>
|
|||
}
|
||||
|
||||
// 2. 检查是否在合同/KYC页面
|
||||
// 使用 appRouterProvider 获取全局路由状态
|
||||
// 遍历整个路由栈,检查是否有任何合同/KYC相关页面
|
||||
try {
|
||||
final router = ref.read(appRouterProvider);
|
||||
final location = router.routerDelegate.currentConfiguration.uri.path;
|
||||
debugPrint('[HomeShellPage] 当前路由(provider): $location');
|
||||
// 合同签署相关页面
|
||||
if (location.startsWith('/contract-signing')) return true;
|
||||
// KYC 相关页面
|
||||
if (location.startsWith('/kyc')) return true;
|
||||
final matches = router.routerDelegate.currentConfiguration.matches;
|
||||
|
||||
for (final match in matches) {
|
||||
final location = match.matchedLocation;
|
||||
debugPrint('[HomeShellPage] 路由栈: $location');
|
||||
// 合同签署相关页面
|
||||
if (location.startsWith('/contract-signing')) return true;
|
||||
// KYC 相关页面
|
||||
if (location.startsWith('/kyc')) return true;
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
debugPrint('[HomeShellPage] 获取路由状态失败: $e');
|
||||
|
|
|
|||
Loading…
Reference in New Issue