[two_dimensional_scrollables] Fix horizontal scrolled tree view hit testing#10976
[two_dimensional_scrollables] Fix horizontal scrolled tree view hit testing#10976MousyBusiness wants to merge 3 commits intoflutter:mainfrom
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request addresses a hit-testing bug in the TreeView widget that occurred when the content was horizontally scrolled. The fix involves changing how the hit-test rectangle for each row is calculated in RenderTreeViewport. Instead of using the viewport's width, it now correctly uses the row's actual width. This ensures that the entire row is interactive, even the parts that are scrolled into view horizontally. The PR also includes the corresponding version bump and an entry in the CHANGELOG.md. The changes are correct, but a test case to cover this fix would be a valuable addition.
| final Rect rowRect = | ||
| parentData.paintOffset! & | ||
| Size(viewportDimension.width, row.size.height); | ||
| Size(row.size.width, row.size.height); |
There was a problem hiding this comment.
This change correctly fixes the hit testing issue for horizontally scrolled content. However, there doesn't appear to be a new test case that covers this specific scenario. To prevent regressions, it would be beneficial to add a test that:
- Creates a
TreeViewwith a row wider than the viewport. - Scrolls horizontally to reveal the overflowed part of the row.
- Taps on the overflowed part and asserts that the tap is correctly handled.
This would ensure the fix is working as expected and remains stable in the future.
References
- The repository style guide states that code changes should have appropriate tests. (link)
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
List which issues are fixed by this PR. You must list at least one issue.
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3