• Jasper van Riet's avatar
    Introduce `exitDuration` to Tooltip for mouse pointer devices (#138321) · 3c422dd7
    Jasper van Riet authored
    This PR introduces a new property `exitDuration` to Tooltip, the counterpart to `waitDuration`. The need for this is shown by #136586. This changes the behaviour of `showDuration` on mouse pointer devices. This is because the use cases for the current behaviour on touch screen devices vs mouse pointer devices is fundamentally different.
    
    <details>
    <summary>Demo: tooltip with showDuration set</summary>
    
    Tooltip disappears after 100 ms when moving away the mouse. Tooltip will not disappear when hovered.
    
    https://github.com/flutter/flutter/assets/5138348/81d36dc9-78e0-4723-a84b-2552843ee181
    
    </details>
    
    Currently, when `showDuration` is set, this adjusts the time it takes for the tooltip to hide _after_ a mouse pointer has left the tooltip. This is not the same use case as its effect on touch screen devices, where it dictates how long the tooltip stays on screen after a long press. That is needed because the tooltip takes up screen space and there is not an intuitive way to hide it, whereas when using a mouse users expect to simply have to hover somewhere else. Having the tooltip stay around will look broken.
    
    Thus, this PR splits the two use cases. `showDuration` no longer affects mouse pointer devices at all*. There is a precedent for such mouse pointer-only behaviour in `waitDuration`. Instead, I have split up the two use cases and created the new property `exitDuration`, which will still allow for tweaking the time it takes for the tooltip to hide after the user has moved their mouse pointer somewhere else.
    
    *Note: Should `showDuration` affect [this line](https://github.com/flutter/flutter/blob/e33d4b86270e3c012ba13d68d6e90f2eabc4912b/packages/flutter/lib/src/material/tooltip.dart#L610)?
    
    Fixes #136586.
    
    Note: I noticed that when I made the change, no tests were broken. Hopefully, the tests added here help that in the future. I also noticed that in the _existing_ tests, the `waitDuration` tests contain assertions that implicate that it is the role of `waitDuration` to change this behaviour, but that's not currently (nor in the new behaviour) true, so I have fixed those tests.
    3c422dd7
Name
Last commit
Last update
..
action_buttons Loading commit data...
action_chip Loading commit data...
animated_icon Loading commit data...
app Loading commit data...
appbar Loading commit data...
autocomplete Loading commit data...
bottom_navigation_bar Loading commit data...
bottom_sheet Loading commit data...
card Loading commit data...
checkbox_list_tile Loading commit data...
choice_chip Loading commit data...
context_menu Loading commit data...
data_table Loading commit data...
date_picker Loading commit data...
dialog Loading commit data...
divider Loading commit data...
drawer Loading commit data...
dropdown Loading commit data...
dropdown_menu Loading commit data...
elevated_button Loading commit data...
expansion_panel Loading commit data...
expansion_tile Loading commit data...
filled_button Loading commit data...
filter_chip Loading commit data...
floating_action_button Loading commit data...
icon_button Loading commit data...
ink Loading commit data...
ink_well Loading commit data...
input_chip Loading commit data...
input_decorator Loading commit data...
list_tile Loading commit data...
menu_anchor Loading commit data...
navigation_bar Loading commit data...
navigation_drawer Loading commit data...
navigation_rail Loading commit data...
outlined_button Loading commit data...
page_transitions_theme Loading commit data...
paginated_data_table Loading commit data...
popup_menu Loading commit data...
progress_indicator Loading commit data...
radio Loading commit data...
radio_list_tile Loading commit data...
refresh_indicator Loading commit data...
reorderable_list Loading commit data...
scaffold Loading commit data...
scrollbar Loading commit data...
search_anchor Loading commit data...
slider Loading commit data...
snack_bar Loading commit data...
stepper Loading commit data...
switch Loading commit data...
switch_list_tile Loading commit data...
tabs Loading commit data...
text_button Loading commit data...
text_field Loading commit data...
theme_data Loading commit data...
time_picker Loading commit data...
toggle_buttons Loading commit data...
tooltip Loading commit data...