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

Side by Side Diff: sky/examples/raw/simple_render_tree.dart

Issue 1159763003: Clean up syntax as suggested by sethladd (Closed) Base URL: https://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 | no next file » | 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 'dart:math'; 5 import 'dart:math';
6 import 'dart:sky'; 6 import 'dart:sky';
7 import 'package:sky/framework/layout2.dart'; 7 import 'package:sky/framework/layout2.dart';
8 8
9 class RenderSolidColor extends RenderDecoratedBox { 9 class RenderSolidColor extends RenderDecoratedBox {
10 final double desiredHeight; 10 final double desiredHeight;
11 final double desiredWidth; 11 final double desiredWidth;
12 final int backgroundColor; 12 final int backgroundColor;
13 13
14 RenderSolidColor(int backgroundColor, { double desiredHeight: double.INFINITY, 14 RenderSolidColor(int backgroundColor, { this.desiredHeight: double.INFINITY,
15 double desiredWidth: double.INFINITY } ) 15 this.desiredWidth: double.INFINITY })
16 : desiredHeight = desiredHeight, 16 : backgroundColor = backgroundColor,
17 desiredWidth = desiredWidth,
18 backgroundColor = backgroundColor,
19 super(new BoxDecoration(backgroundColor: backgroundColor)); 17 super(new BoxDecoration(backgroundColor: backgroundColor));
20 18
21 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) { 19 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) {
22 return new BoxDimensions.withConstraints(constraints, 20 return new BoxDimensions.withConstraints(constraints,
23 height: desiredHeight, 21 height: desiredHeight,
24 width: desiredWidth); 22 width: desiredWidth);
25 } 23 }
26 24
27 void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) { 25 void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) {
28 width = constraints.constrainWidth(desiredWidth); 26 width = constraints.constrainWidth(desiredWidth);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 addFlexChild(row, 0xFF0000FF, flex: 2); 96 addFlexChild(row, 0xFF0000FF, flex: 2);
99 97
100 root.add(row); 98 root.add(row);
101 row.parentData.flex = 3; 99 row.parentData.flex = 3;
102 100
103 renderView = new RenderView(root: root); 101 renderView = new RenderView(root: root);
104 renderView.layout(newWidth: view.width, newHeight: view.height); 102 renderView.layout(newWidth: view.width, newHeight: view.height);
105 103
106 view.scheduleFrame(); 104 view.scheduleFrame();
107 } 105 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698