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

Side by Side Diff: sky/sdk/lib/widgets/scaffold.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/raised_button.dart ('k') | sky/sdk/lib/widgets/scrollable.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 '../rendering/box.dart'; 5 import '../rendering/box.dart';
6 import '../rendering/object.dart'; 6 import '../rendering/object.dart';
7 import '../theme2/view_configuration.dart'; 7 import '../theme2/view_configuration.dart';
8 import 'ui_node.dart'; 8 import 'widget.dart';
9 9
10 enum ScaffoldSlots { 10 enum ScaffoldSlots {
11 toolbar, 11 toolbar,
12 body, 12 body,
13 statusBar, 13 statusBar,
14 drawer, 14 drawer,
15 floatingActionButton 15 floatingActionButton
16 } 16 }
17 17
18 class RenderScaffold extends RenderBox { 18 class RenderScaffold extends RenderBox {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 154
155 class Scaffold extends RenderObjectWrapper { 155 class Scaffold extends RenderObjectWrapper {
156 156
157 // static final Style _style = new Style(''' 157 // static final Style _style = new Style('''
158 // ${typography.typeface}; 158 // ${typography.typeface};
159 // ${typography.black.body1};'''); 159 // ${typography.black.body1};''');
160 160
161 Scaffold({ 161 Scaffold({
162 String key, 162 String key,
163 UINode toolbar, 163 Widget toolbar,
164 UINode body, 164 Widget body,
165 UINode statusBar, 165 Widget statusBar,
166 UINode drawer, 166 Widget drawer,
167 UINode floatingActionButton 167 Widget floatingActionButton
168 }) : _toolbar = toolbar, 168 }) : _toolbar = toolbar,
169 _body = body, 169 _body = body,
170 _statusBar = statusBar, 170 _statusBar = statusBar,
171 _drawer = drawer, 171 _drawer = drawer,
172 _floatingActionButton = floatingActionButton, 172 _floatingActionButton = floatingActionButton,
173 super(key: key); 173 super(key: key);
174 174
175 UINode _toolbar; 175 Widget _toolbar;
176 UINode _body; 176 Widget _body;
177 UINode _statusBar; 177 Widget _statusBar;
178 UINode _drawer; 178 Widget _drawer;
179 UINode _floatingActionButton; 179 Widget _floatingActionButton;
180 180
181 RenderScaffold get root => super.root; 181 RenderScaffold get root => super.root;
182 RenderScaffold createNode() => new RenderScaffold(); 182 RenderScaffold createNode() => new RenderScaffold();
183 183
184 void insert(RenderObjectWrapper child, ScaffoldSlots slot) { 184 void insert(RenderObjectWrapper child, ScaffoldSlots slot) {
185 root[slot] = child != null ? child.root : null; 185 root[slot] = child != null ? child.root : null;
186 } 186 }
187 187
188 void removeChild(UINode node) { 188 void removeChild(Widget node) {
189 assert(node != null); 189 assert(node != null);
190 root.remove(node.root); 190 root.remove(node.root);
191 super.removeChild(node); 191 super.removeChild(node);
192 } 192 }
193 193
194 void remove() { 194 void remove() {
195 if (_toolbar != null) 195 if (_toolbar != null)
196 removeChild(_toolbar); 196 removeChild(_toolbar);
197 if (_body != null) 197 if (_body != null)
198 removeChild(_body); 198 removeChild(_body);
199 if (_statusBar != null) 199 if (_statusBar != null)
200 removeChild(_statusBar); 200 removeChild(_statusBar);
201 if (_drawer != null) 201 if (_drawer != null)
202 removeChild(_drawer); 202 removeChild(_drawer);
203 if (_floatingActionButton != null) 203 if (_floatingActionButton != null)
204 removeChild(_floatingActionButton); 204 removeChild(_floatingActionButton);
205 super.remove(); 205 super.remove();
206 } 206 }
207 207
208 void syncRenderObject(UINode old) { 208 void syncRenderObject(Widget old) {
209 super.syncRenderObject(old); 209 super.syncRenderObject(old);
210 _toolbar = syncChild(_toolbar, old is Scaffold ? old._toolbar : null, Scaffo ldSlots.toolbar); 210 _toolbar = syncChild(_toolbar, old is Scaffold ? old._toolbar : null, Scaffo ldSlots.toolbar);
211 _body = syncChild(_body, old is Scaffold ? old._body : null, ScaffoldSlots.b ody); 211 _body = syncChild(_body, old is Scaffold ? old._body : null, ScaffoldSlots.b ody);
212 _statusBar = syncChild(_statusBar, old is Scaffold ? old._statusBar : null, ScaffoldSlots.statusBar); 212 _statusBar = syncChild(_statusBar, old is Scaffold ? old._statusBar : null, ScaffoldSlots.statusBar);
213 _drawer = syncChild(_drawer, old is Scaffold ? old._drawer : null, ScaffoldS lots.drawer); 213 _drawer = syncChild(_drawer, old is Scaffold ? old._drawer : null, ScaffoldS lots.drawer);
214 _floatingActionButton = syncChild(_floatingActionButton, old is Scaffold ? o ld._floatingActionButton : null, ScaffoldSlots.floatingActionButton); 214 _floatingActionButton = syncChild(_floatingActionButton, old is Scaffold ? o ld._floatingActionButton : null, ScaffoldSlots.floatingActionButton);
215 } 215 }
216 216
217 } 217 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/raised_button.dart ('k') | sky/sdk/lib/widgets/scrollable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698