SwipeableDefaults

Added in 1.0.0
Deprecated in 1.6.0

Contains useful defaults for swipeable and SwipeableState.

Summary

Constants

const Float

A standard resistance factor which indicates that the user has run out of things to see.

Cmn
const Float

A stiff resistance factor which indicates that swiping isn't available right now.

Cmn

Public functions

ResistanceConfig?
resistanceConfig(
    anchors: Set<Float>,
    factorAtMin: Float,
    factorAtMax: Float
)

The default resistance config used by swipeable.

Cmn

Public properties

SpringSpec<Float>

The default animation used by SwipeableState.

Cmn
Dp

The default velocity threshold (1.8 dp per millisecond) used by swipeable.

Cmn

Constants

StandardResistanceFactor

const val StandardResistanceFactor = 10.0f: Float

A standard resistance factor which indicates that the user has run out of things to see.

StiffResistanceFactor

const val StiffResistanceFactor = 20.0f: Float

A stiff resistance factor which indicates that swiping isn't available right now.

Public functions

resistanceConfig

fun resistanceConfig(
    anchors: Set<Float>,
    factorAtMin: Float = StandardResistanceFactor,
    factorAtMax: Float = StandardResistanceFactor
): ResistanceConfig?

The default resistance config used by swipeable.

This returns null if there is one anchor. If there are at least two anchors, it returns a ResistanceConfig with the resistance basis equal to the distance between the two bounds.

Public properties

AnimationSpec

val AnimationSpecSpringSpec<Float>

The default animation used by SwipeableState.

VelocityThreshold

val VelocityThresholdDp

The default velocity threshold (1.8 dp per millisecond) used by swipeable.