| 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:sky'; | 5 import 'dart:sky'; |
| 6 import 'package:sky/framework/app.dart'; | 6 import 'package:sky/framework/app.dart'; |
| 7 import 'package:sky/framework/layout2.dart'; | 7 import 'package:sky/framework/rendering/render_box.dart'; |
| 8 import 'package:sky/framework/rendering/render_node.dart'; |
| 9 import 'package:sky/framework/rendering/render_flex.dart'; |
| 10 import 'package:sky/framework/rendering/render_paragraph.dart'; |
| 8 | 11 |
| 9 class RenderSolidColor extends RenderDecoratedBox { | 12 class RenderSolidColor extends RenderDecoratedBox { |
| 10 final Size desiredSize; | 13 final Size desiredSize; |
| 11 final int backgroundColor; | 14 final int backgroundColor; |
| 12 | 15 |
| 13 RenderSolidColor(int backgroundColor, { this.desiredSize: const Size.infinite(
) }) | 16 RenderSolidColor(int backgroundColor, { this.desiredSize: const Size.infinite(
) }) |
| 14 : backgroundColor = backgroundColor, | 17 : backgroundColor = backgroundColor, |
| 15 super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); | 18 super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); |
| 16 | 19 |
| 17 Size getIntrinsicDimensions(BoxConstraints constraints) { | 20 Size getIntrinsicDimensions(BoxConstraints constraints) { |
| 18 return constraints.constrain(new Size(desiredWidth, desiredHeight)); | 21 return constraints.constrain(desiredSize); |
| 19 } | 22 } |
| 20 | 23 |
| 21 void performLayout() { | 24 void performLayout() { |
| 22 size = constraints.constrain(desiredSize); | 25 size = constraints.constrain(desiredSize); |
| 23 } | 26 } |
| 24 | 27 |
| 25 void handlePointer(PointerEvent event) { | 28 void handlePointer(PointerEvent event) { |
| 26 if (event.type == 'pointerdown') | 29 if (event.type == 'pointerdown') |
| 27 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); | 30 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); |
| 28 else if (event.type == 'pointerup') | 31 else if (event.type == 'pointerup') |
| (...skipping 24 matching lines...) Expand all Loading... |
| 53 | 56 |
| 54 child = new RenderDecoratedBox( | 57 child = new RenderDecoratedBox( |
| 55 decoration: new BoxDecoration(backgroundColor: 0xFFFFFFFF), | 58 decoration: new BoxDecoration(backgroundColor: 0xFFFFFFFF), |
| 56 child: new RenderParagraph(text: meatyString, color: 0xFF009900) | 59 child: new RenderParagraph(text: meatyString, color: 0xFF009900) |
| 57 ); | 60 ); |
| 58 flexRoot.add(child); | 61 flexRoot.add(child); |
| 59 child.parentData.flex = 1; | 62 child.parentData.flex = 1; |
| 60 | 63 |
| 61 app = new AppView(root); | 64 app = new AppView(root); |
| 62 } | 65 } |
| OLD | NEW |