🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

CarouselState

State of the Carousel which allows the user to specify the first item that is shown when the Carousel is instantiated in the constructor.

Source set: Android
class CarouselState(initialActiveItemIndex: Int = 0)

State of the Carousel which allows the user to specify the first item that is shown when the Carousel is instantiated in the constructor.

It also provides the user with support to pause and resume the auto-scroll behaviour of the Carousel.

Parameters

initialActiveItemIndex the index of the first active item

Properties

activeItemIndex

Source set: Android
var activeItemIndex by mutableIntStateOf(initialActiveItemIndex)

The index of the item that is currently displayed by the carousel

Functions

pauseAutoScroll

Source set: Android
fun pauseAutoScroll(itemIndex: Int): ScrollPauseHandle

Pauses the auto-scrolling behaviour of Carousel. The pause request is ignored if itemIndex is not the current item that is visible. Returns a ScrollPauseHandle that can be used to resume

Members

Companion

Source set: Android
companion object

Properties

Saver

Source set: Android
val Saver: Saver<CarouselState, *> =
            Saver(save = { it.activeItemIndex }, restore = { CarouselState(it) })

The default Saver implementation for CarouselState.