| 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 | 8 |
| 9 // RenderNode | 9 // RenderNode |
| 10 class RenderScaffold extends RenderDecoratedBox { | 10 class RenderScaffold extends RenderDecoratedBox { |
| (...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 relayout() { | 95 void relayout() { |
| 96 double bodyHeight = height; | 96 double bodyHeight = height; |
| 97 double bodyPosition = 0.0; | 97 double bodyPosition = 0.0; |
| 98 if (toolbar != null) { | 98 if (toolbar != null) { |
| 99 print("laying out toolbar..."); | |
| 100 toolbar.layout(new BoxConstraints.tight(width: width, height: kToolbarHeig
ht)); | 99 toolbar.layout(new BoxConstraints.tight(width: width, height: kToolbarHeig
ht)); |
| 101 assert(toolbar.parentData is BoxParentData); | 100 assert(toolbar.parentData is BoxParentData); |
| 102 toolbar.parentData.x = 0.0; | 101 toolbar.parentData.x = 0.0; |
| 103 toolbar.parentData.y = 0.0; | 102 toolbar.parentData.y = 0.0; |
| 104 print("...at ${toolbar.parentData.x},${toolbar.parentData.y} dim ${toolbar.w
idth}x${toolbar.height}"); | |
| 105 bodyPosition = kToolbarHeight; | 103 bodyPosition = kToolbarHeight; |
| 106 bodyHeight -= kToolbarHeight; | 104 bodyHeight -= kToolbarHeight; |
| 107 } | 105 } |
| 108 if (statusbar != null) { | 106 if (statusbar != null) { |
| 109 statusbar.layout(new BoxConstraints.tight(width: width, height: kStatusbar
Height)); | 107 statusbar.layout(new BoxConstraints.tight(width: width, height: kStatusbar
Height)); |
| 110 assert(statusbar.parentData is BoxParentData); | 108 assert(statusbar.parentData is BoxParentData); |
| 111 statusbar.parentData.x = 0.0; | 109 statusbar.parentData.x = 0.0; |
| 112 statusbar.parentData.y = height - kStatusbarHeight; | 110 statusbar.parentData.y = height - kStatusbarHeight; |
| 113 bodyHeight -= kStatusbarHeight; | 111 bodyHeight -= kStatusbarHeight; |
| 114 } | 112 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void syncRenderNode(UINode old) { | 220 void syncRenderNode(UINode old) { |
| 223 super.syncRenderNode(old); | 221 super.syncRenderNode(old); |
| 224 syncChild(toolbar, old is Scaffold ? old.toolbar : null, #toolbar); | 222 syncChild(toolbar, old is Scaffold ? old.toolbar : null, #toolbar); |
| 225 syncChild(body, old is Scaffold ? old.body : null, #body); | 223 syncChild(body, old is Scaffold ? old.body : null, #body); |
| 226 syncChild(statusbar, old is Scaffold ? old.statusbar : null, #statusbar); | 224 syncChild(statusbar, old is Scaffold ? old.statusbar : null, #statusbar); |
| 227 syncChild(drawer, old is Scaffold ? old.drawer : null, #drawer); | 225 syncChild(drawer, old is Scaffold ? old.drawer : null, #drawer); |
| 228 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, #floatingActionButton); | 226 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton :
null, #floatingActionButton); |
| 229 } | 227 } |
| 230 | 228 |
| 231 } | 229 } |
| OLD | NEW |