SwipeToRevealDefaults

object SwipeToRevealDefaults


An internal object containing some defaults used across the Swipe to reveal component.

Summary

Public functions

GestureInclusion
gestureInclusion(
    state: RevealState,
    edgeZoneFraction: @FloatRange(from = 0.0, to = 1.0) Float
)

The default behaviour for when SwipeToReveal should handle gestures.

Public properties

Float

The default value used to configure the size of the left edge zone in a SwipeToReveal.

(totalDistance: Float) -> Float

Default position threshold that needs to be swiped in order to transition to the next state.

Float

Default ratio of the content displayed when in RevealValue.RightRevealing state, i.e. all the actions are revealed and the top content is not being swiped.

GestureInclusion

A behaviour for SwipeToReveal to handle all gestures, intended for rare cases where bidirectional anchors are used and no swipe events are ignored

Public functions

gestureInclusion

Added in 1.5.0-alpha12
fun gestureInclusion(
    state: RevealState,
    edgeZoneFraction: @FloatRange(from = 0.0, to = 1.0) Float = LeftEdgeZoneFraction
): GestureInclusion

The default behaviour for when SwipeToReveal should handle gestures. In this implementation of GestureInclusion, swipe events that originate in the left edge of the screen (as determined by LeftEdgeZoneFraction) will be ignored, if the RevealState is RevealValue.Covered. This allows swipe-to-dismiss handlers (if present) to handle the gesture in this region.

Parameters
state: RevealState

RevealState of the SwipeToReveal.

edgeZoneFraction: @FloatRange(from = 0.0, to = 1.0) Float = LeftEdgeZoneFraction

The fraction of the screen width from the left edge where gestures should be ignored. Defaults to LeftEdgeZoneFraction.

Public properties

LeftEdgeZoneFraction

Added in 1.5.0-alpha12
val LeftEdgeZoneFractionFloat

The default value used to configure the size of the left edge zone in a SwipeToReveal. The left edge zone in this case refers to the leftmost edge of the screen, in this region it is common to disable scrolling in order for swipe-to-dismiss handlers to take over.

PositionalThreshold

Added in 1.5.0-alpha12
val PositionalThreshold: (totalDistance: Float) -> Float

Default position threshold that needs to be swiped in order to transition to the next state. Used in conjunction with RevealingRatio; for example, a threshold of 0.5 with a revealing ratio of 0.7 means that the user needs to swipe at least 35% (0.5 * 0.7) of the component width to go from RevealValue.Covered to RevealValue.RightRevealing and at least 85% (0.7 + 0.5 * (1 - 0.7)) of the component width to go from RevealValue.RightRevealing to RevealValue.RightRevealed.

RevealingRatio

Added in 1.5.0-alpha12
val RevealingRatioFloat

Default ratio of the content displayed when in RevealValue.RightRevealing state, i.e. all the actions are revealed and the top content is not being swiped. For example, a value of 0.7 means that 70% of the width is used to place the actions.

bidirectionalGestureInclusion

Added in 1.5.0-alpha12
val bidirectionalGestureInclusionGestureInclusion

A behaviour for SwipeToReveal to handle all gestures, intended for rare cases where bidirectional anchors are used and no swipe events are ignored