| 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/layout2.dart'; |
| 8 | 8 |
| 9 class RenderSolidColor extends RenderDecoratedBox { | 9 class RenderSolidColor extends RenderDecoratedBox { |
| 10 final double desiredHeight; | 10 final double desiredHeight; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) { | 25 void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) { |
| 26 width = constraints.constrainWidth(desiredWidth); | 26 width = constraints.constrainWidth(desiredWidth); |
| 27 height = constraints.constrainHeight(desiredHeight); | 27 height = constraints.constrainHeight(desiredHeight); |
| 28 layoutDone(); | 28 layoutDone(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void handlePointer(PointerEvent event) { | 31 void handlePointer(PointerEvent event) { |
| 32 if (event.type == 'pointerdown') | 32 if (event.type == 'pointerdown') |
| 33 setBoxDecoration(new BoxDecoration(backgroundColor: 0xFFFF0000)); | 33 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); |
| 34 else if (event.type == 'pointerup') | 34 else if (event.type == 'pointerup') |
| 35 setBoxDecoration(new BoxDecoration(backgroundColor: backgroundColor)); | 35 decoration = new BoxDecoration(backgroundColor: backgroundColor); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 AppView app; | 39 AppView app; |
| 40 | 40 |
| 41 void main() { | 41 void main() { |
| 42 var root = new RenderFlex( | 42 var root = new RenderFlex( |
| 43 direction: FlexDirection.Vertical, | 43 direction: FlexDirection.Vertical, |
| 44 decoration: new BoxDecoration(backgroundColor: 0xFF000000)); | 44 decoration: new BoxDecoration(backgroundColor: 0xFF000000)); |
| 45 | 45 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 72 // Purple and blue cells | 72 // Purple and blue cells |
| 73 addFlexChild(row, 0x77FF00FF, flex: 1); | 73 addFlexChild(row, 0x77FF00FF, flex: 1); |
| 74 addFlexChild(row, 0xFF0000FF, flex: 2); | 74 addFlexChild(row, 0xFF0000FF, flex: 2); |
| 75 | 75 |
| 76 root.add(row); | 76 root.add(row); |
| 77 row.parentData.flex = 3; | 77 row.parentData.flex = 3; |
| 78 | 78 |
| 79 app = new AppView(root); | 79 app = new AppView(root); |
| 80 | 80 |
| 81 } | 81 } |
| OLD | NEW |