Flutter WidgetsApp路由相关属性注释翻译。MaterialApp, CupertinoApp

/// {@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<NavigatorState>? 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
  /// defa
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值