From 5505a200ce0a37b66f9ace112b66fbf9ec922a72 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Tue, 16 Jun 2015 09:47:57 -0700 Subject: [PATCH] Simple support for routing in Sky R=abarth@chromium.org, abarth, hixie Review URL: https://codereview.chromium.org/1186273002. --- examples/raw/navigation.dart | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 examples/raw/navigation.dart diff --git a/examples/raw/navigation.dart b/examples/raw/navigation.dart new file mode 100644 index 0000000000..86b1dfe470 --- /dev/null +++ b/examples/raw/navigation.dart @@ -0,0 +1,34 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// 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 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(); +}