RevealState
@ExperimentalWearFoundationApi
class RevealState
A class to keep track of the state of the composable. It can be used to customise the behavior and state of the composable.
Summary
Public functions |
|
|---|---|
suspend Unit |
animateTo(targetValue: RevealValue)Animates to the |
suspend Unit |
snapTo(targetValue: RevealValue)Snaps to the |
Public properties |
|
|---|---|
RevealValue |
The current |
Boolean |
Returns whether the animation is running or not. |
RevealActionType |
|
Float |
The current amount by which the revealable content has been revealed by. |
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. |
Map<RevealValue, Float> |
Defines the anchors for revealable content. |
RevealValue |
The target |
MutableFloatState |
The total width of the component in pixels. |
Public functions
animateTo
suspend fun animateTo(targetValue: RevealValue): Unit
Animates to the targetValue with the animation spec provided.
| Parameters | |
|---|---|
targetValue: RevealValue |
The target |
| Throws | |
|---|---|
kotlin.IllegalStateException |
if the target |
snapTo
suspend fun snapTo(targetValue: RevealValue): Unit
Snaps to the targetValue without any animation.
| Parameters | |
|---|---|
targetValue: RevealValue |
The target |
| See also | |
|---|---|
swipeableV2 |
Public properties
currentValue
val currentValue: RevealValue
The current RevealValue based on the status of the component.
| See also | |
|---|---|
swipeableV2 |
val isAnimationRunning: Boolean
Returns whether the animation is running or not.
| See also | |
|---|---|
swipeableV2 |
val offset: Float
The current amount by which the revealable content has been revealed by.
| See also | |
|---|---|
swipeableV2 |
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.
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.
| See also | |
|---|---|
swipeableV2 |
targetValue
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.
| See also | |
|---|---|
swipeableV2 |
val width: MutableFloatState
The total width of the component in pixels. Initialise to zero, updated when the width changes.