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

Consider API for manually controlling transition #17

@zach-klippenstein

Description

@zach-klippenstein

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions