Package com.google.accompanist.pager

Types

Link copied to clipboard
annotation class ExperimentalPagerApi
Link copied to clipboard
object PagerDefaults

Contains the default values used by HorizontalPager and VerticalPager.

Link copied to clipboard
interface PagerScope

Scope for HorizontalPager content.

Link copied to clipboard
class PagerState(currentPage: Int = 0) : ScrollableState

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

Functions

Link copied to clipboard
fun PagerScope.calculateCurrentOffsetForPage(page: Int): Float

Calculate the offset for the given page from the current scroll position. This is useful when using the scroll position to apply effects or animations to items.

Link copied to clipboard
fun HorizontalPager(    count: Int,     modifier: Modifier = Modifier,     state: PagerState = rememberPagerState(),     reverseLayout: Boolean = false,     itemSpacing: Dp = 0.dp,     contentPadding: PaddingValues = PaddingValues(0.dp),     verticalAlignment: Alignment.Vertical = Alignment.CenterVertically,     flingBehavior: FlingBehavior = PagerDefaults.flingBehavior( state = state, endContentPadding = contentPadding.calculateEndPadding(LayoutDirection.Ltr), ),     key: (page: Int) -> Any? = null,     content: @Composable PagerScope.(page: Int) -> Unit)

A horizontally scrolling layout that allows users to flip between items to the left and right.

Link copied to clipboard
fun rememberPagerState(initialPage: Int = 0): PagerState

Creates a PagerState that is remembered across compositions.

Link copied to clipboard
fun VerticalPager(    count: Int,     modifier: Modifier = Modifier,     state: PagerState = rememberPagerState(),     reverseLayout: Boolean = false,     itemSpacing: Dp = 0.dp,     contentPadding: PaddingValues = PaddingValues(0.dp),     horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally,     flingBehavior: FlingBehavior = PagerDefaults.flingBehavior( state = state, endContentPadding = contentPadding.calculateBottomPadding(), ),     key: (page: Int) -> Any? = null,     content: @Composable PagerScope.(page: Int) -> Unit)

A vertically scrolling layout that allows users to flip between items to the top and bottom.