Skip to content

Fix user provided scroll controllers not being managed correctly#385

Open
pitriq wants to merge 1 commit intowoltapp:mainfrom
pitriq:fix-custom-scroll-controller-recreation
Open

Fix user provided scroll controllers not being managed correctly#385
pitriq wants to merge 1 commit intowoltapp:mainfrom
pitriq:fix-custom-scroll-controller-recreation

Conversation

@pitriq
Copy link

@pitriq pitriq commented Jun 26, 2025

Description

Hey,

I noticed that when passing a custom ScrollController to one of my sheet’s pages, it was being attached to multiple scroll views, causing an error. The issue was due to a small mistake in the code that recreates scroll controllers when pages are initialized or changed.

This PR ensures that when scroll controllers are recreated inside WoltModalSheetAnimatedSwitcher, user-provided controllers (if present) are correctly reused. It also avoids disposing them, as they're user managed.

Additionaly, I fixed the offset-tracking logic to properly track the offset of each controller — previously, it was repeatedly tracking the same controller's offset.

Related Issues

I believe one of the problems mentioned in #350 may be related to this.

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.

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