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 {
402402class ConstraintId {
403403 String id;
404404
405+ _ConstrainedNode ? contextCacheNode;
406+ int ? contextHash;
407+
405408 ConstraintId (this .id) {
406409 left.id = this ;
407410 top.id = this ;
@@ -410,6 +413,18 @@ class ConstraintId {
410413 baseline.id = this ;
411414 }
412415
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+
413428 _Align left = _Align (null , _AlignType .left);
414429
415430 _Align top = _Align (null , _AlignType .top);
@@ -1771,11 +1786,16 @@ class _ConstraintRenderBox extends RenderBox
17711786 if (id == parent) {
17721787 return _parentNode;
17731788 }
1774- _ConstrainedNode ? node = nodesMap[id];
1789+ _ConstrainedNode ? node = id.getCacheNode (hashCode);
1790+ if (node != null ) {
1791+ return node;
1792+ }
1793+ node = nodesMap[id];
17751794 if (node == null ) {
17761795 node = _ConstrainedNode ()..nodeId = id;
17771796 nodesMap[id] = node;
17781797 }
1798+ id.setCacheNode (hashCode, node);
17791799 return node;
17801800 }
17811801
You can’t perform that action at this time.
0 commit comments