compose-backstack
compose-backstack copied to clipboard
Consider API for manually controlling transition
The API should allow the caller to directly control the progress
used to calculate visibility for transition modifiers. When the progress is specified, the top two elements of the stack should be snapshotted and changes to the backstack should be disallowed until the caller is no longer controlling it.
The backstack viewer app should include support for this, either as a slider or from inside the screens themselves (drag on the app bar?).
Use Cases
This could be useful for debugging transitions or UIs that provide their own iOS-like "peek" back gestures.
Manual peek and controlling transitions that were triggered by new backstacks are two distinct use cases and it might not make sense to try to support both, at least with the same API.
Peek API
Add a parameter to Backstack
:
@FloatRange(0f, 1f) peekPercentage: Float? = null,
When this value is non-null, the top screen and the screen below it are shown mid-transition.
Open Questions
- How to handle when control is released mid-transition? Animate based on stack diff?
- Provide API to observe current transition progress? This would be more consistent with other declarative APIs. Default implementation observes transition progress and immediately feeds it back, but custom behavior could modify.