EasySplitGoRoute class
EasySplitGoRoute · GoRoute 的分栏适配子类
与 GoRoute 完全同参,只把生成的 Page 换成分栏路由:
- 宽屏(横屏):页面渲染到右侧分栏区域
- 折叠(窄屏):正常全屏路由模式
- fullscreen = true:任何宽度都全屏(沉浸页)
结构完全自由:GoRoute / ShellRoute / StatefulShellRoute 混用均可,
只是页面路由把 GoRoute 换成 EasySplitGoRoute(机械复用,一个词的改动):
GoRouter(routes: [
GoRoute(path: '/', builder: (_, _) => EasySplitScope(child: RootPage())),
EasySplitGoRoute(path: '/detail', builder: (_, _) => DetailPage()),
ShellRoute(builder: ..., routes: [...]),
])
重复路由去重(dedupe,默认 true):
和 MaterialApp.router 方案一致——当 context.push('/detail') 的目标页面
已经存在于当前路由栈中时,不再重复压栈,而是把栈内已有的那一页置顶
(中间页面弹掉,返回键直接回到上一页)。判断规则复用
EasySplitConfig.sameRoute / EasySplitConfig.dedupeRepeatedRoutes,
默认按「匹配位置 + extra」判断是否为同一页。
说明:GoRouter 的 push 由框架内部的 RouteInformationProvider 处理,
无法像 MaterialApp.router 方案那样拦截 pushNamed,因此去重是基于
pageBuilder 在「新页面入栈后」自动收敛路由栈实现的;对页面代码零改动。
ShellRoute / StatefulShellRoute 内的子页面暂不参与去重(保持原生行为)。
redirect / onExit / caseSensitive 与 GoRoute 同义,原样透传给父类,
因此分栏页面同样可以写路由级登录拦截、离开确认。
Constructors
Properties
- builder → GoRouterWidgetBuilder?
-
A custom builder for this route.
finalinherited
- caseSensitive → bool
-
Determines whether the route matching is case sensitive.
finalinherited
- dedupe → bool
-
是否启用「同一页面已在栈内则置顶」去重(默认 true)
final
- fullscreen → bool
-
true = 任何宽度都全屏(原生 MaterialPageRoute)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
metadata
→ Map<
String, dynamic> ? -
Application-defined metadata associated with this route.
finalinherited
- name → String?
-
Optional name of the route.
finalinherited
- onExit → ExitCallback?
-
Called when this route is removed from GoRouter's route history.
finalinherited
- pageBuilder → GoRouterPageBuilder?
-
A page builder for this route.
finalinherited
-
An optional key specifying which Navigator to display this route's screen
onto.
finalinherited
- path → String
-
The path of this go route.
finalinherited
- redirect → GoRouterRedirect?
-
An optional redirect function for this route.
finalinherited
- redirectOnly → bool
-
Whether this
GoRouteonly redirects to another route.no setterinherited -
routes
→ List<
RouteBase> -
The list of child routes associated with this route.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
extractPathParams(
RegExpMatch match) → Map< String, String> -
Extract the path parameters from a match.
inherited
-
matchPatternAsPrefix(
String loc) → RegExpMatch? -
Match this route against a location.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited