File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,8 @@ class ConstraintId {
388388/// A relative id type that refers to a child element by its index
389389class IndexConstraintId extends ConstraintId {
390390 /// [0, childCount-1]
391+ /// -1 represents the last element
392+ /// -2 represents the second to last element, and so on
391393 final int _siblingIndex;
392394
393395 IndexConstraintId (this ._siblingIndex)
@@ -2151,6 +2153,10 @@ class _ConstraintRenderBox extends RenderBox
21512153 if (id is RelativeConstraintId ) {
21522154 int targetIndex = childIndex! + id._siblingIndexOffset;
21532155 id = IndexConstraintId (targetIndex);
2156+ } else if (id is IndexConstraintId ) {
2157+ if (id._siblingIndex < 0 ) {
2158+ id = IndexConstraintId (childCount + id._siblingIndex);
2159+ }
21542160 }
21552161
21562162 ConstrainedNode ? node;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ ConstraintId cId(String id) {
99}
1010
1111ConstraintId rId (int childIndex) {
12- assert (childIndex >= 0 );
1312 return IndexConstraintId (childIndex);
1413}
1514
You can’t perform that action at this time.
0 commit comments