
commonMain.io.wojciechosak.calendar.view.HorizontalCalendarView.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of calendar-jvm Show documentation
Show all versions of calendar-jvm Show documentation
Kotlin Compose Multiplatform UI library that simplifies usage of calendar views
package io.wojciechosak.calendar.view
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun HorizontalCalendarView(
modifier: Modifier = Modifier,
calendarView: @Composable (monthOffset: Int) -> Unit,
) {
HorizontalPager(
state = rememberPagerState(
initialPage = Int.MAX_VALUE / 2,
pageCount = { Int.MAX_VALUE },
),
modifier = modifier.fillMaxWidth(),
beyondBoundsPageCount = 0,
) {
val index = it - Int.MAX_VALUE / 2
Column {
calendarView(index)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy