Repository navigation
Conversation
SheetController.jumpTo moves the sheet to the given offset immediately, without animating, and keeps it idle with that offset as its target, so the position is re-resolved whenever the viewport or the content changes. animateTo cannot do this: it requires a positive duration, even a tiny one shows the old offset for at least one frame, and on completion the sheet settles to the nearest snap offset rather than keeping a target between snaps. jumpTo mirrors ScrollController.jumpTo.
Owner
|
Hi @fryette, I looks like this is a duplicate of #552. Can you take a look at this comment? |
Contributor
Author
|
Thanks, and sorry I missed #552. I've answered your question in #551 (comment). My use case is programmatic placement of sheets that are still draggable, not finger following. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SheetController gains jumpTo(SheetOffset), which moves the sheet to the given offset immediately, without animating, mirroring ScrollController.jumpTo. The sheet stays idle with that offset as its target, so the position is re-resolved whenever the viewport or the content changes (for example a viewport that is resized after the jump), until another movement such as a drag or animateTo begins. A running animation that jumpTo interrupts completes its future, as it does for any other interruption.
animateTo cannot be used for this: AnimatedSheetActivity asserts that the duration is positive, even a tiny duration shows the old offset for at least one frame, and on completion the sheet calls goBallistic(0), so a target that lies between snap offsets is not kept.
Related to #551; the use case is described in #551 (comment).