Skip to content

Commit

Permalink
Update PagerSnippets.kt rectified error
Browse files Browse the repository at this point in the history
1. Modifer.align(Alignment.BottomCenter) is replaced by 
    verticalArrangement property which is no more working

2. wrong value 10 is replaced by 4 for pageCount 

3. made text more visible by putting it inside a box
  • Loading branch information
KarthiDreamr authored Oct 22, 2023
1 parent 0c7be2b commit de41aa6
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,26 +363,28 @@ fun PagerWithTabs() {
fun PagerIndicator() {
Box {
// [START android_compose_pager_indicator]
val pageCount = 10
val pageCount = 4
val pagerState = rememberPagerState(pageCount = {
4
})
HorizontalPager(
state = pagerState
) { page ->
// Our page content
Text(
text = "Page: $page",
modifier = Modifier
.fillMaxSize()
)
Box(
modifier = Modifier.background(Color.Cyan).size(400.dp)
){
Text(
text = "Page: $page",
)
}
}
Row(
Modifier
.height(50.dp)
.fillMaxWidth()
.align(Alignment.BottomCenter),
horizontalArrangement = Arrangement.Center
.fillMaxWidth(),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.Bottom
) {
repeat(pageCount) { iteration ->
val color = if (pagerState.currentPage == iteration) Color.DarkGray else Color.LightGray
Expand Down

0 comments on commit de41aa6

Please sign in to comment.