Repository navigation
InteractiveViewer with a changing screen size - #60532
Merged
Merged
Conversation
LongCatIsLooong
approved these changes
Jun 29, 2020
| final RenderBox childRenderBox = _childKey.currentContext.findRenderObject() as RenderBox; | ||
| final Size childSize = childRenderBox.size; | ||
| _boundaryRectCached = widget.boundaryMargin.inflateRect(Offset.zero & childSize); | ||
| if (childRenderBox.size == _childSize && _boundaryRectCached != null) { |
Contributor
There was a problem hiding this comment.
nit: at this point the caching does seem to be worth doing anymore? You need to find the child's render box in order to verify the cache is still valid. It's only avoiding redoing the inflateRect calculation which seems cheap.
Contributor
Author
There was a problem hiding this comment.
Good call. I removed the caching. I'm assuming findRenderObject shouldn't be too much of a performance hit, but I'll watch out for slowdown.
justinmc
force-pushed
the
iv-screen-resize
branch
from
June 30, 2020 22:05
055c8aa to
1095cf9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, InteractiveViewer could get into weird states when the size of the screen changed. This PR improves this behavior by preventing the caching of boundary calculations when the size of the child has changed.
CC @not-holar
Related Issues
Mentioned in #56409 (comment)
Tests
I added the following tests:
Breaking Change
None