RouterProxy class

Inheritance
Mixed-in types

Properties

currentConfiguration RouteInformation
Called by the Router when it detects a route information may have changed as a result of rebuild.
no setteroverride
currentTargetPage ValueNotifier<Widget?>
通知特定的页面 ValueListenableBuilder
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
location String
no getter
The key used for retrieving the current navigator.
no setteroverride
pageMap Map?
静态路由的页面
getter/setter pair
pages List<MaterialPage>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
backTarget() → void
返回到上一个非页面跳转的目标
build(BuildContext context) Widget
Called by the Router to obtain the widget tree that represents the current state.
override
canPop() bool
检查页面栈是否可以pop
clearTargets() → void
清空所有非页面跳转的目标
defaultParser() CustomParser
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
getArguments<T>() → T?
获取当前显示页面的参数
getCurrentMaterialPage() MaterialPage
获取当前显示页面的MaterialPage对象,可用于获取参数
getCurrentPage() Widget
获取当前显示的页面Widget
getLocation() String?
goRootPage() → void
回到根页面
goToTarget(Widget page, {bool insert = true}) → void
非页面跳转,只切换到目标页面 (例如主页的Tab切换)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
notifyListeners() → void
Call all the registered listeners.
inherited
pop<T>([T? result]) → void
popAndPushNamed({required String name, Object? arguments, Widget? emptyPage}) → void
pop当前页面,然后push一个新页面
popRoute() Future<bool>
Called by the Router when the Router.backButtonDispatcher reports that the operating system is requesting that the current route be popped.
override
popWithResult<T>([T? result]) → void
关闭当前窗口,并附带返回值 示例: RouterProxy.getInstance().popWithResult('从页面返回的数据');
push<T>({required Widget page, ResultCallBack? onResult, String? name, Object? arguments, String? restorationId, bool maintainState = true, bool fullscreenDialog = false, bool allowSnapshotting = true}) → void
推出一个新页面到导航栈
pushAndRemoveAll(Widget page) → void
清空页面栈并push新页面
pushNamed({required String name, ResultCallBack? onResult, Object? arguments, Widget? emptyPage, bool custom = true, String? restorationId}) → void
根据名称跳转页面
pushNamedAndRemoveAll({required String name, Object? arguments, Widget? emptyPage, String? restorationId}) → void
跳转到指定页面,并清空之前的所有页面
pushStackTop({required Widget page}) → void
将页面置于栈顶(如果已存在则先移除)
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
replace({required Widget page, String? name, Object? arguments, String? restorationId}) → void
替换当前页面
setInitialRoutePath(RouteInformation configuration) Future<void>
Called by the Router at startup with the structure that the RouteInformationParser obtained from parsing the initial route.
inherited
setNewRoutePath(RouteInformation configuration) Future<void>
Called by the Router when the Router.routeInformationProvider reports that a new route has been pushed to the application by the operating system.
override
setRestoredRoutePath(RouteInformation configuration) Future<void>
Called by the Router during state restoration.
inherited
showAppBottomSheet<T>({required WidgetBuilder builder, bool isScrollControlled = false, Color? backgroundColor, double? elevation, ShapeBorder? shape, Clip? clipBehavior, BoxConstraints? constraints, Color? barrierColor, bool useRootNavigator = false, bool isDismissible = true, bool enableDrag = true, RouteSettings? routeSettings, AnimationController? transitionAnimationController, Offset? anchorPoint}) Future<T?>
显示一个通用的模态底部面板(Modal Bottom Sheet) 示例: RouterProxy.getInstance().showAppBottomSheet( builder: (context) => Container( height: 200, child: Center(child: Text('这是一个底部面板')), ), );
showAppDialog<T>({required WidgetBuilder builder, bool barrierDismissible = true, Color? barrierColor = Colors.black54, String? barrierLabel, bool useSafeArea = true, bool useRootNavigator = true, RouteSettings? routeSettings, Offset? anchorPoint}) Future<T?>
显示一个通用的对话框(Dialog) 示例: RouterProxy.getInstance().showAppDialog( builder: (context) => AlertDialog( title: Text('提示'), content: Text('这是一个通过路由服务显示的对话框。'), actions:
showAppSnackBar({required String message}) → void
显示一个提示条(SnackBar) 示例: RouterProxy.getInstance().showAppSnackBar(message: '这是一个提示!');
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getInstance({RoutePathCallBack? routePathCallBack, ExitWindowStyle? exitWindowStyle, NavigateToTargetCallBack? navigateToTargetCallBack, Map? pageMap}) RouterProxy