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

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

Issue 1226113007: Add @override annotation to known overriden methods (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 Widget Builder(Navigator navigator, RouteBase route); 7 typedef Widget Builder(Navigator navigator, RouteBase route);
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 Widget build(Navigator navigator, RouteBase route); 12 Widget build(Navigator navigator, RouteBase route);
13 void popState() { } 13 void popState() { }
14 } 14 }
15 15
16 class Route extends RouteBase { 16 class Route extends RouteBase {
17 Route({ String name, this.builder }) : super(name: name); 17 Route({ String name, this.builder }) : super(name: name);
18 final Builder builder; 18 final Builder builder;
19
20 @override
19 Widget build(Navigator navigator, RouteBase route) => builder(navigator, route ); 21 Widget build(Navigator navigator, RouteBase route) => builder(navigator, route );
20 } 22 }
21 23
22 class RouteState extends RouteBase { 24 class RouteState extends RouteBase {
23 25
24 RouteState({this.callback, this.route, String name}) : super(name: name); 26 RouteState({this.callback, this.route, String name}) : super(name: name);
25 27
26 RouteBase route; 28 RouteBase route;
27 Function callback; 29 Function callback;
28 30
31 @override
29 Widget build(Navigator navigator, _) => route.build(navigator, this); 32 Widget build(Navigator navigator, _) => route.build(navigator, this);
30 33
34 @override
31 void popState() { 35 void popState() {
32 if (callback != null) 36 if (callback != null)
33 callback(this); 37 callback(this);
34 } 38 }
35 } 39 }
36 40
37 class NavigationState { 41 class NavigationState {
38 42
39 NavigationState(List<Route> routes) { 43 NavigationState(List<Route> routes) {
40 for (Route route in routes) { 44 for (Route route in routes) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 77 }
74 } 78 }
75 } 79 }
76 80
77 class Navigator extends StatefulComponent { 81 class Navigator extends StatefulComponent {
78 82
79 Navigator(this.state, { String key }) : super(key: key); 83 Navigator(this.state, { String key }) : super(key: key);
80 84
81 NavigationState state; 85 NavigationState state;
82 86
87 @override
83 void syncFields(Navigator source) { 88 void syncFields(Navigator source) {
84 state = source.state; 89 state = source.state;
85 } 90 }
86 91
87 RouteBase get currentRoute => state.currentRoute; 92 RouteBase get currentRoute => state.currentRoute;
88 93
89 void pushState(String name, Function callback) { 94 void pushState(String name, Function callback) {
90 RouteBase route = new RouteState( 95 RouteBase route = new RouteState(
91 name: name, 96 name: name,
92 callback: callback, 97 callback: callback,
(...skipping 13 matching lines...) Expand all
106 state.push(route); 111 state.push(route);
107 }); 112 });
108 } 113 }
109 114
110 void pop() { 115 void pop() {
111 setState(() { 116 setState(() {
112 state.pop(); 117 state.pop();
113 }); 118 });
114 } 119 }
115 120
121 @override
116 Widget build() { 122 Widget build() {
117 return state.currentRoute.build(this, state.currentRoute); 123 return state.currentRoute.build(this, state.currentRoute);
118 } 124 }
119 } 125 }
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