/// {@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
Flutter WidgetsApp路由相关属性注释翻译。MaterialApp, CupertinoApp
于 2022-04-08 15:04:15 首次发布