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

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: it works! 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 65389e56884d1eb576a6b62220f562e7ab00b72e..43df942099d68a08d35bfa0780bb358fb63f062b 100644
--- a/sky/framework/fn.dart
+++ b/sky/framework/fn.dart
@@ -587,6 +587,42 @@ class Container extends SkyElementWrapper {
);
}
+abstract class LayoutContainer extends Container {
+
ojan 2015/04/13 21:49:27 Nit: The style of the other classes doesn't have t
Hixie 2015/04/13 23:16:01 As far as I can tell, the style, such as it is, is
+ 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);
ojan 2015/04/13 21:49:27 How about we bake this into Container itself and p
Hixie 2015/04/13 23:16:01 I could go either way. Will discuss this offline.
+ // set skyNode.width (e.g., set it to skyNode.parentNode.width)
+ // for each skyNode.getChildNodes()[i]:
+ // call .layout()
+ // set .x, .y
+ // set .width if you want to force a width
ojan 2015/04/13 21:49:27 Setting width here wouldn't work for the BlockLayo
Hixie 2015/04/13 23:16:01 That was basically how I'd designed my custom layo
+ // set .height if you want to force a height
+ // set skyNode.height
+
ojan 2015/04/13 21:49:27 ditto
+}
+
class Image extends SkyElementWrapper {
String get _tagName => 'img';

Powered by Google App Engine
This is Rietveld 408576698