Skip to main content
Version: 12.10.0

pageindicator

README.md

Pagination Component

The Pagination Component is a reusable view that allows you to to navigate through content in a left and right swipe gesture.

Features:

  • Allows to navigate through content in a left and right swipe gesture.
  • Allows to pass any customised composable content
  • Support for improved user experience

How to use List Item Component

  1. Add the necessary imports:

    import your.package.name.OCPageIndicator

  2. Create a immutable List of composable page items

         val pageList: List<@Composable () -> Unit> = listOf({
    Image(
    painter = painterResource(id = R.drawable.placeholder),
    contentDescription = null,
    colorFilter = ColorFilter.tint(Color.Green),
    ) },
    {
    Image(
    painter = painterResource(id = R.drawable.placeholder),
    contentDescription = null,
    colorFilter = ColorFilter.tint(Color.Green),
    )
    },
    {
    Image(
    painter = painterResource(id = R.drawable.placeholder),
    contentDescription = null,
    colorFilter = ColorFilter.tint(Color.Green),
    )
    },)

  3. Create a page state with initial page index and page count - the amount of pages the pager will have.

    val pagerState = rememberPagerState(initialPage = 0) { pageCount }

  4. Use the required page composable list and page state in your OCPageIndicator Composable:

    OCPageIndicator(pageState = pagerState, pages = pageList)