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

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

Issue 1194743003: Add a new Theme widget to control color and text color of apps (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase 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/checkbox.dart ('k') | sky/sdk/lib/widgets/theme.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 '../theme/view_configuration.dart'; 7 import '../theme/view_configuration.dart';
8 import 'widget.dart'; 8 import 'widget.dart';
9 9
10 enum ScaffoldSlots { 10 enum ScaffoldSlots {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 Widget _toolbar; 175 Widget _toolbar;
176 Widget _body; 176 Widget _body;
177 Widget _statusBar; 177 Widget _statusBar;
178 Widget _drawer; 178 Widget _drawer;
179 Widget _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 walkChildren(WidgetTreeWalker walker) {
185 if (_toolbar != null)
186 walker(_toolbar);
187 if (_body != null)
188 walker(_body);
189 if (_statusBar != null)
190 walker(_statusBar);
191 if (_drawer != null)
192 walker(_drawer);
193 if (_floatingActionButton != null)
194 walker(_floatingActionButton);
195 }
196
184 void insertChildRoot(RenderObjectWrapper child, ScaffoldSlots slot) { 197 void insertChildRoot(RenderObjectWrapper child, ScaffoldSlots slot) {
185 root[slot] = child != null ? child.root : null; 198 root[slot] = child != null ? child.root : null;
186 } 199 }
187 200
188 void detachChildRoot(RenderObjectWrapper child) { 201 void detachChildRoot(RenderObjectWrapper child) {
189 final root = this.root; // TODO(ianh): Remove this once the analyzer is clev erer 202 final root = this.root; // TODO(ianh): Remove this once the analyzer is clev erer
190 assert(root is RenderScaffold); 203 assert(root is RenderScaffold);
191 assert(root == child.root.parent); 204 assert(root == child.root.parent);
192 root.remove(child.root); 205 root.remove(child.root);
193 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c leverer 206 assert(root == this.root); // TODO(ianh): Remove this once the analyzer is c leverer
194 } 207 }
195 208
196 void remove() { 209 void remove() {
197 if (_toolbar != null) 210 walkChildren((Widget child) => removeChild(child));
198 removeChild(_toolbar);
199 if (_body != null)
200 removeChild(_body);
201 if (_statusBar != null)
202 removeChild(_statusBar);
203 if (_drawer != null)
204 removeChild(_drawer);
205 if (_floatingActionButton != null)
206 removeChild(_floatingActionButton);
207 super.remove(); 211 super.remove();
208 } 212 }
209 213
210 void syncRenderObject(Widget old) { 214 void syncRenderObject(Widget old) {
211 super.syncRenderObject(old); 215 super.syncRenderObject(old);
212 _toolbar = syncChild(_toolbar, old is Scaffold ? old._toolbar : null, Scaffo ldSlots.toolbar); 216 _toolbar = syncChild(_toolbar, old is Scaffold ? old._toolbar : null, Scaffo ldSlots.toolbar);
213 _body = syncChild(_body, old is Scaffold ? old._body : null, ScaffoldSlots.b ody); 217 _body = syncChild(_body, old is Scaffold ? old._body : null, ScaffoldSlots.b ody);
214 _statusBar = syncChild(_statusBar, old is Scaffold ? old._statusBar : null, ScaffoldSlots.statusBar); 218 _statusBar = syncChild(_statusBar, old is Scaffold ? old._statusBar : null, ScaffoldSlots.statusBar);
215 _drawer = syncChild(_drawer, old is Scaffold ? old._drawer : null, ScaffoldS lots.drawer); 219 _drawer = syncChild(_drawer, old is Scaffold ? old._drawer : null, ScaffoldS lots.drawer);
216 _floatingActionButton = syncChild(_floatingActionButton, old is Scaffold ? o ld._floatingActionButton : null, ScaffoldSlots.floatingActionButton); 220 _floatingActionButton = syncChild(_floatingActionButton, old is Scaffold ? o ld._floatingActionButton : null, ScaffoldSlots.floatingActionButton);
217 } 221 }
218 222
219 } 223 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/checkbox.dart ('k') | sky/sdk/lib/widgets/theme.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698