@@ -52,6 +52,7 @@ class MaterialApp extends StatefulWidget {
|
||||
this.theme,
|
||||
this.home,
|
||||
this.routes: const <String, WidgetBuilder>{},
|
||||
this.initialRoute,
|
||||
this.onGenerateRoute,
|
||||
this.onLocaleChanged,
|
||||
this.debugShowMaterialGrid: false,
|
||||
@@ -110,6 +111,11 @@ class MaterialApp extends StatefulWidget {
|
||||
/// build the page instead.
|
||||
final Map<String, WidgetBuilder> routes;
|
||||
|
||||
/// The name of the first route to show.
|
||||
///
|
||||
/// Defaults to [Window.defaultRouteName].
|
||||
final String initialRoute;
|
||||
|
||||
/// The route generator callback used when the app is navigated to a
|
||||
/// named route.
|
||||
final RouteFactory onGenerateRoute;
|
||||
@@ -254,6 +260,7 @@ class _MaterialAppState extends State<MaterialApp> {
|
||||
// blue[500] is the primary color of the default theme
|
||||
color: config.color ?? theme?.primaryColor ?? Colors.blue[500],
|
||||
navigatorObserver: _heroController,
|
||||
initialRoute: config.initialRoute,
|
||||
onGenerateRoute: _onGenerateRoute,
|
||||
onLocaleChanged: config.onLocaleChanged,
|
||||
showPerformanceOverlay: config.showPerformanceOverlay,
|
||||
|
||||
@@ -43,6 +43,7 @@ class WidgetsApp extends StatefulWidget {
|
||||
this.textStyle,
|
||||
this.color,
|
||||
this.navigatorObserver,
|
||||
this.initialRoute,
|
||||
this.onLocaleChanged,
|
||||
this.showPerformanceOverlay: false,
|
||||
this.showSemanticsDebugger: false,
|
||||
@@ -70,6 +71,11 @@ class WidgetsApp extends StatefulWidget {
|
||||
/// named route.
|
||||
final RouteFactory onGenerateRoute;
|
||||
|
||||
/// The name of the first route to show.
|
||||
///
|
||||
/// Defaults to [Window.defaultRouteName].
|
||||
final String initialRoute;
|
||||
|
||||
/// Callback that is called when the operating system changes the
|
||||
/// current locale.
|
||||
final LocaleChangedCallback onLocaleChanged;
|
||||
@@ -176,7 +182,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
|
||||
color: config.color,
|
||||
child: new Navigator(
|
||||
key: _navigator,
|
||||
initialRoute: ui.window.defaultRouteName,
|
||||
initialRoute: config.initialRoute ?? ui.window.defaultRouteName,
|
||||
onGenerateRoute: config.onGenerateRoute,
|
||||
observer: config.navigatorObserver
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user