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

Unified Diff: sky/framework/layout.dart

Issue 1128743003: [Effen] Convert action_bar.dart to using a FlexContainer. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: more better line wrapping Created 5 years, 7 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
« sky/framework/fn.dart ('K') | « 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/layout.dart
diff --git a/sky/framework/layout.dart b/sky/framework/layout.dart
index eb5ff2f39ed81309c98ba4695e67cf655e4145ca..5678fd88f35a839c39f05ea5533e5294ad1c360a 100644
--- a/sky/framework/layout.dart
+++ b/sky/framework/layout.dart
@@ -254,7 +254,11 @@ abstract class RenderCSS extends RenderBox {
sky.Element createSkyElement();
void updateStyles(List<Style> styles) {
- _skyElement.setAttribute('class', styles.map((s) => s._className).join(' '));
+ _skyElement.setAttribute('class', stylesToClasses(styles));
+ }
+
+ String stylesToClasses(List<Style> styles) {
+ return styles.map((s) => s._className).join(' ');
}
void updateInlineStyle(String newStyle) {
@@ -316,6 +320,39 @@ class RenderCSSContainer extends RenderCSS with ContainerRenderNodeMixin<RenderC
}
+class FlexBoxParentData extends CSSParentData { }
+
+enum FlexDirection { Row }
eseidel 2015/05/11 22:04:24 Did you wish to support both?
Hixie 2015/05/11 22:06:07 Eventually. I'll add column when I run into someth
+
+class RenderCSSFlex extends RenderCSSContainer {
+
+ RenderCSSFlex(debug, FlexDirection direction) : _direction = direction, super(debug);
+
+ FlexDirection _direction;
+ FlexDirection get direction => _direction;
+ void set direction (FlexDirection value) {
+ _direction = value;
+ markNeedsLayout();
+ }
+
+ void setupPos(RenderNode child) {
+ if (child.parentData is! FlexBoxParentData)
+ child.parentData = new FlexBoxParentData();
+ }
+
+ static final Style _displayFlex = new Style('display:flex');
+ static final Style _displayFlexRow = new Style('flex-direction:row');
+
+ String stylesToClasses(List<Style> styles) {
+ var settings = _displayFlex._className;
+ switch (_direction) {
+ case FlexDirection.Row: settings += ' ' + _displayFlexRow._className;
+ }
+ return super.stylesToClasses(styles) + ' ' + settings;
+ }
+
+}
+
class RenderCSSText extends RenderCSS {
RenderCSSText(debug, String newData) : super(debug) {
« sky/framework/fn.dart ('K') | « sky/framework/fn.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698