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

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

Issue 1181773006: Add back/forward history to navigation (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase 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 | « no previous file | sky/sdk/lib/widgets/navigator.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';
7 import 'package:sky/widgets/raised_button.dart'; 8 import 'package:sky/widgets/raised_button.dart';
8 9
9 List<Route> routes = [ 10 List<Route> routes = [
10 new Route( 11 new Route(
11 name: 'safety', 12 name: 'home',
12 builder: (navigator) => new RaisedButton( 13 builder: (navigator) => new Container(
13 child: new Text('PRESS FORWARD'), 14 padding: const EdgeDims.all(20.0),
14 onPressed: () => navigator.pushNamedRoute('adventure') 15 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
16 child: new Block([
17 new Text("You are at home"),
18 new RaisedButton(
19 key: 'b',
20 child: new Text('GO SHOPPING'),
21 onPressed: () => navigator.pushNamed('shopping')
22 ),
23 new RaisedButton(
24 key: 'a',
25 child: new Text('START ADVENTURE'),
26 onPressed: () => navigator.pushNamed('adventure')
27 )
28 ])
29 )
30 ),
31 new Route(
32 name: 'shopping',
33 builder: (navigator) => new Container(
34 padding: const EdgeDims.all(20.0),
35 decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
36 child: new Block([
37 new Text("Village Shop"),
38 new RaisedButton(
39 key: 'a',
40 child: new Text('RETURN HOME'),
41 onPressed: () => navigator.back()
42 ),
43 new RaisedButton(
44 key: 'b',
45 child: new Text('GO TO DUNGEON'),
46 onPressed: () => navigator.push(routes[2])
47 )
48 ])
15 ) 49 )
16 ), 50 ),
17 new Route( 51 new Route(
18 name: 'adventure', 52 name: 'adventure',
19 builder: (navigator) => new RaisedButton( 53 builder: (navigator) => new Container(
20 child: new Text('NO WAIT! GO BACK!'), 54 padding: const EdgeDims.all(20.0),
21 onPressed: () => navigator.pushRoute(routes[0]) 55 decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
56 child: new Block([
57 new Text("Monster's Lair"),
58 new RaisedButton(
59 child: new Text('NO WAIT! GO BACK!'),
60 onPressed: () => navigator.pop()
61 )
62 ])
22 ) 63 )
23 ) 64 )
24 ]; 65 ];
25 66
26 class NavigationExampleApp extends App { 67 class NavigationExampleApp extends App {
27 UINode build() { 68 Widget build() {
28 return new Navigator(routes: routes); 69 return new Flex([new Navigator(routes: routes)]);
29 } 70 }
30 } 71 }
31 72
32 void main() { 73 void main() {
33 App app = new NavigationExampleApp(); 74 App app = new NavigationExampleApp();
34 } 75 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/widgets/navigator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698