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 'dart:sky' as sky; |
| 6 |
5 import '../rendering/box.dart'; | 7 import '../rendering/box.dart'; |
6 import '../rendering/object.dart'; | 8 import '../rendering/object.dart'; |
7 import '../theme/view_configuration.dart'; | 9 import '../theme/view_configuration.dart'; |
8 import 'widget.dart'; | 10 import 'widget.dart'; |
9 | 11 |
10 // Slots are painted in this order and hit tested in reverse of this order | 12 // Slots are painted in this order and hit tested in reverse of this order |
11 enum ScaffoldSlots { | 13 enum ScaffoldSlots { |
12 body, | 14 body, |
13 statusBar, | 15 statusBar, |
14 toolbar, | 16 toolbar, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 double bodyPosition = 0.0; | 97 double bodyPosition = 0.0; |
96 if (_slots[ScaffoldSlots.statusBar] != null) { | 98 if (_slots[ScaffoldSlots.statusBar] != null) { |
97 RenderBox statusBar = _slots[ScaffoldSlots.statusBar]; | 99 RenderBox statusBar = _slots[ScaffoldSlots.statusBar]; |
98 statusBar.layout(new BoxConstraints.tight(new Size(size.width, kStatusBarH
eight))); | 100 statusBar.layout(new BoxConstraints.tight(new Size(size.width, kStatusBarH
eight))); |
99 assert(statusBar.parentData is BoxParentData); | 101 assert(statusBar.parentData is BoxParentData); |
100 statusBar.parentData.position = new Point(0.0, size.height - kStatusBarHei
ght); | 102 statusBar.parentData.position = new Point(0.0, size.height - kStatusBarHei
ght); |
101 bodyHeight -= kStatusBarHeight; | 103 bodyHeight -= kStatusBarHeight; |
102 } | 104 } |
103 if (_slots[ScaffoldSlots.toolbar] != null) { | 105 if (_slots[ScaffoldSlots.toolbar] != null) { |
104 RenderBox toolbar = _slots[ScaffoldSlots.toolbar]; | 106 RenderBox toolbar = _slots[ScaffoldSlots.toolbar]; |
105 double toolbarHeight = kToolBarHeight + kNotificationAreaHeight; | 107 double toolbarHeight = kToolBarHeight + sky.view.paddingTop; |
106 toolbar.layout(new BoxConstraints.tight(new Size(size.width, toolbarHeight
))); | 108 toolbar.layout(new BoxConstraints.tight(new Size(size.width, toolbarHeight
))); |
107 assert(toolbar.parentData is BoxParentData); | 109 assert(toolbar.parentData is BoxParentData); |
108 toolbar.parentData.position = Point.origin; | 110 toolbar.parentData.position = Point.origin; |
109 bodyPosition += toolbarHeight; | 111 bodyPosition += toolbarHeight; |
110 bodyHeight -= toolbarHeight; | 112 bodyHeight -= toolbarHeight; |
111 } | 113 } |
112 if (_slots[ScaffoldSlots.body] != null) { | 114 if (_slots[ScaffoldSlots.body] != null) { |
113 RenderBox body = _slots[ScaffoldSlots.body]; | 115 RenderBox body = _slots[ScaffoldSlots.body]; |
114 body.layout(new BoxConstraints.tight(new Size(size.width, bodyHeight))); | 116 body.layout(new BoxConstraints.tight(new Size(size.width, bodyHeight))); |
115 assert(body.parentData is BoxParentData); | 117 assert(body.parentData is BoxParentData); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 225 |
224 void syncRenderObject(Widget old) { | 226 void syncRenderObject(Widget old) { |
225 super.syncRenderObject(old); | 227 super.syncRenderObject(old); |
226 for (ScaffoldSlots slot in ScaffoldSlots.values) { | 228 for (ScaffoldSlots slot in ScaffoldSlots.values) { |
227 Widget widget = this[slot]; | 229 Widget widget = this[slot]; |
228 this[slot] = syncChild(widget, old is Scaffold ? old[slot] : null, slot); | 230 this[slot] = syncChild(widget, old is Scaffold ? old[slot] : null, slot); |
229 } | 231 } |
230 } | 232 } |
231 | 233 |
232 } | 234 } |
OLD | NEW |