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 '../fn2.dart'; | 5 import '../fn2.dart'; |
6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
7 import '../rendering/box.dart'; | 7 import '../rendering/box.dart'; |
8 import '../rendering/object.dart'; | 8 import '../rendering/object.dart'; |
9 | 9 |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 if (old == value) | 39 if (old == value) |
40 return; | 40 return; |
41 if (old != null) | 41 if (old != null) |
42 dropChild(old); | 42 dropChild(old); |
43 _slots[slot] = value; | 43 _slots[slot] = value; |
44 if (value != null) | 44 if (value != null) |
45 adoptChild(value); | 45 adoptChild(value); |
46 markNeedsLayout(); | 46 markNeedsLayout(); |
47 } | 47 } |
48 | 48 |
| 49 void attachChildren() { |
| 50 for (ScaffoldSlots slot in [ScaffoldSlots.body, ScaffoldSlots.statusBar, Sca
ffoldSlots.toolbar, ScaffoldSlots.floatingActionButton, ScaffoldSlots.drawer]) { |
| 51 RenderBox box = _slots[slot]; |
| 52 if (box != null) |
| 53 box.attach(); |
| 54 } |
| 55 } |
| 56 |
| 57 void detachChildren() { |
| 58 for (ScaffoldSlots slot in [ScaffoldSlots.body, ScaffoldSlots.statusBar, Sca
ffoldSlots.toolbar, ScaffoldSlots.floatingActionButton, ScaffoldSlots.drawer]) { |
| 59 RenderBox box = _slots[slot]; |
| 60 if (box != null) |
| 61 box.detach(); |
| 62 } |
| 63 } |
| 64 |
49 ScaffoldSlots remove(RenderBox child) { | 65 ScaffoldSlots remove(RenderBox child) { |
50 assert(child != null); | 66 assert(child != null); |
51 for (ScaffoldSlots slot in ScaffoldSlots.values) { | 67 for (ScaffoldSlots slot in ScaffoldSlots.values) { |
52 if (_slots[slot] == child) { | 68 if (_slots[slot] == child) { |
53 this[slot] = null; | 69 this[slot] = null; |
54 return slot; | 70 return slot; |
55 } | 71 } |
56 } | 72 } |
57 return null; | 73 return null; |
58 } | 74 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void syncRenderObject(UINode old) { | 190 void syncRenderObject(UINode old) { |
175 super.syncRenderObject(old); | 191 super.syncRenderObject(old); |
176 syncChild(toolbar, old is Scaffold ? old.toolbar : null, ScaffoldSlots.toolb
ar); | 192 syncChild(toolbar, old is Scaffold ? old.toolbar : null, ScaffoldSlots.toolb
ar); |
177 syncChild(body, old is Scaffold ? old.body : null, ScaffoldSlots.body); | 193 syncChild(body, old is Scaffold ? old.body : null, ScaffoldSlots.body); |
178 syncChild(statusbar, old is Scaffold ? old.statusbar : null, ScaffoldSlots.s
tatusBar); | 194 syncChild(statusbar, old is Scaffold ? old.statusbar : null, ScaffoldSlots.s
tatusBar); |
179 syncChild(drawer, old is Scaffold ? old.drawer : null, ScaffoldSlots.drawer)
; | 195 syncChild(drawer, old is Scaffold ? old.drawer : null, ScaffoldSlots.drawer)
; |
180 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, ScaffoldSlots.floatingActionButton); | 196 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, ScaffoldSlots.floatingActionButton); |
181 } | 197 } |
182 | 198 |
183 } | 199 } |
OLD | NEW |