| 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..f388c0744bc2101a24215f1b168df3331fb44dcb 100644
|
| --- a/sky/examples/raw/simple_render_tree.dart
|
| +++ b/sky/examples/raw/simple_render_tree.dart
|
| @@ -6,16 +6,31 @@ 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 {
|
| + 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 }) {
|
| + width = clamp(min: constraints.minWidth,
|
| + max: constraints.maxWidth, value: constraints.maxWidth);
|
| + height = clamp(min: constraints.minHeight,
|
| + max: constraints.maxHeight, value: 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();
|
| }
|
|
|