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

scrollable_positioned_list: expose position, offset and add jumpToOffset in ScrollOffsetController #515

Closed
wants to merge 3 commits into from

Conversation

yakagami
Copy link

@yakagami yakagami commented Feb 6, 2024

Description

Exposes ScrollPosition and offset of the primary Scrollable within ScrollOffsetController. Also adds jumpToOffset which is the same as animateScroll but without animation (you cannot set Duration to zero so this is necessary). Exposing position allows us to use jumpToOffset as just jumpTo by subtracting the initial offset. Exposing ScrollPosition is useful for it's drag method which is similar to animateScroll but can be used with DragUpdateDetails from eg. onVerticalDragStart in a GestureDetector.

Fixes #513

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 signed the CLA.
  • All tests from running flutter test pass.
  • flutter analyze does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

@yakagami
Copy link
Author

yakagami commented Feb 6, 2024

Looks like someone made a similar PR already here: #487. I think exposing position is also important as noted in the comments there.

@yakagami
Copy link
Author

yakagami commented Feb 6, 2024

Looking into this further it seems jumpToOffset doesn't work for large offsets as explained here: #460 (comment). It worked for my use case as well as in the test that I added here though

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.

[scrollable_positioned_list]: add jumpTo method to ScrollOffsetController
1 participant