浏览代码

add flex.

/main
kg 6 年前
当前提交
6cd8a007
共有 1 个文件被更改,包括 19 次插入10 次删除
  1. 29
      Assets/UIWidgets/rendering/flex.cs

29
Assets/UIWidgets/rendering/flex.cs


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;

正在加载...
取消
保存