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

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

Issue 1218593002: Move sky/examples to sky/sdk/lib/example, and code changes to support that change. Fixes T277. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 import 'package:sky/widgets/basic.dart';
6 import 'package:sky/widgets/navigator.dart';
7 import 'package:sky/widgets/raised_button.dart';
8
9 List<Route> routes = [
10 new Route(
11 name: 'home',
12 builder: (navigator, route) => new Container(
13 padding: const EdgeDims.all(20.0),
14 decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
15 child: new Block([
16 new Text("You are at home"),
17 new RaisedButton(
18 child: new Text('GO SHOPPING'),
19 onPressed: () => navigator.pushNamed('shopping')
20 ),
21 new RaisedButton(
22 child: new Text('START ADVENTURE'),
23 onPressed: () => navigator.pushNamed('adventure')
24 )
25 ])
26 )
27 ),
28 new Route(
29 name: 'shopping',
30 builder: (navigator, route) => new Container(
31 padding: const EdgeDims.all(20.0),
32 decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
33 child: new Block([
34 new Text("Village Shop"),
35 new RaisedButton(
36 child: new Text('RETURN HOME'),
37 onPressed: () => navigator.pop()
38 ),
39 new RaisedButton(
40 child: new Text('GO TO DUNGEON'),
41 onPressed: () => navigator.push(routes[2])
42 )
43 ])
44 )
45 ),
46 new Route(
47 name: 'adventure',
48 builder: (navigator, route) => new Container(
49 padding: const EdgeDims.all(20.0),
50 decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
51 child: new Block([
52 new Text("Monster's Lair"),
53 new RaisedButton(
54 child: new Text('NO WAIT! GO BACK!'),
55 onPressed: () => navigator.pop()
56 )
57 ])
58 )
59 )
60 ];
61
62 class NavigationExampleApp extends App {
63 NavigationState _navState = new NavigationState(routes);
64
65 Widget build() {
66 return new Flex([new Navigator(_navState)]);
67 }
68 }
69
70 void main() {
71 runApp(new NavigationExampleApp());
72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698