Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: sky/examples/widgets/navigation.dart

Issue 1191153002: Make back button control drawer in stocks app (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: abarth feedback Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/examples/stocks2/lib/stock_home.dart ('k') | sky/sdk/lib/widgets/drawer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'package:sky/widgets/basic.dart'; 5 import 'package:sky/widgets/basic.dart';
6 import 'package:sky/widgets/navigator.dart'; 6 import 'package:sky/widgets/navigator.dart';
7 import 'package:sky/widgets/transition.dart';
8 import 'package:sky/widgets/raised_button.dart'; 7 import 'package:sky/widgets/raised_button.dart';
9 8
10 List<Route> routes = [ 9 List<Route> routes = [
11 new Route( 10 new Route(
12 name: 'home', 11 name: 'home',
13 builder: (navigator) => new Container( 12 builder: (navigator, route) => new Container(
14 padding: const EdgeDims.all(20.0), 13 padding: const EdgeDims.all(20.0),
15 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), 14 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
16 child: new Block([ 15 child: new Block([
17 new Text("You are at home"), 16 new Text("You are at home"),
18 new RaisedButton( 17 new RaisedButton(
19 child: new Text('GO SHOPPING'), 18 child: new Text('GO SHOPPING'),
20 onPressed: () => navigator.pushNamed('shopping') 19 onPressed: () => navigator.pushNamed('shopping')
21 ), 20 ),
22 new RaisedButton( 21 new RaisedButton(
23 child: new Text('START ADVENTURE'), 22 child: new Text('START ADVENTURE'),
24 onPressed: () => navigator.pushNamed('adventure') 23 onPressed: () => navigator.pushNamed('adventure')
25 ) 24 )
26 ]) 25 ])
27 ) 26 )
28 ), 27 ),
29 new Route( 28 new Route(
30 name: 'shopping', 29 name: 'shopping',
31 builder: (navigator) => new Container( 30 builder: (navigator, route) => new Container(
32 padding: const EdgeDims.all(20.0), 31 padding: const EdgeDims.all(20.0),
33 decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)), 32 decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
34 child: new Block([ 33 child: new Block([
35 new Text("Village Shop"), 34 new Text("Village Shop"),
36 new RaisedButton( 35 new RaisedButton(
37 child: new Text('RETURN HOME'), 36 child: new Text('RETURN HOME'),
38 onPressed: () => navigator.back() 37 onPressed: () => navigator.pop()
39 ), 38 ),
40 new RaisedButton( 39 new RaisedButton(
41 child: new Text('GO TO DUNGEON'), 40 child: new Text('GO TO DUNGEON'),
42 onPressed: () => navigator.push(routes[2]) 41 onPressed: () => navigator.push(routes[2])
43 ) 42 )
44 ]) 43 ])
45 ) 44 )
46 ), 45 ),
47 new Route( 46 new Route(
48 name: 'adventure', 47 name: 'adventure',
49 builder: (navigator) => new Container( 48 builder: (navigator, route) => new Container(
50 padding: const EdgeDims.all(20.0), 49 padding: const EdgeDims.all(20.0),
51 decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)), 50 decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
52 child: new Block([ 51 child: new Block([
53 new Text("Monster's Lair"), 52 new Text("Monster's Lair"),
54 new RaisedButton( 53 new RaisedButton(
55 child: new Text('NO WAIT! GO BACK!'), 54 child: new Text('NO WAIT! GO BACK!'),
56 onPressed: () => navigator.pop() 55 onPressed: () => navigator.pop()
57 ) 56 )
58 ]) 57 ])
59 ) 58 )
60 ) 59 )
61 ]; 60 ];
62 61
63 class NavigationExampleApp extends App { 62 class NavigationExampleApp extends App {
64 NavigationState _navState = new NavigationState(routes); 63 NavigationState _navState = new NavigationState(routes);
65 64
66 Widget build() { 65 Widget build() {
67 return new Flex([new Navigator(_navState)]); 66 return new Flex([new Navigator(_navState)]);
68 } 67 }
69 } 68 }
70 69
71 void main() { 70 void main() {
72 runApp(new NavigationExampleApp()); 71 runApp(new NavigationExampleApp());
73 } 72 }
OLDNEW
« no previous file with comments | « sky/examples/stocks2/lib/stock_home.dart ('k') | sky/sdk/lib/widgets/drawer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698