| 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' as sky; | 5 import 'dart:sky' as sky; |
| 6 import 'package:sky/framework/fn2.dart'; | 6 |
| 7 import 'package:sky/framework/rendering/box.dart'; | 7 import 'package:sky/framework/rendering/box.dart'; |
| 8 import 'package:sky/framework/widgets/ui_node.dart'; |
| 9 import 'package:sky/framework/widgets/wrappers.dart'; |
| 10 |
| 8 import '../lib/solid_color_box.dart'; | 11 import '../lib/solid_color_box.dart'; |
| 9 | 12 |
| 10 class Rectangle extends RenderObjectWrapper { | 13 class Rectangle extends RenderObjectWrapper { |
| 11 RenderSolidColorBox root; | 14 RenderSolidColorBox root; |
| 12 RenderSolidColorBox createNode() => | 15 RenderSolidColorBox createNode() => |
| 13 new RenderSolidColorBox(color, desiredSize: new sky.Size(40.0, 130.0)); | 16 new RenderSolidColorBox(color, desiredSize: new sky.Size(40.0, 130.0)); |
| 14 | 17 |
| 15 final int color; | 18 final int color; |
| 16 | 19 |
| 17 Rectangle(this.color, { Object key }) : super(key: key); | 20 Rectangle(this.color, { Object key }) : super(key: key); |
| 18 } | 21 } |
| 19 | 22 |
| 20 class ContainerApp extends App { | 23 class ContainerApp extends App { |
| 21 UINode build() { | 24 UINode build() { |
| 22 return new EventListenerNode( | 25 return new EventListenerNode( |
| 23 new Block([ | 26 new Block([ |
| 24 new Container( | 27 new Container( |
| 25 padding: new EdgeDims.all(10.0), | 28 padding: new EdgeDims.all(10.0), |
| 26 margin: new EdgeDims.all(10.0), | 29 margin: new EdgeDims.all(10.0), |
| 27 height: 100.0, | 30 height: 100.0, |
| 28 decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF00F
F00)), | 31 decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF00F
F00)), |
| 29 child: new Block([ | 32 child: new Block([ |
| 30 new Container( | 33 new Container( |
| 31 decoration: new BoxDecoration(backgroundColor: const sky.Color(0xF
FFFFF00)), | 34 decoration: new BoxDecoration(backgroundColor: const sky.Color(0xF
FFFFF00)), |
| 32 height: 20.0, | 35 height: 20.0 |
| 33 ), | 36 ), |
| 34 new Image(src: "https://www.dartlang.org/logos/dart-logo.png", | 37 new Image(src: "https://www.dartlang.org/logos/dart-logo.png", |
| 35 size: new sky.Size(300.0, 300.0), | 38 size: new sky.Size(300.0, 300.0), |
| 36 key: 1 | 39 key: 1 |
| 37 ), | 40 ), |
| 38 ])), | 41 ])), |
| 39 ]), | 42 ]), |
| 40 onPointerDown: _handlePointerDown, | 43 onPointerDown: _handlePointerDown, |
| 41 onGestureTap: _handleGestureTap); | 44 onGestureTap: _handleGestureTap); |
| 42 } | 45 } |
| 43 | 46 |
| 44 void _handlePointerDown(sky.PointerEvent event) { | 47 void _handlePointerDown(sky.PointerEvent event) { |
| 45 print("_handlePointerDown"); | 48 print("_handlePointerDown"); |
| 46 } | 49 } |
| 47 | 50 |
| 48 void _handleGestureTap(sky.GestureEvent event) { | 51 void _handleGestureTap(sky.GestureEvent event) { |
| 49 print("_handleGestureTap"); | 52 print("_handleGestureTap"); |
| 50 } | 53 } |
| 51 } | 54 } |
| 52 | 55 |
| 53 void main() { | 56 void main() { |
| 54 new ContainerApp(); | 57 new ContainerApp(); |
| 55 } | 58 } |
| OLD | NEW |