Tri*_*ing 11 navigation flutter flutter-go-router
这意味着如果我从作业屏幕转到客户端屏幕(该作业针对的客户),再到另一个作业屏幕(为客户完成的另一项作业)等,我如何显示作业>客户>作业?
并且包括参数,这样我就可以显示 Job 12 > SomeCompany > Job 17。
子路由是不够的,因为堆栈可以无限地重复多个相同的页面。
我找到了一种依赖于内部 API 实现的解决方案。
\n这将来可能会损坏,因此请小心使用。
GoRouter.of(context).routerDelegate.currentConfiguration.matches\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n\xe2\x93\x98 初学者提示
\n确保您已在 中正确配置了路由
\nGoRouter()
。
\n希望它们在导航中的路线中嵌套,而不是彼此成为兄弟姐妹。另外,请确保为
\nGoRouter.of(context).go()
like提供完整的 URI 位置字符串\'/home/level-2/level-3\'
我不确定是否要检查整个堆栈,但如果有人需要检查堆栈上是否有页面,GoRouter 有一个 canPop() 方法:
/// Returns `true` if there is more than 1 page on the stack. bool canPop() => GoRouter.of(this).canPop();
归档时间: |
|
查看次数: |
6386 次 |
最近记录: |