Start native apps faster with the Composables CLI ->
Class

RevealState

A class to keep track of the state of the composable.

Source set: Android
public class RevealState internal constructor(
    initialValue: RevealValue,
    animationSpec: AnimationSpec<Float>,
    confirmValueChange: (RevealValue) -> Boolean,
    positionalThreshold: (totalDistance: Float) -> Float,
    internal val anchors: Map<RevealValue, Float>,
    internal val coroutineScope: CoroutineScope,
    internal val nestedScrollDispatcher: NestedScrollDispatcher,
)

A class to keep track of the state of the composable. It can be used to customise the behavior and state of the composable.

Properties

lastActionType

Source set: Android
public var lastActionType: RevealActionType by mutableStateOf(RevealActionType.None)

currentValue

Source set: Android
public val currentValue: RevealValue

The current RevealValue based on the status of the component.

targetValue

Source set: Android
public val targetValue: RevealValue

The target RevealValue based on the status of the component. This will be equal to the currentValue if there is no animation running or swiping has stopped. Otherwise, this returns the next RevealValue based on the animation/swipe direction.

isAnimationRunning

Source set: Android
public val isAnimationRunning: Boolean

Returns whether the animation is running or not.

offset

Source set: Android
public val offset: Float

The current amount by which the revealable content has been revealed by.

swipeAnchors

Source set: Android
public val swipeAnchors: Map<RevealValue, Float>

Defines the anchors for revealable content. These anchors are used to determine the width at which the revealable content can be revealed to and stopped without requiring any input from the user.

revealThreshold

Source set: Android
public val revealThreshold: Float

The threshold, in pixels, where the revealed actions are fully visible but the existing content would be left in place if the reveal action was stopped. This threshold is used to create the anchor for RevealValue.RightRevealing. If there is no such anchor defined for RevealValue.RightRevealing, it returns 0.0f. / /* @FloatRange(from = 0.0)

width

Source set: Android
public val width: MutableFloatState = mutableFloatStateOf(0.0f)

The total width of the component in pixels. Initialise to zero, updated when the width changes.

Functions

snapTo

Source set: Android
public suspend fun snapTo(targetValue: RevealValue)

Snaps to the targetValue without any animation.

Parameters

targetValue The target RevealValue where the currentValue will be changed to.

animateTo

Source set: Android
public suspend fun animateTo(targetValue: RevealValue)

Animates to the targetValue with the animation spec provided.

Parameters

targetValue The target RevealValue where the currentValue will animate to.

Throws: IllegalStateException

if the target RevealValue is not valid for current RevealState instance.