| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |