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

Unified Diff: sky/examples/raw/navigation.dart

Issue 1186273002: Simple support for routing in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: CR feedback from abarth 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/BUILD.gn » ('j') | sky/sdk/lib/widgets/navigator.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/raw/navigation.dart
diff --git a/sky/examples/raw/navigation.dart b/sky/examples/raw/navigation.dart
new file mode 100644
index 0000000000000000000000000000000000000000..86b1dfe4708b8d864b5f67f89829039e8edd85ec
--- /dev/null
+++ b/sky/examples/raw/navigation.dart
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
Hixie 2015/06/16 16:55:09 This example should be in examples/widgets.
jackson 2015/06/16 18:27:27 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:sky/widgets/basic.dart';
+import 'package:sky/widgets/navigator.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')
+ )
+ ),
+ new Route(
+ name: 'adventure',
+ builder: (navigator) => new RaisedButton(
+ child: new Text('NO WAIT! GO BACK!'),
+ onPressed: () => navigator.pushRoute(routes[0])
+ )
+ )
+];
+
+class NavigationExampleApp extends App {
+ UINode build() {
+ return new Navigator(routes: routes);
+ }
+}
+
+void main() {
+ App app = new NavigationExampleApp();
+}
« no previous file with comments | « no previous file | sky/sdk/BUILD.gn » ('j') | sky/sdk/lib/widgets/navigator.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698