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

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

Issue 1182463007: Re-wire up the back button (Closed) Base URL: git@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 | « no previous file | sky/sdk/lib/widgets/widget.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 Widget 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 });
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 assert(historyIndex < history.length); 66 assert(historyIndex < history.length);
67 } 67 }
68 } 68 }
69 69
70 class Navigator extends Component { 70 class Navigator extends Component {
71 71
72 Navigator(this.state, { String key }) : super(key: key); 72 Navigator(this.state, { String key }) : super(key: key);
73 73
74 NavigationState state; 74 NavigationState state;
75 75
76 void syncFields(Navigator source) {
77 state = source.state;
78 }
79
76 void pushNamed(String name) { 80 void pushNamed(String name) {
77 setState(() { 81 setState(() {
78 state.pushNamed(name); 82 state.pushNamed(name);
79 }); 83 });
80 } 84 }
81 85
82 void push(RouteBase route) { 86 void push(RouteBase route) {
83 setState(() { 87 setState(() {
84 state.push(route); 88 state.push(route);
85 }); 89 });
(...skipping 14 matching lines...) Expand all
100 void forward() { 104 void forward() {
101 setState(() { 105 setState(() {
102 state.forward(); 106 state.forward();
103 }); 107 });
104 } 108 }
105 109
106 Widget build() { 110 Widget build() {
107 return state.currentRoute.build(this); 111 return state.currentRoute.build(this);
108 } 112 }
109 } 113 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/widgets/widget.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698