| 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: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 Loading... |
| 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 } |
| OLD | NEW |