Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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