fix: Seek indicators get stuck as mounted but invisible #752
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.
The usual double-tap-to-seek code flow is:
_mountSeek[...]Button
totrue
(mounting the indicator and starting its animation) and starts a submission timer.onSubmitted
, which sets_hideSeek[...]Button
totrue
.build()
runs,_hideSeek[...]Button
causes the animation to be restarted, now going backwards and hiding the indicator._hide[...]Button
istrue
, and sets it and_mountSeek[...]Button
tofalse
, completely unmounting the indicator.However, if between steps 3 and 5, the user double-taps again, a new timer will be started. If that timer then invokes
onSubmitted
after step 5,_hide[...]Button
will be set totrue
while_mountSeek[...]Button
isfalse
. This means that, next time the user double-taps the screen, the animation will be run with a start and end point of0.0
, resulting inonEnd
never being called to unmount the indicator. Thus, the indicator stays mounted and still responds to touch events, but it's now completely invisible.In order to fix this, if a double-tap occurs while hiding the indicator, we can just set
_hideSeek[...]Button
back tofalse
, essentially re- starting the entire flow. This allows the user to safely interact with the indicator during the entire period that it's visible on-screen.