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

Side by Side Diff: sky/sdk/lib/widgets/navigator.dart

Issue 1190793002: Rename UINode to Widget. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 | « sky/sdk/lib/widgets/modal_overlay.dart ('k') | sky/sdk/lib/widgets/popup_menu.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 'basic.dart'; 5 import 'basic.dart';
6 6
7 typedef UINode Builder(Navigator navigator); 7 typedef Widget Builder(Navigator navigator);
8 8
9 abstract class RouteBase { 9 abstract class RouteBase {
10 RouteBase({this.name}); 10 RouteBase({this.name});
11 final String name; 11 final String name;
12 UINode build(Navigator navigator); 12 Widget build(Navigator navigator);
13 } 13 }
14 14
15 class Route extends RouteBase { 15 class Route extends RouteBase {
16 Route({String name, this.builder}) : super(name: name); 16 Route({String name, this.builder}) : super(name: name);
17 final Builder builder; 17 final Builder builder;
18 UINode build(Navigator navigator) => builder(navigator); 18 Widget build(Navigator navigator) => builder(navigator);
19 } 19 }
20 20
21 class Navigator extends Component { 21 class Navigator extends Component {
22 Navigator({Object key, this.currentRoute, this.routes}) 22 Navigator({Object key, this.currentRoute, this.routes})
23 : super(key: key, stateful: true); 23 : super(key: key, stateful: true);
24 24
25 RouteBase currentRoute; 25 RouteBase currentRoute;
26 List<RouteBase> routes; 26 List<RouteBase> routes;
27 27
28 void syncFields(Navigator source) { 28 void syncFields(Navigator source) {
(...skipping 13 matching lines...) Expand all
42 } 42 }
43 assert(false); // route not found 43 assert(false); // route not found
44 } 44 }
45 45
46 void pushRoute(RouteBase route) { 46 void pushRoute(RouteBase route) {
47 setState(() { 47 setState(() {
48 currentRoute = route; 48 currentRoute = route;
49 }); 49 });
50 } 50 }
51 51
52 UINode build() { 52 Widget build() {
53 Route route = currentRoute == null ? routes[0] : currentRoute; 53 Route route = currentRoute == null ? routes[0] : currentRoute;
54 assert(route != null); 54 assert(route != null);
55 return route.build(this); 55 return route.build(this);
56 } 56 }
57 } 57 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/modal_overlay.dart ('k') | sky/sdk/lib/widgets/popup_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698