Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(830)

Unified Diff: sky/framework/layouts/block.dart

Issue 1064983002: [Effen] basic layout container class for custom layout (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/fn.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ }
+}
« no previous file with comments | « sky/framework/fn.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698