Skip to content

Add delay timer for animation start and improve disposal handling#4

Open
VadymMatus wants to merge 1 commit into
Bomsamdi:mainfrom
VadymMatus:main
Open

Add delay timer for animation start and improve disposal handling#4
VadymMatus wants to merge 1 commit into
Bomsamdi:mainfrom
VadymMatus:main

Conversation

@VadymMatus

Copy link
Copy Markdown

Fix: Resolve Pending Timer Issue During Widget Disposal

Problem

During widget tests, the following error occurred when using the AutoScrollText widget with the delayBefore parameter:
A Timer is still pending even after the widget tree was disposed.

This issue arises because the widget is disposed before the _delayBeforeStartAnimation method completes its operation, leaving a pending timer.

Solution
• Replaced the _delayBeforeStartAnimation method with a direct call to start the timer (_delayTimer).
• The _initScroll method was updated to set up a new Timer for the delayBefore duration. Once the delay is over, the periodic timer is started for the scroll animation.
• Ensured that the timers are properly managed and canceled when the widget is disposed to prevent any lingering timers that may cause issues during widget tests.

Changes
• The new Timer is created with the delayBefore parameter directly inside _initScroll, instead of using a separate _delayBeforeStartAnimation method.
• Ensured that timers are disposed of correctly to prevent them from running after the widget is disposed.
• Added widget tests to validate the behavior, especially around the delayBefore parameter and its interaction with widget disposal in the context of Bouncing mode.

This update resolves the issue of pending timers during widget disposal, especially in automated tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant