Fix HoverCard tooltip clipping in the Flutter Inspector#9823
Fix HoverCard tooltip clipping in the Flutter Inspector#9823kenzieschmoll wants to merge 14 commits intoflutter:masterfrom
Conversation
Prevents hover tooltips from being clipped by the window edges by implementing proper clamping and positioning logic in `HoverCard`. Fixes flutter#3920
There was a problem hiding this comment.
Code Review
This pull request improves hover card positioning by refactoring the offset calculation into a dedicated method and adding boundary clamping to prevent overflow and clipping. It also introduces comprehensive widget tests to verify positioning at window edges and in small viewports. The review feedback identifies issues with the vertical clamping logic in both the new _calculateCursorPosition method and the existing tooltip state, suggesting a more robust and simplified approach using clamp and math.max to ensure the tooltip remains within the top margin.
|
/gemini review again |
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where hover tooltips in the widget tree were being clipped by window boundaries. It introduces a more robust positioning logic for HoverCard by calculating the available space within the overlay and clamping the card's position accordingly. New constants were added to account for the total height of the card, including the title and divider. Additionally, comprehensive tests were added to verify the positioning logic in various scenarios. Feedback points out a potential issue with global coordinate usage when DevTools is embedded and suggests making the height calculation dynamic to avoid unnecessary gaps when a title is absent.
| final position = renderBox.localToGlobal(Offset.zero); | ||
| final size = renderBox.size; | ||
|
|
||
| // _hoverMargin = 16.0 |
There was a problem hiding this comment.
Is this commented out code?
Prevents hover tooltips from being clipped by the window edges by implementing proper clamping and positioning logic in HoverCard.
Fixes #3920