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 {
388
388
/// A relative id type that refers to a child element by its index
389
389
class IndexConstraintId extends ConstraintId {
390
390
/// [0, childCount-1]
391
+ /// -1 represents the last element
392
+ /// -2 represents the second to last element, and so on
391
393
final int _siblingIndex;
392
394
393
395
IndexConstraintId (this ._siblingIndex)
@@ -2151,6 +2153,10 @@ class _ConstraintRenderBox extends RenderBox
2151
2153
if (id is RelativeConstraintId ) {
2152
2154
int targetIndex = childIndex! + id._siblingIndexOffset;
2153
2155
id = IndexConstraintId (targetIndex);
2156
+ } else if (id is IndexConstraintId ) {
2157
+ if (id._siblingIndex < 0 ) {
2158
+ id = IndexConstraintId (childCount + id._siblingIndex);
2159
+ }
2154
2160
}
2155
2161
2156
2162
ConstrainedNode ? node;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ ConstraintId cId(String id) {
9
9
}
10
10
11
11
ConstraintId rId (int childIndex) {
12
- assert (childIndex >= 0 );
13
12
return IndexConstraintId (childIndex);
14
13
}
15
14
You can’t perform that action at this time.
0 commit comments