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 '../layout2.dart'; | 6 import '../layout2.dart'; |
7 import '../theme/typography.dart' as typography; | 7 import '../theme/typography.dart' as typography; |
8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
9 | 9 |
10 // RenderNode | 10 // RenderNode |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 static const kToolbarHeight = 100.0; | 90 static const kToolbarHeight = 100.0; |
91 static const kStatusbarHeight = 50.0; | 91 static const kStatusbarHeight = 50.0; |
92 static const kButtonX = -16.0; // from right edge of body | 92 static const kButtonX = -16.0; // from right edge of body |
93 static const kButtonY = -16.0; // from bottom edge of body | 93 static const kButtonY = -16.0; // from bottom edge of body |
94 | 94 |
95 void performLayout() { | 95 void performLayout() { |
96 double bodyHeight = size.height; | 96 double bodyHeight = size.height; |
97 double bodyPosition = 0.0; | 97 double bodyPosition = 0.0; |
98 if (toolbar != null) { | 98 if (toolbar != null) { |
99 toolbar.layout(new BoxConstraints.tight(width: size.width, height: kToolba
rHeight)); | 99 toolbar.layout(new BoxConstraints.tight(new sky.Size(size.width, kToolbarH
eight))); |
100 assert(toolbar.parentData is BoxParentData); | 100 assert(toolbar.parentData is BoxParentData); |
101 toolbar.parentData.position = new sky.Point(0.0, 0.0); | 101 toolbar.parentData.position = new sky.Point(0.0, 0.0); |
102 bodyPosition = kToolbarHeight; | 102 bodyPosition = kToolbarHeight; |
103 bodyHeight -= kToolbarHeight; | 103 bodyHeight -= kToolbarHeight; |
104 } | 104 } |
105 if (statusbar != null) { | 105 if (statusbar != null) { |
106 statusbar.layout(new BoxConstraints.tight(width: size.width, height: kStat
usbarHeight)); | 106 statusbar.layout(new BoxConstraints.tight(new sky.Size(size.width, kStatus
barHeight))); |
107 assert(statusbar.parentData is BoxParentData); | 107 assert(statusbar.parentData is BoxParentData); |
108 statusbar.parentData.position = new sky.Point(0.0, size.height - kStatusba
rHeight); | 108 statusbar.parentData.position = new sky.Point(0.0, size.height - kStatusba
rHeight); |
109 bodyHeight -= kStatusbarHeight; | 109 bodyHeight -= kStatusbarHeight; |
110 } | 110 } |
111 if (body != null) { | 111 if (body != null) { |
112 body.layout(new BoxConstraints.tight(width: size.width, height: bodyHeight
)); | 112 body.layout(new BoxConstraints.tight(new sky.Size(size.width, bodyHeight))
); |
113 assert(body.parentData is BoxParentData); | 113 assert(body.parentData is BoxParentData); |
114 body.parentData.position = new sky.Point(0.0, bodyPosition); | 114 body.parentData.position = new sky.Point(0.0, bodyPosition); |
115 } | 115 } |
116 if (drawer != null) { | 116 if (drawer != null) { |
117 drawer.layout(new BoxConstraints(minWidth: 0.0, maxWidth: size.width, minH
eight: size.height, maxHeight: size.height)); | 117 drawer.layout(new BoxConstraints(minWidth: 0.0, maxWidth: size.width, minH
eight: size.height, maxHeight: size.height)); |
118 assert(drawer.parentData is BoxParentData); | 118 assert(drawer.parentData is BoxParentData); |
119 drawer.parentData.position = new sky.Point(0.0, 0.0); | 119 drawer.parentData.position = new sky.Point(0.0, 0.0); |
120 } | 120 } |
121 if (floatingActionButton != null) { | 121 if (floatingActionButton != null) { |
122 floatingActionButton.layout(new BoxConstraints(minWidth: 0.0, maxWidth: si
ze.width, minHeight: size.height, maxHeight: size.height)); | 122 floatingActionButton.layout(new BoxConstraints(minWidth: 0.0, maxWidth: si
ze.width, minHeight: size.height, maxHeight: size.height)); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 void syncRenderNode(UINode old) { | 214 void syncRenderNode(UINode old) { |
215 super.syncRenderNode(old); | 215 super.syncRenderNode(old); |
216 syncChild(toolbar, old is Scaffold ? old.toolbar : null, #toolbar); | 216 syncChild(toolbar, old is Scaffold ? old.toolbar : null, #toolbar); |
217 syncChild(body, old is Scaffold ? old.body : null, #body); | 217 syncChild(body, old is Scaffold ? old.body : null, #body); |
218 syncChild(statusbar, old is Scaffold ? old.statusbar : null, #statusbar); | 218 syncChild(statusbar, old is Scaffold ? old.statusbar : null, #statusbar); |
219 syncChild(drawer, old is Scaffold ? old.drawer : null, #drawer); | 219 syncChild(drawer, old is Scaffold ? old.drawer : null, #drawer); |
220 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, #floatingActionButton); | 220 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, #floatingActionButton); |
221 } | 221 } |
222 | 222 |
223 } | 223 } |
OLD | NEW |