Commit 2c44ed0f authored by Hixie's avatar Hixie

Implement 'stretch' for flexible items.

parent 3784201b
......@@ -341,6 +341,22 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (flex > 0) {
double spaceForChild = spacePerFlex * flex;
BoxConstraints innerConstraints;
if (alignItems == FlexAlignItems.stretch) {
switch (_direction) {
case FlexDirection.horizontal:
innerConstraints = new BoxConstraints(minWidth: constraints.maxWidth,
maxWidth: constraints.maxWidth,
minHeight: constraints.minHeight,
maxHeight: constraints.maxHeight);
break;
case FlexDirection.vertical:
innerConstraints = new BoxConstraints(minWidth: constraints.minWidth,
maxWidth: constraints.maxWidth,
minHeight: constraints.maxHeight,
maxHeight: constraints.maxHeight);
break;
}
} else {
switch (_direction) {
case FlexDirection.horizontal:
innerConstraints = new BoxConstraints(maxHeight: constraints.maxHeight,
......@@ -353,6 +369,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
maxWidth: constraints.maxWidth);
break;
}
}
child.layout(innerConstraints, parentUsesSize: true);
usedSpace += _getMainSize(child);
crossSize = math.max(crossSize, _getCrossSize(child));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment