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

Unified Diff: sky/framework/fn.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
Index: sky/framework/fn.dart
diff --git a/sky/framework/fn.dart b/sky/framework/fn.dart
index 6f9543114bba9c2f5314a827d57d43a72194e5ee..3d8bde1d6a5dbc8c66d5b1459188e33f50b558d8 100644
--- a/sky/framework/fn.dart
+++ b/sky/framework/fn.dart
@@ -583,6 +583,43 @@ class Container extends SkyElementWrapper {
);
}
+abstract class LayoutContainer extends Container {
+
+ LayoutContainer({
+ Object key,
+ List<UINode> children,
+ Style style,
+ String inlineStyle
+ }) : super(
+ key: key,
+ children: children,
+ style: style,
+ inlineStyle: inlineStyle
+ );
+
+ sky.Node _createNode() {
+ var result = super._createNode();
+ result.setLayoutManager(() => layout(_root));
+ return result;
+ }
+
+ void _syncNode(SkyNodeWrapper old) {
+ super._syncNode(old);
+ _root.setNeedsLayout();
+ }
+
+ void layout(sky.Element skyNode);
+ // set skyNode.width if you have an opinion about your width
+ // for each skyNode.getChildElements()[i]:
+ // set .width
+ // call .layout()
+ // set .x, .y
+ // set .width if you want to force a width
+ // set .height if you want to force a height
+ // set skyNode.height
+
+}
+
class Image extends SkyElementWrapper {
String get _tagName => 'img';

Powered by Google App Engine
This is Rietveld 408576698