parent
f13314867c
commit
9b9ad3db17
@ -462,8 +462,8 @@ class CardCollectionState extends State<CardCollection> {
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(new MaterialApp(
|
runApp(new MaterialApp(
|
||||||
title: 'Cards',
|
title: 'Cards',
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new CardCollection(),
|
'/': (BuildContext context) => new CardCollection(),
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -283,8 +283,8 @@ class DragAndDropAppState extends State<DragAndDropApp> {
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(new MaterialApp(
|
runApp(new MaterialApp(
|
||||||
title: 'Drag and Drop Flutter Demo',
|
title: 'Drag and Drop Flutter Demo',
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new DragAndDropApp()
|
'/': (BuildContext context) => new DragAndDropApp()
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -238,6 +238,6 @@ class _WindowManagerState extends State<WindowManager> {
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(new MaterialApp(
|
runApp(new MaterialApp(
|
||||||
title: 'Mozart',
|
title: 'Mozart',
|
||||||
routes: <String, RouteBuilder>{ '/': (_) => new WindowManager() }
|
routes: <String, WidgetBuilder>{ '/': (_) => new WindowManager() }
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -179,8 +179,8 @@ void main() {
|
|||||||
accentColor: Colors.redAccent[200]
|
accentColor: Colors.redAccent[200]
|
||||||
),
|
),
|
||||||
title: 'Cards',
|
title: 'Cards',
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new OverlayGeometryApp()
|
'/': (BuildContext context) => new OverlayGeometryApp()
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -142,8 +142,8 @@ void main() {
|
|||||||
primarySwatch: Colors.blue,
|
primarySwatch: Colors.blue,
|
||||||
accentColor: Colors.redAccent[200]
|
accentColor: Colors.redAccent[200]
|
||||||
),
|
),
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new PageableListApp(),
|
'/': (BuildContext context) => new PageableListApp(),
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ void main() {
|
|||||||
runApp(
|
runApp(
|
||||||
new MaterialApp(
|
new MaterialApp(
|
||||||
title: "Hardware Key Demo",
|
title: "Hardware Key Demo",
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
toolBar: new ToolBar(
|
toolBar: new ToolBar(
|
||||||
center: new Text("Hardware Key Demo")
|
center: new Text("Hardware Key Demo")
|
||||||
|
@ -214,8 +214,8 @@ class _GestureDemoState extends State<GestureDemo> {
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(new MaterialApp(
|
runApp(new MaterialApp(
|
||||||
theme: new ThemeData.dark(),
|
theme: new ThemeData.dark(),
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
toolBar: new ToolBar(
|
toolBar: new ToolBar(
|
||||||
center: new Text('Gestures Demo')),
|
center: new Text('Gestures Demo')),
|
||||||
|
@ -97,8 +97,8 @@ final List<String> _kNames = _initNames();
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(new MaterialApp(
|
runApp(new MaterialApp(
|
||||||
title: 'Media Query Example',
|
title: 'Media Query Example',
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
toolBar: new ToolBar(
|
toolBar: new ToolBar(
|
||||||
center: new Text('Media Query Example')
|
center: new Text('Media Query Example')
|
||||||
|
@ -151,8 +151,8 @@ class SectorAppState extends State<SectorApp> {
|
|||||||
return new MaterialApp(
|
return new MaterialApp(
|
||||||
theme: new ThemeData.light(),
|
theme: new ThemeData.light(),
|
||||||
title: 'Sector Layout',
|
title: 'Sector Layout',
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
toolBar: new ToolBar(
|
toolBar: new ToolBar(
|
||||||
center: new Text('Sector Layout in a Widget Tree')
|
center: new Text('Sector Layout in a Widget Tree')
|
||||||
|
@ -118,8 +118,8 @@ class _StyledTextDemoState extends State<StyledTextDemo> {
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(new MaterialApp(
|
runApp(new MaterialApp(
|
||||||
theme: new ThemeData.light(),
|
theme: new ThemeData.light(),
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
toolBar: new ToolBar(
|
toolBar: new ToolBar(
|
||||||
center: new Text('Hal and Dave')),
|
center: new Text('Hal and Dave')),
|
||||||
|
@ -28,7 +28,7 @@ class GalleryAppState extends State<GalleryApp> {
|
|||||||
title: 'Flutter Material Gallery',
|
title: 'Flutter Material Gallery',
|
||||||
theme: lightTheme ? new ThemeData.light() : new ThemeData.dark(),
|
theme: lightTheme ? new ThemeData.light() : new ThemeData.dark(),
|
||||||
routes: {
|
routes: {
|
||||||
'/': (RouteArguments args) => new GalleryHome()
|
'/': (BuildContext context) => new GalleryHome()
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -114,9 +114,9 @@ class StocksAppState extends State<StocksApp> {
|
|||||||
debugShowMaterialGrid: _configuration.debugShowGrid,
|
debugShowMaterialGrid: _configuration.debugShowGrid,
|
||||||
showPerformanceOverlay: _configuration.showPerformanceOverlay,
|
showPerformanceOverlay: _configuration.showPerformanceOverlay,
|
||||||
showSemanticsDebugger: _configuration.showSemanticsDebugger,
|
showSemanticsDebugger: _configuration.showSemanticsDebugger,
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater),
|
'/': (BuildContext context) => new StockHome(_stocks, _symbols, _configuration, configurationUpdater),
|
||||||
'/settings': (RouteArguments args) => new StockSettings(_configuration, configurationUpdater)
|
'/settings': (BuildContext context) => new StockSettings(_configuration, configurationUpdater)
|
||||||
},
|
},
|
||||||
onGenerateRoute: _getRoute,
|
onGenerateRoute: _getRoute,
|
||||||
onLocaleChanged: _onLocaleChanged
|
onLocaleChanged: _onLocaleChanged
|
||||||
|
@ -28,7 +28,7 @@ class MaterialApp extends WidgetsApp {
|
|||||||
Key key,
|
Key key,
|
||||||
String title,
|
String title,
|
||||||
ThemeData theme,
|
ThemeData theme,
|
||||||
Map<String, RouteBuilder> routes: const <String, RouteBuilder>{},
|
Map<String, WidgetBuilder> routes: const <String, WidgetBuilder>{},
|
||||||
RouteFactory onGenerateRoute,
|
RouteFactory onGenerateRoute,
|
||||||
LocaleChangedCallback onLocaleChanged,
|
LocaleChangedCallback onLocaleChanged,
|
||||||
this.debugShowMaterialGrid: false,
|
this.debugShowMaterialGrid: false,
|
||||||
@ -43,12 +43,10 @@ class MaterialApp extends WidgetsApp {
|
|||||||
color: theme?.primaryColor ?? Colors.blue[500], // blue[500] is the primary color of the default theme
|
color: theme?.primaryColor ?? Colors.blue[500], // blue[500] is the primary color of the default theme
|
||||||
routes: routes,
|
routes: routes,
|
||||||
onGenerateRoute: (RouteSettings settings) {
|
onGenerateRoute: (RouteSettings settings) {
|
||||||
RouteBuilder builder = routes[settings.name];
|
WidgetBuilder builder = routes[settings.name];
|
||||||
if (builder != null) {
|
if (builder != null) {
|
||||||
return new MaterialPageRoute<Null>(
|
return new MaterialPageRoute<Null>(
|
||||||
builder: (BuildContext context) {
|
builder: builder,
|
||||||
return builder(new RouteArguments(context: context));
|
|
||||||
},
|
|
||||||
settings: settings
|
settings: settings
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,6 @@ AssetBundle _initDefaultBundle() {
|
|||||||
|
|
||||||
final AssetBundle _defaultBundle = _initDefaultBundle();
|
final AssetBundle _defaultBundle = _initDefaultBundle();
|
||||||
|
|
||||||
class RouteArguments {
|
|
||||||
const RouteArguments({ this.context });
|
|
||||||
final BuildContext context;
|
|
||||||
}
|
|
||||||
typedef Widget RouteBuilder(RouteArguments args);
|
|
||||||
|
|
||||||
typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale);
|
typedef Future<LocaleQueryData> LocaleChangedCallback(Locale locale);
|
||||||
|
|
||||||
class WidgetsApp extends StatefulWidget {
|
class WidgetsApp extends StatefulWidget {
|
||||||
@ -42,7 +36,7 @@ class WidgetsApp extends StatefulWidget {
|
|||||||
this.title,
|
this.title,
|
||||||
this.textStyle,
|
this.textStyle,
|
||||||
this.color,
|
this.color,
|
||||||
this.routes: const <String, RouteBuilder>{},
|
this.routes: const <String, WidgetBuilder>{},
|
||||||
this.onGenerateRoute,
|
this.onGenerateRoute,
|
||||||
this.onLocaleChanged,
|
this.onLocaleChanged,
|
||||||
this.showPerformanceOverlay: false,
|
this.showPerformanceOverlay: false,
|
||||||
@ -72,7 +66,7 @@ class WidgetsApp extends StatefulWidget {
|
|||||||
/// [Navigator] is given a named route, the name will be looked up
|
/// [Navigator] is given a named route, the name will be looked up
|
||||||
/// in this table first. If the name is not available, then
|
/// in this table first. If the name is not available, then
|
||||||
/// [onGenerateRoute] will be called instead.
|
/// [onGenerateRoute] will be called instead.
|
||||||
final Map<String, RouteBuilder> routes;
|
final Map<String, WidgetBuilder> routes;
|
||||||
|
|
||||||
/// The route generator callback used when the app is navigated to a
|
/// The route generator callback used when the app is navigated to a
|
||||||
/// named route but the name is not in the [routes] table.
|
/// named route but the name is not in the [routes] table.
|
||||||
|
@ -14,8 +14,8 @@ void main() {
|
|||||||
int buildCount = 0;
|
int buildCount = 0;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
body: new Center(child: new Text('body'))
|
body: new Center(child: new Text('body'))
|
||||||
|
@ -14,9 +14,9 @@ void main() {
|
|||||||
bool showBottomSheetThenCalled = false;
|
bool showBottomSheetThenCalled = false;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext ctx) {
|
||||||
context = args.context;
|
context = ctx;
|
||||||
return new Container();
|
return new Container();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,8 +66,8 @@ void main() {
|
|||||||
bool showBottomSheetThenCalled = false;
|
bool showBottomSheetThenCalled = false;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
body: new Center(child: new Text('body'))
|
body: new Center(child: new Text('body'))
|
||||||
|
@ -12,8 +12,8 @@ void main() {
|
|||||||
List<dynamic> accepted = <dynamic>[];
|
List<dynamic> accepted = <dynamic>[];
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) { return new Column(
|
'/': (BuildContext context) { return new Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Draggable<int>(
|
new Draggable<int>(
|
||||||
data: 1,
|
data: 1,
|
||||||
@ -75,8 +75,8 @@ void main() {
|
|||||||
Point firstLocation, secondLocation;
|
Point firstLocation, secondLocation;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) { return new Column(
|
'/': (BuildContext context) { return new Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Draggable<int>(
|
new Draggable<int>(
|
||||||
data: 1,
|
data: 1,
|
||||||
@ -173,8 +173,8 @@ void main() {
|
|||||||
Point firstLocation, secondLocation;
|
Point firstLocation, secondLocation;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) { return new Column(
|
'/': (BuildContext context) { return new Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Draggable<int>(
|
new Draggable<int>(
|
||||||
data: 1,
|
data: 1,
|
||||||
@ -234,8 +234,8 @@ void main() {
|
|||||||
Point firstLocation, secondLocation;
|
Point firstLocation, secondLocation;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) { return new Column(
|
'/': (BuildContext context) { return new Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new LongPressDraggable<int>(
|
new LongPressDraggable<int>(
|
||||||
data: 1,
|
data: 1,
|
||||||
@ -285,8 +285,8 @@ void main() {
|
|||||||
Point firstLocation, secondLocation;
|
Point firstLocation, secondLocation;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) { return new Column(
|
'/': (BuildContext context) { return new Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Draggable<int>(
|
new Draggable<int>(
|
||||||
data: 1,
|
data: 1,
|
||||||
@ -337,8 +337,8 @@ void main() {
|
|||||||
Point firstLocation, secondLocation, thirdLocation;
|
Point firstLocation, secondLocation, thirdLocation;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Block(
|
return new Block(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new DragTarget<int>(
|
new DragTarget<int>(
|
||||||
@ -448,8 +448,8 @@ void main() {
|
|||||||
Point firstLocation, secondLocation, thirdLocation;
|
Point firstLocation, secondLocation, thirdLocation;
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Block(
|
return new Block(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -15,9 +15,9 @@ void main() {
|
|||||||
BuildContext context;
|
BuildContext context;
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new MaterialApp(
|
new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext ctx) {
|
||||||
context = args.context;
|
context = ctx;
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
drawer: new Text('drawer'),
|
drawer: new Text('drawer'),
|
||||||
@ -48,8 +48,8 @@ void main() {
|
|||||||
tester.pumpWidget(new Container()); // throw away the old App and its Navigator
|
tester.pumpWidget(new Container()); // throw away the old App and its Navigator
|
||||||
tester.pumpWidget(
|
tester.pumpWidget(
|
||||||
new MaterialApp(
|
new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
drawer: new Text('drawer'),
|
drawer: new Text('drawer'),
|
||||||
|
@ -12,21 +12,21 @@ Key firstKey = new Key('first');
|
|||||||
Key secondKey = new Key('second');
|
Key secondKey = new Key('second');
|
||||||
Key thirdKey = new Key('third');
|
Key thirdKey = new Key('third');
|
||||||
|
|
||||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new Material(
|
'/': (BuildContext context) => new Material(
|
||||||
child: new Block(children: <Widget>[
|
child: new Block(children: <Widget>[
|
||||||
new Container(height: 100.0, width: 100.0),
|
new Container(height: 100.0, width: 100.0),
|
||||||
new Card(child: new Hero(tag: 'a', child: new Container(height: 100.0, width: 100.0, key: firstKey))),
|
new Card(child: new Hero(tag: 'a', child: new Container(height: 100.0, width: 100.0, key: firstKey))),
|
||||||
new Container(height: 100.0, width: 100.0),
|
new Container(height: 100.0, width: 100.0),
|
||||||
new FlatButton(child: new Text('two'), onPressed: () => Navigator.pushNamed(args.context, '/two')),
|
new FlatButton(child: new Text('two'), onPressed: () => Navigator.pushNamed(context, '/two')),
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
'/two': (RouteArguments args) => new Material(
|
'/two': (BuildContext context) => new Material(
|
||||||
child: new Block(children: <Widget>[
|
child: new Block(children: <Widget>[
|
||||||
new Container(height: 150.0, width: 150.0),
|
new Container(height: 150.0, width: 150.0),
|
||||||
new Card(child: new Hero(tag: 'a', child: new Container(height: 150.0, width: 150.0, key: secondKey))),
|
new Card(child: new Hero(tag: 'a', child: new Container(height: 150.0, width: 150.0, key: secondKey))),
|
||||||
new Container(height: 150.0, width: 150.0),
|
new Container(height: 150.0, width: 150.0),
|
||||||
new FlatButton(child: new Text('three'), onPressed: () => Navigator.push(args.context, new ThreeRoute())),
|
new FlatButton(child: new Text('three'), onPressed: () => Navigator.push(context, new ThreeRoute())),
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
@ -61,9 +61,9 @@ void main() {
|
|||||||
|
|
||||||
test('ModalBarrier pops the Navigator when dismissed', () {
|
test('ModalBarrier pops the Navigator when dismissed', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new FirstWidget(),
|
'/': (BuildContext context) => new FirstWidget(),
|
||||||
'/modal': (RouteArguments args) => new SecondWidget(),
|
'/modal': (BuildContext context) => new SecondWidget(),
|
||||||
};
|
};
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(routes: routes));
|
tester.pumpWidget(new MaterialApp(routes: routes));
|
||||||
|
@ -66,9 +66,9 @@ class ThirdWidget extends StatelessWidget {
|
|||||||
void main() {
|
void main() {
|
||||||
test('Can navigator navigate to and from a stateful widget', () {
|
test('Can navigator navigate to and from a stateful widget', () {
|
||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new FirstWidget(),
|
'/': (BuildContext context) => new FirstWidget(),
|
||||||
'/second': (RouteArguments args) => new SecondWidget(),
|
'/second': (BuildContext context) => new SecondWidget(),
|
||||||
};
|
};
|
||||||
|
|
||||||
tester.pumpWidget(new MaterialApp(routes: routes));
|
tester.pumpWidget(new MaterialApp(routes: routes));
|
||||||
|
@ -18,7 +18,7 @@ void main() {
|
|||||||
testWidgets((WidgetTester tester) {
|
testWidgets((WidgetTester tester) {
|
||||||
GlobalKey containerKey1 = new GlobalKey();
|
GlobalKey containerKey1 = new GlobalKey();
|
||||||
GlobalKey containerKey2 = new GlobalKey();
|
GlobalKey containerKey2 = new GlobalKey();
|
||||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||||
'/': (_) => new Container(key: containerKey1, child: new Text('Home')),
|
'/': (_) => new Container(key: containerKey1, child: new Text('Home')),
|
||||||
'/settings': (_) => new Container(key: containerKey2, child: new Text('Settings')),
|
'/settings': (_) => new Container(key: containerKey2, child: new Text('Settings')),
|
||||||
};
|
};
|
||||||
|
@ -12,8 +12,8 @@ void main() {
|
|||||||
String helloSnackBar = 'Hello SnackBar';
|
String helloSnackBar = 'Hello SnackBar';
|
||||||
Key tapTarget = new Key('tap-target');
|
Key tapTarget = new Key('tap-target');
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
body: new Builder(
|
body: new Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -63,8 +63,8 @@ void main() {
|
|||||||
int snackBarCount = 0;
|
int snackBarCount = 0;
|
||||||
Key tapTarget = new Key('tap-target');
|
Key tapTarget = new Key('tap-target');
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
body: new Builder(
|
body: new Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
@ -146,8 +146,8 @@ void main() {
|
|||||||
int time;
|
int time;
|
||||||
ScaffoldFeatureController<SnackBar, Null> lastController;
|
ScaffoldFeatureController<SnackBar, Null> lastController;
|
||||||
tester.pumpWidget(new MaterialApp(
|
tester.pumpWidget(new MaterialApp(
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) {
|
'/': (BuildContext context) {
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
body: new Builder(
|
body: new Builder(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -13,7 +13,7 @@ void main() {
|
|||||||
final Key sublistKey = new UniqueKey();
|
final Key sublistKey = new UniqueKey();
|
||||||
final Key bottomKey = new UniqueKey();
|
final Key bottomKey = new UniqueKey();
|
||||||
|
|
||||||
final Map<String, RouteBuilder> routes = <String, RouteBuilder>{
|
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
|
||||||
'/': (_) {
|
'/': (_) {
|
||||||
return new Material(
|
return new Material(
|
||||||
child: new Viewport(
|
child: new Viewport(
|
||||||
|
@ -29,8 +29,8 @@ Enjoy!
|
|||||||
void main() {
|
void main() {
|
||||||
runApp(new MaterialApp(
|
runApp(new MaterialApp(
|
||||||
title: "Markdown Demo",
|
title: "Markdown Demo",
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new Scaffold(
|
'/': (BuildContext context) => new Scaffold(
|
||||||
toolBar: new ToolBar(center: new Text("Markdown Demo")),
|
toolBar: new ToolBar(center: new Text("Markdown Demo")),
|
||||||
body: new Markdown(data: _kMarkdownData)
|
body: new Markdown(data: _kMarkdownData)
|
||||||
)
|
)
|
||||||
|
@ -12,8 +12,8 @@ void main() {
|
|||||||
runApp(
|
runApp(
|
||||||
new MaterialApp(
|
new MaterialApp(
|
||||||
title: 'Flutter Demo',
|
title: 'Flutter Demo',
|
||||||
routes: <String, RouteBuilder>{
|
routes: <String, WidgetBuilder>{
|
||||||
'/': (RouteArguments args) => new FlutterDemo()
|
'/': (BuildContext context) => new FlutterDemo()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user