| 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/rendering/box.dart'; | 6 import 'package:sky/framework/rendering/box.dart'; |
| 7 | 7 |
| 8 class RenderSolidColorBox extends RenderDecoratedBox { | 8 class RenderSolidColorBox extends RenderDecoratedBox { |
| 9 final Size desiredSize; | 9 final Size desiredSize; |
| 10 final Color backgroundColor; | 10 final Color backgroundColor; |
| 11 | 11 |
| 12 RenderSolidColorBox(Color backgroundColor, { this.desiredSize: const Size.infi
nite() }) | 12 RenderSolidColorBox(Color backgroundColor, { this.desiredSize: Size.infinite }
) |
| 13 : backgroundColor = backgroundColor, | 13 : backgroundColor = backgroundColor, |
| 14 super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); | 14 super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); |
| 15 | 15 |
| 16 Size getIntrinsicDimensions(BoxConstraints constraints) { | 16 Size getIntrinsicDimensions(BoxConstraints constraints) { |
| 17 return constraints.constrain(desiredSize); | 17 return constraints.constrain(desiredSize); |
| 18 } | 18 } |
| 19 | 19 |
| 20 void performLayout() { | 20 void performLayout() { |
| 21 size = constraints.constrain(desiredSize); | 21 size = constraints.constrain(desiredSize); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void handlePointer(PointerEvent event) { | 24 void handlePointer(PointerEvent event) { |
| 25 if (event.type == 'pointerdown') | 25 if (event.type == 'pointerdown') |
| 26 decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); | 26 decoration = new BoxDecoration(backgroundColor: const Color(0xFFFF0000)); |
| 27 else if (event.type == 'pointerup') | 27 else if (event.type == 'pointerup') |
| 28 decoration = new BoxDecoration(backgroundColor: backgroundColor); | 28 decoration = new BoxDecoration(backgroundColor: backgroundColor); |
| 29 } | 29 } |
| 30 } | 30 } |
| OLD | NEW |