PagerState

class PagerState(@IntRange(from = 0.toLong()currentPage: Int) : ScrollableState

A state object that can be hoisted to control and observe scrolling for HorizontalPager.

In most cases, this will be created via rememberPagerState.

Parameters

currentPage

the initial value for PagerState.currentPage

Constructors

PagerState
Link copied to clipboard
fun PagerState(@IntRange(from = 0.toLong()currentPage: Int = 0)
the initial value for PagerState.currentPage

Types

Companion
Link copied to clipboard
object Companion

Functions

animateScrollToPage
Link copied to clipboard
suspend fun animateScrollToPage(@IntRange(from = 0.toLong()page: Int, @FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble()pageOffset: Float = 0f)
Animate (smooth scroll) to the given page to the middle of the viewport.
dispatchRawDelta
Link copied to clipboard
open override fun dispatchRawDelta(delta: Float): Float
scroll
Link copied to clipboard
open suspend override fun scroll(scrollPriority: MutatePriority, block: suspend ScrollScope.() -> Unit)
scrollToPage
Link copied to clipboard
suspend fun scrollToPage(@IntRange(from = 0.toLong()page: Int, @FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble()pageOffset: Float = 0f)
Instantly brings the item at page to the middle of the viewport.
toString
Link copied to clipboard
open override fun toString(): String

Properties

currentPage
Link copied to clipboard
var currentPage: Int
The index of the currently selected page.
currentPageOffset
Link copied to clipboard
val currentPageOffset: Float
The current offset from the start of currentPage, as a ratio of the page width.
interactionSource
Link copied to clipboard
val interactionSource: InteractionSource
InteractionSource that will be used to dispatch drag events when this list is being dragged.
isScrollInProgress
Link copied to clipboard
open override val isScrollInProgress: Boolean
pageCount
Link copied to clipboard
val pageCount: Int
The number of pages to display.
targetPage
Link copied to clipboard
val targetPage: Int
The target page for any on-going animations or scrolls by the user.

Sources

androidJvm source
Link copied to clipboard