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
-
Add the necessary imports:
import your.package.name.OCPageIndicator
-
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),
)
},)
-
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 }
-
Use the required page composable list and page state in your OCPageIndicator Composable:
OCPageIndicator(pageState = pagerState, pages = pageList)