Object

RotaryScrollableDefaults

Defaults for rotaryScrollable modifier

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
public object RotaryScrollableDefaults

Defaults for rotaryScrollable modifier

Functions

behavior

@Composable
public fun behavior(
    scrollableState: ScrollableState,
    flingBehavior: FlingBehavior? = ScrollableDefaults.flingBehavior(),
    hapticFeedbackEnabled: Boolean = true,
): RotaryScrollableBehavior

Implementation of RotaryScrollableBehavior to define scrolling behaviour with or without fling - used with the rotaryScrollable 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 Scrollable state which will be scrolled while receiving rotary events.
flingBehavior Optional rotary fling behavior, pass null to turn off fling if necessary.
hapticFeedbackEnabled 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

@Composable
public fun snapBehavior(
    scrollableState: ScrollableState,
    layoutInfoProvider: RotarySnapLayoutInfoProvider,
    snapOffset: Dp = 0.dp,
    hapticFeedbackEnabled: Boolean = true,
    @FloatRange(from = 0.0, to = 1.0) snapSensitivity: Float = LowSnapSensitivity,
): RotaryScrollableBehavior

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

Parameters

scrollableState Scrollable state which will be scrolled while receiving rotary events.
layoutInfoProvider A connection between scrollable entities and rotary events.
snapOffset An optional offset to be applied when snapping the item. Defines the distance from the center of the scrollable to the center of the snapped item.
hapticFeedbackEnabled 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.
snapSensitivity Configures the sensitivity for rotary snapping. Defaults to RotaryScrollableDefaults.LowSnapSensitivity.

snapBehavior

@Composable
public fun snapBehavior(
    scrollableState: ScrollableState,
    layoutInfoProvider: RotarySnapLayoutInfoProvider,
    snapOffset: Dp = 0.dp,
    hapticFeedbackEnabled: Boolean = true,
): RotaryScrollableBehavior

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

Parameters

scrollableState Scrollable state which will be scrolled while receiving rotary events.
layoutInfoProvider A connection between scrollable entities and rotary events.
snapOffset An optional offset to be applied when snapping the item. Defines the distance from the center of the scrollable to the center of the snapped item.
hapticFeedbackEnabled 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

@Composable
public fun snapBehavior(
    scrollableState: ScalingLazyListState,
    snapOffset: Dp = 0.dp,
    hapticFeedbackEnabled: Boolean = true,
    @FloatRange(from = 0.0, to = 1.0) snapSensitivity: Float = LowSnapSensitivity,
): RotaryScrollableBehavior

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

Parameters

scrollableState ScalingLazyListState to which rotary scroll will be connected.
snapOffset An optional offset to be applied when snapping the item. Defines the distance from the center of the scrollable to the center of the snapped item.
hapticFeedbackEnabled 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.
snapSensitivity Configures the sensitivity for rotary snapping. Defaults to RotaryScrollableDefaults.LowSnapSensitivity.

snapBehavior

@Composable
public fun snapBehavior(
    scrollableState: ScalingLazyListState,
    snapOffset: Dp = 0.dp,
    hapticFeedbackEnabled: Boolean = true,
): RotaryScrollableBehavior

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

Parameters

scrollableState ScalingLazyListState to which rotary scroll will be connected.
snapOffset An optional offset to be applied when snapping the item. Defines the distance from the center of the scrollable to the center of the snapped item.
hapticFeedbackEnabled 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

@Composable
public fun snapBehavior(
    scrollableState: TransformingLazyColumnState,
    snapOffset: Dp = 0.dp,
    hapticFeedbackEnabled: Boolean = true,
    @FloatRange(from = 0.0, to = 1.0) snapSensitivity: Float = LowSnapSensitivity,
): RotaryScrollableBehavior

Implementation of RotaryScrollableBehavior to define scrolling behaviour with snap for TransformingLazyColumn - used with the rotaryScrollable modifier when snapping is required.

Parameters

scrollableState TransformingLazyColumnState to which rotary scroll will be connected.
snapOffset An optional offset to be applied when snapping the item. Defines the distance from the center of the scrollable to the center of the snapped item.
hapticFeedbackEnabled 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.
snapSensitivity Configures the sensitivity for rotary snapping. Defaults to LowSnapSensitivity.

snapBehavior

@Composable
public fun snapBehavior(
    pagerState: PagerState,
    snapOffset: Dp = 0.dp,
    hapticFeedbackEnabled: Boolean = true,
    @FloatRange(from = 0.0, to = 1.0) snapSensitivity: Float = HighSnapSensitivity,
): RotaryScrollableBehavior

Implementation of RotaryScrollableBehavior to define scrolling behaviour with snap for HorizontalPager and VerticalPager.

Parameters

pagerState PagerState to which rotary scroll will be connected.
snapOffset An optional offset to be applied when snapping the item. Defines the distance from the center of the scrollable to the center of the snapped item.
hapticFeedbackEnabled 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.
snapSensitivity Configures the sensitivity for rotary snapping. Defaults to RotaryScrollableDefaults.HighSnapSensitivity which is suitable for Pagers with at least 10 pages. See also RotaryScrollableDefaults.LowSnapSensitivity for context where there are fewer pages.

snapBehavior

@Composable
public fun snapBehavior(
    pagerState: PagerState,
    snapOffset: Dp = 0.dp,
    hapticFeedbackEnabled: Boolean = true,
): RotaryScrollableBehavior

Implementation of RotaryScrollableBehavior to define scrolling behaviour with snap for HorizontalPager and VerticalPager.

Parameters

pagerState PagerState to which rotary scroll will be connected.
snapOffset An optional offset to be applied when snapping the item. Defines the distance from the center of the scrollable to the center of the snapped item.
hapticFeedbackEnabled 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.