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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 body.parentData.position = new sky.Point(0.0, bodyPosition); | 110 body.parentData.position = new sky.Point(0.0, bodyPosition); |
111 } | 111 } |
112 if (_slots[ScaffoldSlots.drawer] != null) { | 112 if (_slots[ScaffoldSlots.drawer] != null) { |
113 RenderBox drawer = _slots[ScaffoldSlots.drawer]; | 113 RenderBox drawer = _slots[ScaffoldSlots.drawer]; |
114 drawer.layout(new BoxConstraints(minWidth: 0.0, maxWidth: size.width, minH
eight: size.height, maxHeight: size.height)); | 114 drawer.layout(new BoxConstraints(minWidth: 0.0, maxWidth: size.width, minH
eight: size.height, maxHeight: size.height)); |
115 assert(drawer.parentData is BoxParentData); | 115 assert(drawer.parentData is BoxParentData); |
116 drawer.parentData.position = new sky.Point(0.0, 0.0); | 116 drawer.parentData.position = new sky.Point(0.0, 0.0); |
117 } | 117 } |
118 if (_slots[ScaffoldSlots.floatingActionButton] != null) { | 118 if (_slots[ScaffoldSlots.floatingActionButton] != null) { |
119 RenderBox floatingActionButton = _slots[ScaffoldSlots.floatingActionButton
]; | 119 RenderBox floatingActionButton = _slots[ScaffoldSlots.floatingActionButton
]; |
120 floatingActionButton.layout(new BoxConstraints(minWidth: 0.0, maxWidth: si
ze.width, minHeight: size.height, maxHeight: size.height)); | 120 sky.Size area = new sky.Size(size.width + kButtonX, size.height + kButtonY
); |
| 121 floatingActionButton.layout(new BoxConstraints.loose(area)); |
121 assert(floatingActionButton.parentData is BoxParentData); | 122 assert(floatingActionButton.parentData is BoxParentData); |
122 floatingActionButton.parentData.position = new sky.Point(size.width - kBut
tonX, bodyPosition + bodyHeight - kButtonY); | 123 floatingActionButton.parentData.position = (area - floatingActionButton.si
ze).toPoint(); |
123 } | 124 } |
124 } | 125 } |
125 | 126 |
126 void paint(RenderObjectDisplayList canvas) { | 127 void paint(RenderObjectDisplayList canvas) { |
127 for (ScaffoldSlots slot in [ScaffoldSlots.body, ScaffoldSlots.statusBar, Sca
ffoldSlots.toolbar, ScaffoldSlots.floatingActionButton, ScaffoldSlots.drawer]) { | 128 for (ScaffoldSlots slot in [ScaffoldSlots.body, ScaffoldSlots.statusBar, Sca
ffoldSlots.toolbar, ScaffoldSlots.floatingActionButton, ScaffoldSlots.drawer]) { |
128 RenderBox box = _slots[slot]; | 129 RenderBox box = _slots[slot]; |
129 if (box != null) { | 130 if (box != null) { |
130 assert(box.parentData is BoxParentData); | 131 assert(box.parentData is BoxParentData); |
131 canvas.paintChild(box, box.parentData.position); | 132 canvas.paintChild(box, box.parentData.position); |
132 } | 133 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void syncRenderObject(UINode old) { | 205 void syncRenderObject(UINode old) { |
205 super.syncRenderObject(old); | 206 super.syncRenderObject(old); |
206 syncChild(toolbar, old is Scaffold ? old.toolbar : null, ScaffoldSlots.toolb
ar); | 207 syncChild(toolbar, old is Scaffold ? old.toolbar : null, ScaffoldSlots.toolb
ar); |
207 syncChild(body, old is Scaffold ? old.body : null, ScaffoldSlots.body); | 208 syncChild(body, old is Scaffold ? old.body : null, ScaffoldSlots.body); |
208 syncChild(statusbar, old is Scaffold ? old.statusbar : null, ScaffoldSlots.s
tatusBar); | 209 syncChild(statusbar, old is Scaffold ? old.statusbar : null, ScaffoldSlots.s
tatusBar); |
209 syncChild(drawer, old is Scaffold ? old.drawer : null, ScaffoldSlots.drawer)
; | 210 syncChild(drawer, old is Scaffold ? old.drawer : null, ScaffoldSlots.drawer)
; |
210 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, ScaffoldSlots.floatingActionButton); | 211 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, ScaffoldSlots.floatingActionButton); |
211 } | 212 } |
212 | 213 |
213 } | 214 } |
OLD | NEW |