Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: sky/sdk/lib/framework/components2/scaffold.dart

Issue 1154013006: Fix Dart analyzer warnings in scaffold.dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/sdk/lib/framework/rendering/render_flex.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '../theme/typography.dart' as typography; 6 import '../theme/typography.dart' as typography;
7 import 'dart:sky' as sky; 7 import 'dart:sky' as sky;
8 import '../rendering/render_box.dart';
9 import '../rendering/render_node.dart';
8 10
9 // RenderNode 11 // RenderNode
10 class RenderScaffold extends RenderDecoratedBox { 12 class RenderScaffold extends RenderBox {
11 13
12 RenderScaffold({ 14 RenderScaffold({
13 BoxDecoration decoration,
14 RenderBox toolbar, 15 RenderBox toolbar,
15 RenderBox body, 16 RenderBox body,
16 RenderBox statusbar, 17 RenderBox statusbar,
17 RenderBox drawer, 18 RenderBox drawer,
18 RenderBox floatingActionButton 19 RenderBox floatingActionButton
19 }) : super(decoration) { 20 }) {
20 this.toolbar = toolbar; 21 this.toolbar = toolbar;
21 this.body = body; 22 this.body = body;
22 this.statusbar = statusbar; 23 this.statusbar = statusbar;
23 this.drawer = drawer; 24 this.drawer = drawer;
24 this.floatingActionButton = floatingActionButton; 25 this.floatingActionButton = floatingActionButton;
25 } 26 }
26 27
27 RenderBox _toolbar; 28 RenderBox _toolbar;
28 RenderBox get toolbar => _toolbar; 29 RenderBox get toolbar => _toolbar;
29 void set toolbar (RenderBox value) { 30 void set toolbar (RenderBox value) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 body.parentData.position = new sky.Point(0.0, bodyPosition); 114 body.parentData.position = new sky.Point(0.0, bodyPosition);
114 } 115 }
115 if (drawer != null) { 116 if (drawer != null) {
116 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));
117 assert(drawer.parentData is BoxParentData); 118 assert(drawer.parentData is BoxParentData);
118 drawer.parentData.position = new sky.Point(0.0, 0.0); 119 drawer.parentData.position = new sky.Point(0.0, 0.0);
119 } 120 }
120 if (floatingActionButton != null) { 121 if (floatingActionButton != null) {
121 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));
122 assert(floatingActionButton.parentData is BoxParentData); 123 assert(floatingActionButton.parentData is BoxParentData);
123 floatingActionButton.parentData.position = new sky.Point(size.width - xBut tonX, bodyPosition + bodyHeight - kButtonY); 124 floatingActionButton.parentData.position = new sky.Point(size.width - kBut tonX, bodyPosition + bodyHeight - kButtonY);
124 } 125 }
125 } 126 }
126 127
127 void paint(RenderNodeDisplayList canvas) { 128 void paint(RenderNodeDisplayList canvas) {
128 if (body != null) 129 if (body != null)
129 canvas.paintChild(body, (body.parentData as BoxParentData).position); 130 canvas.paintChild(body, (body.parentData as BoxParentData).position);
130 if (statusbar != null) 131 if (statusbar != null)
131 canvas.paintChild(statusbar, (statusbar.parentData as BoxParentData).posit ion); 132 canvas.paintChild(statusbar, (statusbar.parentData as BoxParentData).posit ion);
132 if (toolbar != null) 133 if (toolbar != null)
133 canvas.paintChild(toolbar, (toolbar.parentData as BoxParentData).position) ; 134 canvas.paintChild(toolbar, (toolbar.parentData as BoxParentData).position) ;
134 if (floatingActionButton != null) 135 if (floatingActionButton != null)
135 canvas.paintChild(floatingActionButton, (floatingActionButton.parentData a s BoxParentData).position); 136 canvas.paintChild(floatingActionButton, (floatingActionButton.parentData a s BoxParentData).position);
136 if (drawer != null) 137 if (drawer != null)
137 canvas.paintChild(drawer, (drawer.parentData as BoxParentData).position); 138 canvas.paintChild(drawer, (drawer.parentData as BoxParentData).position);
138 } 139 }
139 140
140 void hitTestChildren(HitTestResult result, { sky.Point position }) { 141 void hitTestChildren(HitTestResult result, { sky.Point position }) {
141 assert(floatingActionButton == null || floatingActionButton.parentData is Bo xParentData); 142 assert(floatingActionButton == null || floatingActionButton.parentData is Bo xParentData);
142 assert(statusbar == null || statusbar.parentData is BoxParentData); 143 assert(statusbar == null || statusbar.parentData is BoxParentData);
143 if ((drawer != null) && (x < drawer.size.width)) { 144 if ((drawer != null) && (position.x < drawer.size.width)) {
144 drawer.hitTest(result, position: position); 145 drawer.hitTest(result, position: position);
145 } else if ((floatingActionButton != null) && (position.x >= floatingActionBu tton.parentData.position.x) && (position.x < floatingActionButton.parentData.pos ition.x + floatingActionButton.size.width) 146 } else if ((floatingActionButton != null) && (position.x >= floatingActionBu tton.parentData.position.x) && (position.x < floatingActionButton.parentData.pos ition.x + floatingActionButton.size.width)
146 && (position.y >= floatingActionBu tton.parentData.position.y) && (position.y < floatingActionButton.parentData.pos ition.y + floatingActionButton.size.height)) { 147 && (position.y >= floatingActionBu tton.parentData.position.y) && (position.y < floatingActionButton.parentData.pos ition.y + floatingActionButton.size.height)) {
147 floatingActionButton.hitTest(result, position: new sky.Point(position.x - floatingActionButton.parentData.position.x, position.y - floatingActionButton.pa rentData.position.y)); 148 floatingActionButton.hitTest(result, position: new sky.Point(position.x - floatingActionButton.parentData.position.x, position.y - floatingActionButton.pa rentData.position.y));
148 } else if ((toolbar != null) && (position.y < toolbar.size.height)) { 149 } else if ((toolbar != null) && (position.y < toolbar.size.height)) {
149 toolbar.hitTest(result, position: position); 150 toolbar.hitTest(result, position: position);
150 } else if ((statusbar != null) && (position.y > statusbar.parentData.positio n.y)) { 151 } else if ((statusbar != null) && (position.y > statusbar.parentData.positio n.y)) {
151 statusbar.hitTest(result, position: new sky.Point(position.x, position.y - statusbar.parentData.position.y)); 152 statusbar.hitTest(result, position: new sky.Point(position.x, position.y - statusbar.parentData.position.y));
152 } else if (body != null) { 153 } else if (body != null) {
153 body.hitTest(result, position: new sky.Point(position.x, position.y - body .parentData.position.y)); 154 body.hitTest(result, position: new sky.Point(position.x, position.y - body .parentData.position.y));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 void syncRenderNode(UINode old) { 214 void syncRenderNode(UINode old) {
214 super.syncRenderNode(old); 215 super.syncRenderNode(old);
215 syncChild(toolbar, old is Scaffold ? old.toolbar : null, #toolbar); 216 syncChild(toolbar, old is Scaffold ? old.toolbar : null, #toolbar);
216 syncChild(body, old is Scaffold ? old.body : null, #body); 217 syncChild(body, old is Scaffold ? old.body : null, #body);
217 syncChild(statusbar, old is Scaffold ? old.statusbar : null, #statusbar); 218 syncChild(statusbar, old is Scaffold ? old.statusbar : null, #statusbar);
218 syncChild(drawer, old is Scaffold ? old.drawer : null, #drawer); 219 syncChild(drawer, old is Scaffold ? old.drawer : null, #drawer);
219 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton : null, #floatingActionButton); 220 syncChild(floatingActionButton, old is Scaffold ? old.floatingActionButton : null, #floatingActionButton);
220 } 221 }
221 222
222 } 223 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/framework/rendering/render_flex.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698