Closed yakagami closed 7 months ago
Looks like someone made a similar PR already here: https://github.com/google/flutter.widgets/pull/487. I think exposing position is also important as noted in the comments there.
Looking into this further it seems jumpToOffset
doesn't work for large offsets as explained here: https://github.com/google/flutter.widgets/issues/460#issuecomment-1522558856. It worked for my use case as well as in the test that I added here though
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 usejumpToOffset
as justjumpTo
by subtracting the initial offset. Exposing ScrollPosition is useful for it'sdrag
method which is similar to animateScroll but can be used with DragUpdateDetails from eg. onVerticalDragStart in a GestureDetector.Fixes https://github.com/google/flutter.widgets/issues/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.flutter test
pass.flutter analyze
does not report any problems on my PR.