I'm trying to create a VerticalPager, where the first item in the pager is kind of a "header", therefore I want it's height to be smaller then all the other pages. so the height should be kind of "wrapped", and then the other heights should be the same.
I tried something like this but it doesn't work, and the first item is still in the same size as all the other pages:
val pagerState = rememberPagerState { it.size }
VerticalPager(
modifier = Modifier.wrapContentHeight(),
beyondBoundsPageCount = 0,
pageSpacing = 22.dp,
contentPadding = PaddingValues(horizontal = horizontalPad),
pageSize = object : PageSize {
override fun Density.calculateMainAxisPageSize(
availableSpace: Int,
pageSpacing: Int
): Int {
return ((availableSpace - 2 * pageSpacing) * 0.8f).toInt()
}
},
state = pagerState,
) { idx ->
if (idx == 0) { ... } else { ... }
}
maybe I can manipulate some other attrivutes in order to make the PageSize of the first item different?
thanks