Index: sky/examples/raw/simple_render_tree.dart |
diff --git a/sky/examples/raw/simple_render_tree.dart b/sky/examples/raw/simple_render_tree.dart |
index f5ae7e7dc0e52f106ec8a1c8cafc68ef4efb3371..13df0b893a6082398962f0efe87bc62154f18e0b 100644 |
--- a/sky/examples/raw/simple_render_tree.dart |
+++ b/sky/examples/raw/simple_render_tree.dart |
@@ -6,16 +6,29 @@ import 'dart:math'; |
import 'dart:sky'; |
import 'package:sky/framework/layout2.dart'; |
-class RenderBlueCircle extends RenderBox { |
- void paint(RenderNodeDisplayList canvas) { |
- double radius = min(width, height) * 0.45; |
- Paint paint = new Paint()..setARGB(255, 0, 255, 255); |
- canvas.drawCircle(width / 2, height / 2, radius, paint); |
+class SimpleBlock extends RenderDecoratedBox { |
eseidel
2015/05/21 18:08:14
Simple isnt' a very good name. SolidColorBlock?
Hixie
2015/05/21 19:45:03
TwoHundredPixelHighBlock? :-)
|
+ SimpleBlock(int backgroundColor) |
+ : super(new BoxDecoration(backgroundColor: backgroundColor)); |
+ |
+ BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) { |
+ return new BoxDimensions.withConstraints(constraints, height: 200.0); |
+ } |
+ |
+ void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) { |
+ setWidth(constraints, constraints.maxWidth); |
+ setHeight(constraints, 200.0); |
+ layoutDone(); |
} |
} |
void main() { |
- RenderView renderView = new RenderView(root: new RenderBlueCircle()); |
+ var root = new RenderBlock( |
+ decoration: new BoxDecoration(backgroundColor: 0xFF00FFFF)); |
+ |
+ root.add(new SimpleBlock(0xFF00FF00)); |
+ root.add(new SimpleBlock(0xFF0000FF)); |
+ |
+ RenderView renderView = new RenderView(root: root); |
renderView.layout(newWidth: view.width, newHeight: view.height); |
renderView.paintFrame(); |
} |