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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/widgets/navigator.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/widgets/navigation.dart
diff --git a/sky/examples/widgets/navigation.dart b/sky/examples/widgets/navigation.dart
index 86b1dfe4708b8d864b5f67f89829039e8edd85ec..ca81a4fbd79721b53072a57450d499e1d4defa90 100644
--- a/sky/examples/widgets/navigation.dart
+++ b/sky/examples/widgets/navigation.dart
@@ -4,28 +4,69 @@
import 'package:sky/widgets/basic.dart';
import 'package:sky/widgets/navigator.dart';
+import 'package:sky/widgets/transition.dart';
import 'package:sky/widgets/raised_button.dart';
List<Route> routes = [
new Route(
- name: 'safety',
- builder: (navigator) => new RaisedButton(
- child: new Text('PRESS FORWARD'),
- onPressed: () => navigator.pushNamedRoute('adventure')
+ name: 'home',
+ builder: (navigator) => new Container(
+ padding: const EdgeDims.all(20.0),
+ decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)),
+ child: new Block([
+ new Text("You are at home"),
+ new RaisedButton(
+ key: 'b',
+ child: new Text('GO SHOPPING'),
+ onPressed: () => navigator.pushNamed('shopping')
+ ),
+ new RaisedButton(
+ key: 'a',
+ child: new Text('START ADVENTURE'),
+ onPressed: () => navigator.pushNamed('adventure')
+ )
+ ])
+ )
+ ),
+ new Route(
+ name: 'shopping',
+ builder: (navigator) => new Container(
+ padding: const EdgeDims.all(20.0),
+ decoration: new BoxDecoration(backgroundColor: const Color(0xFFBF5FFF)),
+ child: new Block([
+ new Text("Village Shop"),
+ new RaisedButton(
+ key: 'a',
+ child: new Text('RETURN HOME'),
+ onPressed: () => navigator.back()
+ ),
+ new RaisedButton(
+ key: 'b',
+ child: new Text('GO TO DUNGEON'),
+ onPressed: () => navigator.push(routes[2])
+ )
+ ])
)
),
new Route(
name: 'adventure',
- builder: (navigator) => new RaisedButton(
- child: new Text('NO WAIT! GO BACK!'),
- onPressed: () => navigator.pushRoute(routes[0])
+ builder: (navigator) => new Container(
+ padding: const EdgeDims.all(20.0),
+ decoration: new BoxDecoration(backgroundColor: const Color(0xFFDC143C)),
+ child: new Block([
+ new Text("Monster's Lair"),
+ new RaisedButton(
+ child: new Text('NO WAIT! GO BACK!'),
+ onPressed: () => navigator.pop()
+ )
+ ])
)
)
];
class NavigationExampleApp extends App {
- UINode build() {
- return new Navigator(routes: routes);
+ Widget build() {
+ return new Flex([new Navigator(routes: routes)]);
}
}
« 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