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

Unified Diff: sky/sdk/lib/rendering/flex.dart

Issue 1229353002: Support for FlexAlignItems.stretch. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/flex.dart
diff --git a/sky/sdk/lib/rendering/flex.dart b/sky/sdk/lib/rendering/flex.dart
index 5f8f6e38991470dbc33cdc6388bee27b6e2f5806..a220fb17de7900507b8fd29a2c14de6b67100756 100644
--- a/sky/sdk/lib/rendering/flex.dart
+++ b/sky/sdk/lib/rendering/flex.dart
@@ -33,6 +33,7 @@ enum FlexAlignItems {
start,
end,
center,
+ stretch,
}
typedef double _ChildSizingFunction(RenderBox child, BoxConstraints constraints);
@@ -282,8 +283,23 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
if (flex > 0) {
totalFlex += child.parentData.flex;
} else {
- BoxConstraints innerConstraints = new BoxConstraints(maxHeight: constraints.maxHeight,
- maxWidth: constraints.maxWidth);
+ BoxConstraints innerConstraints;
+ if (alignItems == FlexAlignItems.stretch) {
+ switch (_direction) {
+ case FlexDirection.horizontal:
+ innerConstraints = new BoxConstraints(maxWidth: constraints.maxWidth,
+ minHeight: constraints.minHeight,
+ maxHeight: constraints.maxHeight);
+ break;
+ case FlexDirection.vertical:
+ innerConstraints = new BoxConstraints(minWidth: constraints.minWidth,
+ maxWidth: constraints.maxWidth,
+ maxHeight: constraints.maxHeight);
+ break;
+ }
+ } else {
+ innerConstraints = constraints.loosen();
+ }
child.layout(innerConstraints, parentUsesSize: true);
freeSpace -= _getMainSize(child);
crossSize = math.max(crossSize, _getCrossSize(child));
@@ -366,6 +382,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
assert(child.parentData is FlexBoxParentData);
double childCrossPosition;
switch (_alignItems) {
+ case FlexAlignItems.stretch:
case FlexAlignItems.start:
childCrossPosition = 0.0;
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698