/// {@template flutter.widgets.widgetsApp.navigatorKey}
/// A key to use when building the [Navigator].
/// 创建[Navigator]时会用到的一个key
///
/// If a [navigatorKey] is specified, the [Navigator] can be directly
/// manipulated without first obtaining it from a [BuildContext] via
/// [Navigator.of]: from the [navigatorKey], use the [GlobalKey.currentState]
/// getter.
/// 如果[navigatorKey]是已指定的,
/// 则[Navigator]不需要通过[BuildContext]来首次获取,就可以直接 *** 作
/// [Navigator.of]:通过[navigatorKey],使用[GlobalKey.currentState] getter方法
///
/// If this is changed, a new [Navigator] will be created, losing all the
/// application state in the process; in that case, the [navigatorObservers]
/// must also be changed, since the previous observers will be attached to the
/// previous navigator.
/// 如果navigatorKey被改变,新的[Navigator]将会被创建,所有正在进行的应用状态将会丢失;
/// 因为前一个[navigatorObservers]关联了前一个navigator,所以[navigatorObservers]也必须被改变。
///
/// The [Navigator] is only built if [onGenerateRoute] is not null; if it is
/// null, [navigatorKey] must also be null.
/// 只有[onGenerateRoute]不为空,[Navigator]才会被创建;
/// 如果[onGenerateRoute]为空,[navigatorKey]一样也必须为空
///
/// {@endtemplate}
final GlobalKey? navigatorKey;
/// {@template flutter.widgets.widgetsApp.onGenerateRoute}
/// The route generator callback used when the app is navigated to a
/// named route.
/// 触发于应用导航到一个命名路由时,的路由生成器回调
///
/// If this returns null when building the routes to handle the specified
/// [initialRoute], then all the routes are discarded and
/// [Navigator.defaultRouteName] is used instead (`/`). See [initialRoute].
/// 当创建用于处理具体的[initialRoute]的路由时,若返回空,
/// 之后所有的路由会被丢弃,同时[Navigator.defaultRouteName]会被使用,而不是(`/`)。
/// 具体查阅[initialRoute]
///
/// During normal app operation, the [onGenerateRoute] callback will only be
/// applied to route names pushed by the application, and so should never
/// return null.
/// 处于正常的app *** 作时,[onGenerateRoute]回调只会应用于命名路由的push *** 作,
/// 由此,[onGenerateRoute]不会返回空
///
/// This is used if [routes] does not contain the requested route.
/// [onGenerateRoute]用于当[routes]不包含【the requested route】时
///
/// The [Navigator] is only built if routes are provided (either via [home],
/// [routes], [onGenerateRoute], or [onUnknownRoute]); if they are not,
/// [builder] must not be null.
/// {@endtemplate}
/// [Navigator]只会创建当路由提供(或者通过[home]),
/// [routes],[onGenerateRoute], or [onUnknownRoute]);
/// 如果以上未提供,[builder]必须不为空
///
/// If this property is not set, either the [routes] or [home] properties must
/// be set, and the [pageRouteBuilder] must also be set so that the
/// default handler will know what routes and [PageRoute]s to build.
/// 如果这个属性未设置,则[routes] or [home]必须设置,
/// 并且[pageRouteBuilder]也需要设置
/// 好让默认处理其知道路由和[PageRoute]s创建
///
final RouteFactory? onGenerateRoute;
/// {@template flutter.widgets.widgetsApp.onGenerateInitialRoutes}
/// The routes generator callback used for generating initial routes if
/// [initialRoute] is provided.
/// 触发于当[initialRoute]有提供,生成初始路由时的路由生成器回调
///
/// If this property is not set, the underlying
/// [Navigator.onGenerateInitialRoutes] will default to
/// [Navigator.defaultGenerateInitialRoutes].
/// 如果该属性未设置,会默认为[Navigator.defaultGenerateInitialRoutes]
///
/// {@endtemplate}
///
final InitialRouteListFactory? onGenerateInitialRoutes;
/// The [PageRoute] generator callback used when the app is navigated to a
/// named route.
/// [PageRoute]生成器回调,触发于app导航到命名路由
///
/// This callback can be used, for example, to specify that a [MaterialPageRoute]
/// or a [CupertinoPageRoute] should be used for building page transitions.
final PageRouteFactory? pageRouteBuilder;
/// {@template flutter.widgets.widgetsApp.routeInformationParser}
/// A delegate to parse the route information from the
/// [routeInformationProvider] into a generic data type to be processed by
/// the [routerDelegate] at a later stage.
/// 一个用于解析路由信息(信息来自[routeInformationProvider])的代理,
/// 该代理将路由信息解析成范型数据类型,
/// 以便[routerDelegate]在之后的阶段处理
///
/// This object will be used by the underlying [Router].
/// 该对象会被潜在的[Router]使用
///
/// The generic type `T` must match the generic type of the [routerDelegate].
/// 该范型'T'必须匹配[routerDelegate]的范型
///
/// See also:
///
/// * [Router.routeInformationParser]: which receives this object when this
/// widget builds the [Router].
/// {@endtemplate}
final RouteInformationParser
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)