Chromium Code Reviews| Index: sky/framework/layouts/block.dart |
| diff --git a/sky/framework/layouts/block.dart b/sky/framework/layouts/block.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9ed957b4001025d0d3a40afa20c8699bc0cd6fa3 |
| --- /dev/null |
| +++ b/sky/framework/layouts/block.dart |
| @@ -0,0 +1,31 @@ |
| + |
| +import 'dart:sky' as sky; |
| +import '../fn.dart'; |
| + |
| +class BlockLayout extends LayoutContainer { |
| + |
| + BlockLayout({ |
| + Object key, |
| + List<UINode> children, |
| + Style style, |
| + String inlineStyle |
| + }) : super( |
| + key: key, |
| + children: children, |
| + style: style, |
| + inlineStyle: inlineStyle |
| + ); |
| + |
| + void layout(sky.Element skyNode) { |
| + double y = 0.0; |
|
ojan
2015/04/08 20:08:11
FYI, here you should be doing skyNode.width = skyN
Hixie
2015/04/09 16:26:39
why wouldn't the parent set the width?
|
| + skyNode.getChildElements().forEach((child) { |
| + child.width = skyNode.width; |
| + child.setNeedsLayout(); // with this line, sky crashes. without it, nothing renders as a child of this LayoutContainer |
| + child.layout(); |
| + child.x = 0.0; |
| + child.y = y; |
| + y += child.height; |
| + }); |
| + skyNode.height = y; |
| + } |
| +} |