Skip to content

Commit

Permalink
Fixed the dot indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
D4rK7355608 committed Jul 8, 2024
1 parent e4d62eb commit 7cc9e14
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -122,7 +123,9 @@ fun MemoryManagerComposable() {
.alpha(contentAlpha)
) {
CarouselLayout(
items = listOf(storageInfo , ramInfo) , peekPreviewWidth = 24.dp
items = listOf(storageInfo, ramInfo),
peekPreviewWidth = 24.dp,
pagerState = pagerState
) { item ->
when (item) {
is StorageInfo -> StorageInfoCard(item)
Expand Down Expand Up @@ -177,10 +180,11 @@ fun MemoryManagerComposable() {
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun <T> CarouselLayout(
items : List<T> , peekPreviewWidth : Dp , itemContent : @Composable (item : T) -> Unit
items: List<T>,
peekPreviewWidth: Dp,
pagerState: PagerState,
itemContent: @Composable (item: T) -> Unit
) {
val pagerState = rememberPagerState(pageCount = { items.size })

HorizontalPager(
state = pagerState ,
modifier = Modifier.fillMaxWidth() ,
Expand Down

0 comments on commit 7cc9e14

Please sign in to comment.