Skip to content

Commit 22add87

Browse files
authored
Merge pull request #2 from hackware1993/milestone
fix self wrapContent bug
2 parents 383d2ef + f35f244 commit 22add87

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

lib/src/constraint_layout.dart

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,7 +2357,7 @@ class _ConstraintRenderBox extends RenderBox
23572357
child = childParentData.nextSibling;
23582358
}
23592359

2360-
parentNode.depth = childCount;
2360+
parentNode.depth = childCount + 1;
23612361

23622362
return nodesMap;
23632363
}
@@ -2741,13 +2741,13 @@ class _ConstraintRenderBox extends RenderBox
27412741
if (element.leftAlignType == _AlignType.left) {
27422742
left = element.leftConstraint!.getX();
27432743
} else {
2744-
left = element.leftConstraint!.getRight(size);
2744+
left = element.leftConstraint!.getRight(this);
27452745
}
27462746
double right;
27472747
if (element.rightAlignType == _AlignType.left) {
27482748
right = element.rightConstraint!.getX();
27492749
} else {
2750-
right = element.rightConstraint!.getRight(size);
2750+
right = element.rightConstraint!.getRight(this);
27512751
}
27522752
double leftMargin;
27532753
if (element.leftConstraint!.notLaidOut) {
@@ -2829,13 +2829,13 @@ class _ConstraintRenderBox extends RenderBox
28292829
if (element.topAlignType == _AlignType.top) {
28302830
top = element.topConstraint!.getY();
28312831
} else {
2832-
top = element.topConstraint!.getBottom(size);
2832+
top = element.topConstraint!.getBottom(this);
28332833
}
28342834
double bottom;
28352835
if (element.bottomAlignType == _AlignType.top) {
28362836
bottom = element.bottomConstraint!.getY();
28372837
} else {
2838-
bottom = element.bottomConstraint!.getBottom(size);
2838+
bottom = element.bottomConstraint!.getBottom(this);
28392839
}
28402840
double topMargin;
28412841
if (element.topConstraint!.notLaidOut) {
@@ -2956,9 +2956,9 @@ class _ConstraintRenderBox extends RenderBox
29562956
} else if (direction == BarrierDirection.top) {
29572957
list.add(node.parentData._constrainedNodeMap[id]!.getY());
29582958
} else if (direction == BarrierDirection.right) {
2959-
list.add(node.parentData._constrainedNodeMap[id]!.getRight(size));
2959+
list.add(node.parentData._constrainedNodeMap[id]!.getRight());
29602960
} else {
2961-
list.add(node.parentData._constrainedNodeMap[id]!.getBottom(size));
2961+
list.add(node.parentData._constrainedNodeMap[id]!.getBottom());
29622962
}
29632963
}
29642964
list.sort((left, right) {
@@ -2990,13 +2990,13 @@ class _ConstraintRenderBox extends RenderBox
29902990
if (node.leftAlignType == _AlignType.left) {
29912991
left = node.leftConstraint!.getX();
29922992
} else {
2993-
left = node.leftConstraint!.getRight(size);
2993+
left = node.leftConstraint!.getRight(this);
29942994
}
29952995
double right;
29962996
if (node.rightAlignType == _AlignType.left) {
29972997
right = node.rightConstraint!.getX();
29982998
} else {
2999-
right = node.rightConstraint!.getRight(size);
2999+
right = node.rightConstraint!.getRight(this);
30003000
}
30013001
double leftMargin;
30023002
if (node.leftConstraint!.notLaidOut) {
@@ -3027,7 +3027,7 @@ class _ConstraintRenderBox extends RenderBox
30273027
if (node.leftAlignType == _AlignType.left) {
30283028
left = node.leftConstraint!.getX();
30293029
} else {
3030-
left = node.leftConstraint!.getRight(size);
3030+
left = node.leftConstraint!.getRight(this);
30313031
}
30323032
if (node.leftConstraint!.notLaidOut) {
30333033
left += _getLeftInsets(goneMargin, node.percentageMargin, size.width);
@@ -3040,7 +3040,7 @@ class _ConstraintRenderBox extends RenderBox
30403040
if (node.rightAlignType == _AlignType.left) {
30413041
right = node.rightConstraint!.getX();
30423042
} else {
3043-
right = node.rightConstraint!.getRight(size);
3043+
right = node.rightConstraint!.getRight(this);
30443044
}
30453045
if (node.rightConstraint!.notLaidOut) {
30463046
right -=
@@ -3059,13 +3059,13 @@ class _ConstraintRenderBox extends RenderBox
30593059
if (node.topAlignType == _AlignType.top) {
30603060
top = node.topConstraint!.getY();
30613061
} else {
3062-
top = node.topConstraint!.getBottom(size);
3062+
top = node.topConstraint!.getBottom(this);
30633063
}
30643064
double bottom;
30653065
if (node.bottomAlignType == _AlignType.top) {
30663066
bottom = node.bottomConstraint!.getY();
30673067
} else {
3068-
bottom = node.bottomConstraint!.getBottom(size);
3068+
bottom = node.bottomConstraint!.getBottom(this);
30693069
}
30703070
double topMargin;
30713071
if (node.topConstraint!.notLaidOut) {
@@ -3096,7 +3096,7 @@ class _ConstraintRenderBox extends RenderBox
30963096
if (node.topAlignType == _AlignType.top) {
30973097
top = node.topConstraint!.getY();
30983098
} else {
3099-
top = node.topConstraint!.getBottom(size);
3099+
top = node.topConstraint!.getBottom(this);
31003100
}
31013101
if (node.topConstraint!.notLaidOut) {
31023102
top += _getTopInsets(goneMargin, node.percentageMargin, size.height);
@@ -3109,7 +3109,7 @@ class _ConstraintRenderBox extends RenderBox
31093109
if (node.bottomAlignType == _AlignType.top) {
31103110
bottom = node.bottomConstraint!.getY();
31113111
} else {
3112-
bottom = node.bottomConstraint!.getBottom(size);
3112+
bottom = node.bottomConstraint!.getBottom(this);
31133113
}
31143114
if (node.bottomConstraint!.notLaidOut) {
31153115
bottom -=
@@ -3124,7 +3124,7 @@ class _ConstraintRenderBox extends RenderBox
31243124
offsetY = node.baselineConstraint!.getY() -
31253125
node.getDistanceToBaseline(node.textBaseline, false);
31263126
} else if (node.baselineAlignType == _AlignType.bottom) {
3127-
offsetY = node.baselineConstraint!.getBottom(size) -
3127+
offsetY = node.baselineConstraint!.getBottom(this) -
31283128
node.getDistanceToBaseline(node.textBaseline, false);
31293129
} else {
31303130
offsetY = node.baselineConstraint!
@@ -3585,16 +3585,16 @@ class _ConstrainedNode {
35853585
return offset.dy;
35863586
}
35873587

3588-
double getRight([Size? size]) {
3588+
double getRight([RenderBox? parent]) {
35893589
if (isParent()) {
3590-
return size!.width;
3590+
return parent!.size.width;
35913591
}
35923592
return getX() + getMeasuredWidth();
35933593
}
35943594

3595-
double getBottom([Size? size]) {
3595+
double getBottom([RenderBox? parent]) {
35963596
if (isParent()) {
3597-
return size!.height;
3597+
return parent!.size.height;
35983598
}
35993599
return getY() + getMeasuredHeight();
36003600
}
@@ -4163,14 +4163,10 @@ class _BarrierRenderBox extends _HelperBox {
41634163
constraintBoxData._referencedIds = referencedIds;
41644164
if (direction == BarrierDirection.top ||
41654165
direction == BarrierDirection.bottom) {
4166-
constraintBoxData.width = matchParent;
4167-
constraintBoxData.height = 0;
41684166
constraintBoxData.top = parent.top;
41694167
constraintBoxData.left = parent.left;
41704168
constraintBoxData.right = parent.right;
41714169
} else {
4172-
constraintBoxData.width = 0;
4173-
constraintBoxData.height = matchParent;
41744170
constraintBoxData.left = parent.left;
41754171
constraintBoxData.top = parent.top;
41764172
constraintBoxData.bottom = parent.bottom;

0 commit comments

Comments
 (0)