Index: sky/examples/widgets/container.dart |
diff --git a/sky/examples/widgets/container.dart b/sky/examples/widgets/container.dart |
index 437784078ade73ed332a35772e5d65e328441091..14b5663d13fd8ddee15c4004f82f36ff8907a00c 100644 |
--- a/sky/examples/widgets/container.dart |
+++ b/sky/examples/widgets/container.dart |
@@ -5,51 +5,44 @@ |
import 'dart:sky' as sky; |
import 'package:sky/framework/rendering/box.dart'; |
+import 'package:sky/framework/rendering/flex.dart'; |
import 'package:sky/framework/widgets/ui_node.dart'; |
import 'package:sky/framework/widgets/wrappers.dart'; |
-import '../lib/solid_color_box.dart'; |
+class Rectangle extends Component { |
-class Rectangle extends RenderObjectWrapper { |
- RenderSolidColorBox root; |
- RenderSolidColorBox createNode() => |
- new RenderSolidColorBox(color, desiredSize: new sky.Size(40.0, 130.0)); |
+ Rectangle(this.color, { Object key }) : super(key: key); |
- final int color; |
+ final Color color; |
+ |
+ UINode build() { |
+ return new FlexExpandingChild( |
+ new Container( |
+ decoration: new BoxDecoration(backgroundColor: color) |
+ ) |
+ ); |
+ } |
- Rectangle(this.color, { Object key }) : super(key: key); |
} |
class ContainerApp extends App { |
UINode build() { |
- return new EventListenerNode( |
- new Block([ |
+ return new Flex([ |
+ new Rectangle(const Color(0xFF00FFFF), key: 'a'), |
new Container( |
padding: new EdgeDims.all(10.0), |
margin: new EdgeDims.all(10.0), |
- height: 100.0, |
- decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFF00FF00)), |
- child: new Block([ |
- new Container( |
- decoration: new BoxDecoration(backgroundColor: const sky.Color(0xFFFFFF00)), |
- height: 20.0 |
- ), |
- new Image(src: "https://www.dartlang.org/logos/dart-logo.png", |
- size: new sky.Size(300.0, 300.0), |
- key: 1 |
- ), |
- ])), |
- ]), |
- onPointerDown: _handlePointerDown, |
- onGestureTap: _handleGestureTap); |
- } |
- |
- void _handlePointerDown(sky.PointerEvent event) { |
- print("_handlePointerDown"); |
- } |
- |
- void _handleGestureTap(sky.GestureEvent event) { |
- print("_handleGestureTap"); |
+ decoration: new BoxDecoration(backgroundColor: const Color(0xFFCCCCCC)), |
+ child: new Image(src: "https://www.dartlang.org/logos/dart-logo.png", |
+ size: new Size(300.0, 300.0), |
+ key: 1 |
+ ) |
+ ), |
+ new Rectangle(const Color(0xFFFFFF00), key: 'b'), |
+ ], |
+ direction: FlexDirection.vertical, |
+ justifyContent: FlexJustifyContent.spaceBetween |
+ ); |
} |
} |