File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,9 @@ enum PercentageAnchor {
402
402
class ConstraintId {
403
403
String id;
404
404
405
+ _ConstrainedNode ? contextCacheNode;
406
+ int ? contextHash;
407
+
405
408
ConstraintId (this .id) {
406
409
left.id = this ;
407
410
top.id = this ;
@@ -410,6 +413,18 @@ class ConstraintId {
410
413
baseline.id = this ;
411
414
}
412
415
416
+ _ConstrainedNode ? getCacheNode (int hash) {
417
+ if (contextHash == hash) {
418
+ return contextCacheNode! ;
419
+ }
420
+ return null ;
421
+ }
422
+
423
+ void setCacheNode (int hash, _ConstrainedNode node) {
424
+ contextHash = hash;
425
+ contextCacheNode = node;
426
+ }
427
+
413
428
_Align left = _Align (null , _AlignType .left);
414
429
415
430
_Align top = _Align (null , _AlignType .top);
@@ -1771,11 +1786,16 @@ class _ConstraintRenderBox extends RenderBox
1771
1786
if (id == parent) {
1772
1787
return _parentNode;
1773
1788
}
1774
- _ConstrainedNode ? node = nodesMap[id];
1789
+ _ConstrainedNode ? node = id.getCacheNode (hashCode);
1790
+ if (node != null ) {
1791
+ return node;
1792
+ }
1793
+ node = nodesMap[id];
1775
1794
if (node == null ) {
1776
1795
node = _ConstrainedNode ()..nodeId = id;
1777
1796
nodesMap[id] = node;
1778
1797
}
1798
+ id.setCacheNode (hashCode, node);
1779
1799
return node;
1780
1800
}
1781
1801
You can’t perform that action at this time.
0 commit comments