|
|
|
|
|
|
|
|
|
|
public class RenderFlex : RenderBoxContainerDefaultsMixinContainerRenderObjectMixinRenderBox<RenderBox, |
|
|
|
FlexParentData> { |
|
|
|
|
|
|
|
public RenderFlex( |
|
|
|
List<RenderBox> children = null, |
|
|
|
Axis direction = Axis.horizontal, |
|
|
|
|
|
|
public override void performLayout() { |
|
|
|
int totalFlex = 0; |
|
|
|
int totalChildren = 0; |
|
|
|
double maxMainSize = this._direction == Axis.horizontal ? this.constraints.maxWidth : this.constraints.maxHeight; |
|
|
|
double maxMainSize = this._direction == Axis.horizontal |
|
|
|
? this.constraints.maxWidth |
|
|
|
: this.constraints.maxHeight; |
|
|
|
bool canFlex = maxMainSize < double.PositiveInfinity; |
|
|
|
|
|
|
|
double crossSize = 0.0; |
|
|
|
|
|
|
if (this.crossAxisAlignment == CrossAxisAlignment.stretch) { |
|
|
|
switch (this._direction) { |
|
|
|
case Axis.horizontal: |
|
|
|
innerConstraints = new BoxConstraints(minHeight: this.constraints.maxHeight, |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
minHeight: this.constraints.maxHeight, |
|
|
|
innerConstraints = new BoxConstraints(minWidth: this.constraints.maxWidth, |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
minWidth: this.constraints.maxWidth, |
|
|
|
maxWidth: this.constraints.maxWidth); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
innerConstraints = new BoxConstraints(maxHeight: this.constraints.maxHeight); |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
maxHeight: this.constraints.maxHeight); |
|
|
|
innerConstraints = new BoxConstraints(maxWidth: this.constraints.maxWidth); |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
maxWidth: this.constraints.maxWidth); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
if (this.crossAxisAlignment == CrossAxisAlignment.stretch) { |
|
|
|
switch (this._direction) { |
|
|
|
case Axis.horizontal: |
|
|
|
innerConstraints = new BoxConstraints(minWidth: minChildExtent, |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
minWidth: minChildExtent, |
|
|
|
innerConstraints = new BoxConstraints(minWidth: this.constraints.maxWidth, |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
minWidth: this.constraints.maxWidth, |
|
|
|
maxWidth: this.constraints.maxWidth, |
|
|
|
minHeight: minChildExtent, |
|
|
|
maxHeight: maxChildExtent); |
|
|
|
|
|
|
switch (this._direction) { |
|
|
|
case Axis.horizontal: |
|
|
|
innerConstraints = new BoxConstraints(minWidth: minChildExtent, |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
minWidth: minChildExtent, |
|
|
|
innerConstraints = new BoxConstraints(maxWidth: this.constraints.maxWidth, |
|
|
|
innerConstraints = new BoxConstraints( |
|
|
|
maxWidth: this.constraints.maxWidth, |
|
|
|
minHeight: minChildExtent, |
|
|
|
maxHeight: maxChildExtent); |
|
|
|
break; |
|
|
|