Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent crashes during pagination and enable pagination duration configuration in animation style. #280

Merged

Conversation

ulusoyca
Copy link
Collaborator

Description

This PR addresses animation issues and assertion errors that occur during pagination animation in the WoltModalSheetAnimatedSwitcher component. To address these issues:

  1. Ensured when the animation completes, setState is only called when the widget is still mounted to avoid potential issues if the widget is disposed during the animation.
  2. Wrapped the switcher with AbsorbPointer to prevent crashes caused by interaction that changes page.
  3. Enabled setting the pagination duration animation through the AnimationStyle.

Related Issues

#279

Before After
before_animation_stop.mov
after_animation_stop.mov

Custom pagination animation duration:

350 ms 1500 ms
duration350.mov
duration1500.mov

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes tests for all changed/updated/fixed behaviors.
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • The package compiles with the minimum Flutter version stated in the pubspec.yaml

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@ulusoyca ulusoyca requested a review from TahaTesser July 28, 2024 12:34
@ulusoyca ulusoyca force-pushed the set-state-when-animation-completes-if-context-mounted branch from c33062e to 0ddde96 Compare July 28, 2024 13:31
Copy link
Collaborator

@TahaTesser TahaTesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (Optionally, test to verify there is no more crash would be nice to have)

@ibraheemalayan
Copy link

@TahaTesser
@ulusoyca

Is it possible to release the new version today?
we have to proceed with publishing the new app version

@ulusoyca ulusoyca merged commit b3213c3 into main Aug 1, 2024
3 checks passed
@ulusoyca ulusoyca deleted the set-state-when-animation-completes-if-context-mounted branch August 1, 2024 12:36
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.

3 participants