Repository navigation
fix: cancel fade-out timer on dispose and guard reverse with mounted - #13
Open
codivo-erill wants to merge 1 commit into
Open
codivo-erill wants to merge 1 commit into
codivo-erill wants to merge 1 commit into
Conversation
Closing a page within the auto-hide duration after scrolling made the pending fade-out timer call reverse() on the disposed opacity controller. Bump version to 1.1.1.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When a page containing a
RoundScrollbaris closed withinautoHideDuration(default 3 s) after theuser scrolled, the pending fade-out timer fires after the state was disposed and calls
_opacityController.reverse()on a disposed controller:AnimationController.reverse() called after AnimationController.dispose()(
round_scrollbar.dart:172, from_RoundScrollbarState._maybeHideAfterDelay)Null check operator used on a null valueinAnimationController.stop(_ticker!.stop)On Wear OS this happens all the time when rotating the crown in a list and then swiping back.
Fix
dispose()now cancels_fadeOutTimer.reverse()whilemounted, as a safety net.This covers the same case as #12 and additionally cancels the timer, so nothing is left running after
dispose.
Tests
Lifecycle › GIVEN visible scrollbar WHEN it is disposed before the autoHide duration elapses THEN the pending fade-out does not touch the disposed controller.flutter test: all 21 tests pass.flutter analyze: no issues.Version
Bumped to 1.1.1 with a CHANGELOG entry.