DeferredTransitionState

class DeferredTransitionState<S>(initialState: S) : TransitionState<S>

A TransitionState that supports a deferred phase before the automatic transition begins.

This state is designed for scenarios where a transition should be held in an intermediate, manually-controlled state (e.g., during a predictive back gesture) before proceeding to its final target.

While in the deferred phase (initiated by defer), the transition holds the new target as a pendingTargetState. The actual targetState remains unchanged, keeping the transition in its current visual state. Once animateTo is called, the pendingTargetState is cleared and the transition proceeds to the new targetState, triggering its automatic animations.

Parameters

initialState

The initial state of the transition.

Constructors

Link copied to clipboard
constructor(initialState: S)

Properties

Link copied to clipboard
open override var currentState: S

Current state of the transition. If there is an active transition, currentState and targetState are different.

Link copied to clipboard

The target state that the transition will eventually animate to once the deferred phase ends.

Link copied to clipboard
open override var targetState: S

Target state of the transition. If this is the same as currentState, no transition is active.

Functions

Link copied to clipboard
fun animateTo(targetState: S)

Clears the pendingTargetState and updates the targetState to the provided targetState, ending the deferred phase and starting the automatic transition animation.

Link copied to clipboard
fun defer(targetState: S)

Updates the pendingTargetState and initiates the deferred phase.