Google is committed to advancing racial equity for Black communities. See how.

ResistanceConfig

@Immutable data class ResistanceConfig
kotlin.Any
   ↳ androidx.compose.material.ResistanceConfig

Specifies how resistance is calculated in swipeable.

There are two things needed to calculate resistance: the resistance basis determines how much overflow will be consumed to achieve maximum resistance, and the resistance factor determines the amount of resistance (the larger the resistance factor, the stronger the resistance).

The resistance basis is usually either the size of the component which swipeable is applied to, or the distance between the minimum and maximum anchors. For a constructor in which the resistance basis defaults to the latter, consider using defaultResistanceConfig.

You may specify different resistance factors for each bound. Consider using one of the default resistance factors in SwipeableConstants: StandardResistanceFactor to convey that the user has run out of things to see, and StiffResistanceFactor to convey that the user cannot swipe this right now. Also, you can set either factor to 0 to disable resistance at that bound.

Summary

Public constructors
<init>(@FloatRange(0.0, 3.4E38, false) basis: Float, @FloatRange(0.0, 3.4E38) factorAtMin: Float = StandardResistanceFactor, @FloatRange(0.0, 3.4E38) factorAtMax: Float = StandardResistanceFactor)

Specifies how resistance is calculated in swipeable.

Public methods
Float

Properties
Float

Specifies the maximum amount of overflow that will be consumed.

Float

The factor by which to scale the resistance at the maximum bound.

Float

The factor by which to scale the resistance at the minimum bound.

Public constructors

<init>

ResistanceConfig(
    @FloatRange(0.0, 3.4E38, false) basis: Float,
    @FloatRange(0.0, 3.4E38) factorAtMin: Float = StandardResistanceFactor,
    @FloatRange(0.0, 3.4E38) factorAtMax: Float = StandardResistanceFactor)

Specifies how resistance is calculated in swipeable.

There are two things needed to calculate resistance: the resistance basis determines how much overflow will be consumed to achieve maximum resistance, and the resistance factor determines the amount of resistance (the larger the resistance factor, the stronger the resistance).

The resistance basis is usually either the size of the component which swipeable is applied to, or the distance between the minimum and maximum anchors. For a constructor in which the resistance basis defaults to the latter, consider using defaultResistanceConfig.

You may specify different resistance factors for each bound. Consider using one of the default resistance factors in SwipeableConstants: StandardResistanceFactor to convey that the user has run out of things to see, and StiffResistanceFactor to convey that the user cannot swipe this right now. Also, you can set either factor to 0 to disable resistance at that bound.

Parameters
basis: Float Specifies the maximum amount of overflow that will be consumed.
factorAtMin: Float = StandardResistanceFactor The factor by which to scale the resistance at the minimum bound.
factorAtMax: Float = StandardResistanceFactor The factor by which to scale the resistance at the maximum bound.

Public methods

computeResistance

fun computeResistance(overflow: Float): Float

Properties

basis

val basis: Float

Specifies the maximum amount of overflow that will be consumed.

factorAtMax

val factorAtMax: Float

The factor by which to scale the resistance at the maximum bound.

factorAtMin

val factorAtMin: Float

The factor by which to scale the resistance at the minimum bound.