Hide routes from the API when they're not needed. (#3431)
The 'routes' table is a point of confusion with new developers. By providing a 'home' argument that sets the '/' route, we can delay the point at which we teach developers about 'routes' until the point where they want to have a second route.
This commit is contained in:
@@ -24,9 +24,7 @@ class ComplexLayoutAppState extends State<ComplexLayoutApp> {
|
||||
return new MaterialApp(
|
||||
theme: lightTheme ? new ThemeData.light() : new ThemeData.dark(),
|
||||
title: 'Advanced Layout',
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new ComplexLayout(),
|
||||
}
|
||||
home: new ComplexLayout()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -465,8 +465,6 @@ class CardCollectionState extends State<CardCollection> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: 'Cards',
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new CardCollection(),
|
||||
}
|
||||
home: new CardCollection()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -298,8 +298,6 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: 'Drag and Drop Flutter Demo',
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new DragAndDropApp()
|
||||
}
|
||||
home: new DragAndDropApp()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -249,6 +249,6 @@ class _WindowManagerState extends State<WindowManager> {
|
||||
void main() {
|
||||
runApp(new MaterialApp(
|
||||
title: 'Mozart',
|
||||
routes: <String, WidgetBuilder>{ '/': (_) => new WindowManager() }
|
||||
home: new WindowManager()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -201,8 +201,6 @@ void main() {
|
||||
accentColor: Colors.redAccent[200]
|
||||
),
|
||||
title: 'Cards',
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new OverlayGeometryApp()
|
||||
}
|
||||
home: new OverlayGeometryApp()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -145,8 +145,6 @@ void main() {
|
||||
primarySwatch: Colors.blue,
|
||||
accentColor: Colors.redAccent[200]
|
||||
),
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) => new PageableListApp(),
|
||||
}
|
||||
home: new PageableListApp()
|
||||
));
|
||||
}
|
||||
|
||||
@@ -9,25 +9,19 @@ import 'package:sky_services/sky/input_event.mojom.dart' as mojom;
|
||||
GlobalKey _key = new GlobalKey();
|
||||
|
||||
void main() {
|
||||
runApp(
|
||||
new MaterialApp(
|
||||
title: "Hardware Key Demo",
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/': (BuildContext context) {
|
||||
return new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text("Hardware Key Demo")
|
||||
),
|
||||
body: new Material(
|
||||
child: new RawKeyboardDemo(
|
||||
key: _key
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
runApp(new MaterialApp(
|
||||
title: "Hardware Key Demo",
|
||||
home: new Scaffold(
|
||||
appBar: new AppBar(
|
||||
title: new Text("Hardware Key Demo")
|
||||
),
|
||||
body: new Material(
|
||||
child: new RawKeyboardDemo(
|
||||
key: _key
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
class RawKeyboardDemo extends StatefulWidget {
|
||||
|
||||
Reference in New Issue
Block a user