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