object RotaryDefaults


Defaults for rotary modifiers

Summary

Public functions

RotaryBehavior
@Composable
scrollBehavior(
    scrollableState: ScrollableState,
    flingBehavior: FlingBehavior?,
    hapticFeedbackEnabled: Boolean
)

Implementation of RotaryBehavior to define scrolling behaviour with or without fling - used with the rotary modifier when snapping is not required.

RotaryBehavior
@Composable
snapBehavior(
    rotaryScrollableAdapter: RotaryScrollableAdapter,
    snapOffset: Int,
    hapticFeedbackEnabled: Boolean
)

Implementation of RotaryBehavior to define scrolling behaviour with snap - used with the rotary modifier when snapping is required.

RotaryBehavior
@Composable
snapBehavior(
    state: ScalingLazyListState,
    snapOffset: Int,
    hapticFeedbackEnabled: Boolean
)

Implementation of RotaryBehavior to define scrolling behaviour with snap for ScalingLazyColumn - used with the rotary modifier when snapping is required.

Public functions

scrollBehavior

Added in 1.4.0-alpha07
@Composable
fun scrollBehavior(
    scrollableState: ScrollableState,
    flingBehavior: FlingBehavior? = ScrollableDefaults.flingBehavior(),
    hapticFeedbackEnabled: Boolean = true
): RotaryBehavior

Implementation of RotaryBehavior to define scrolling behaviour with or without fling - used with the rotary modifier when snapping is not required.

If fling is not required, set flingBehavior = null. In that case, flinging will not happen and the scrollable content will stop scrolling immediately after the user stops interacting with rotary input.

Parameters
scrollableState: ScrollableState

Scrollable state which will be scrolled while receiving rotary events.

flingBehavior: FlingBehavior? = ScrollableDefaults.flingBehavior()

Optional rotary fling behavior, pass null to turn off fling if necessary.

hapticFeedbackEnabled: Boolean = true

Controls whether haptic feedback is given during rotary scrolling (true by default). It's recommended to keep the default value of true for premium scrolling experience.

snapBehavior

Added in 1.4.0-alpha07
@Composable
fun snapBehavior(
    rotaryScrollableAdapter: RotaryScrollableAdapter,
    snapOffset: Int = SnapOffset,
    hapticFeedbackEnabled: Boolean = true
): RotaryBehavior

Implementation of RotaryBehavior to define scrolling behaviour with snap - used with the rotary modifier when snapping is required.

Parameters
rotaryScrollableAdapter: RotaryScrollableAdapter

A connection between scrollable entities and rotary events.

snapOffset: Int = SnapOffset

An optional offset to be applied when snapping the item. After snapping, defines the offset to the center of the item.

hapticFeedbackEnabled: Boolean = true

Controls whether haptic feedback is given during rotary scrolling (true by default). It's recommended to keep the default value of true for premium scrolling experience.

snapBehavior

Added in 1.4.0-alpha07
@Composable
fun snapBehavior(
    state: ScalingLazyListState,
    snapOffset: Int = SnapOffset,
    hapticFeedbackEnabled: Boolean = true
): RotaryBehavior

Implementation of RotaryBehavior to define scrolling behaviour with snap for ScalingLazyColumn - used with the rotary modifier when snapping is required.

Parameters
state: ScalingLazyListState

ScalingLazyListState to which rotary scroll will be connected.

snapOffset: Int = SnapOffset

An optional offset to be applied when snapping the item. After snapping, defines the offset to the center of the item.

hapticFeedbackEnabled: Boolean = true

Controls whether haptic feedback is given during rotary scrolling (true by default). It's recommended to keep the default value of true for premium scrolling experience.