Android library providing Carousel for JetPack Compose
smooth scroll similar to LazyRow
Add it in your root build.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
In your module build.gradle :
dependencies {
implementation "com.github.Guri999:lazy-carousel:0.1.1"
}
CenterCarousel(
modifier = Modifier.height(200.dp),
horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
zoomedCarouselItems(
items = pokemons,
itemSize = itemSize,
zoomItemSize = itemSize * 3f,
scrollType = CarouselScrollType.INFINITE
) { item, isFocus ->
if (isFocus) name = item.second
Card(elevation = CardDefaults.elevatedCardElevation()) {
Column(
modifier = Modifier
.background(Color.White)
.padding(12.dp)
) {
Image(
painter = rememberAsyncImagePainter(
model = ImageRequest.Builder(context)
.data(item.first)
.size((itemSize * 3f).value.toInt())
.build(),
),
contentDescription = item.second,
modifier = Modifier.fillMaxSize()
)
}
}
}
}
By using the scrollType
you can enable either default scrolling or infinity scrolling
Pass any list of item to items
parameter, and it will return a item
, isFocus