Skip to content

Commit 192bedb

Browse files
committed
add comment
1 parent 6b783f7 commit 192bedb

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ reached 200 fps.**
1414
**If not necessary, try to be relative to the parent layout, so that you can define less id.**
1515

1616
**Warning**:
17-
For layout performance considerations, constraints are always one-way, and there is no two child
18-
elements that directly or indirectly restrain each other. Each constraint should describe exactly
17+
For layout performance considerations, constraints are always one-way, and there should be no two
18+
child elements directly or indirectly restrain each other. Each constraint should describe exactly
1919
where the child elements are located. Although constraints can only be one-way, you can still better
2020
handle things that were previously (Android ConstraintLayout) two-way constraints, such as chains.
2121

lib/src/constraint_layout.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class ConstraintLayout extends MultiChildRenderObjectWidget {
7373
}
7474
}
7575

76+
/// Not completed
7677
List<Widget> horizontalChain({
7778
required _Align left,
7879
required _Align right,
@@ -120,6 +121,7 @@ List<Widget> horizontalChain({
120121
return widgetList;
121122
}
122123

124+
/// Not completed
123125
List<Widget> verticalChain({
124126
_Align? top,
125127
_Align? bottom,
@@ -391,6 +393,7 @@ class Constraint {
391393
final EdgeInsets goneMargin;
392394

393395
/// These are the base constraints constraint on sibling id or parent
396+
/// The essence of constraints is alignment
394397
@_baseConstraint
395398
_Align? left;
396399
@_baseConstraint
@@ -728,7 +731,7 @@ class Constraint {
728731

729732
/// Convert wrapper constraints finish
730733
731-
/// Constraint priority: match_parent > wrapper constraints > base constraints
734+
/// Constraint priority: matchParent > wrapper constraints > base constraints
732735
if (width == matchParent) {
733736
assert(() {
734737
if (left != null || right != null) {
@@ -1681,6 +1684,9 @@ class _ConstraintRenderBox extends RenderBox
16811684
} else {
16821685
element.laidOut = true;
16831686
}
1687+
1688+
/// Due to the design of the Flutter framework, even if a child element is gone, it still has to be laid out
1689+
/// I don't understand why the official design is this way
16841690
element.renderBox!.layout(
16851691
BoxConstraints(
16861692
minWidth: minWidth,
@@ -2477,9 +2483,9 @@ class _InternalBox extends RenderBox {
24772483
constraintBoxData._referencedIds = null;
24782484
constraintBoxData.percentageTranslate = false;
24792485
constraintBoxData.minWidth = 0;
2480-
constraintBoxData.maxWidth = double.infinity;
2486+
constraintBoxData.maxWidth = matchParent;
24812487
constraintBoxData.minHeight = 0;
2482-
constraintBoxData.maxHeight = double.infinity;
2488+
constraintBoxData.maxHeight = matchParent;
24832489
}
24842490
}
24852491

0 commit comments

Comments
 (0)