commonMain.com.kizitonwose.calendar.compose.yearcalendar.YearCalendarLayoutInfo.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compose-multiplatform Show documentation
Show all versions of compose-multiplatform Show documentation
A highly customizable calendar library for Compose Multiplatform, backed by LazyRow/LazyColumn.
package com.kizitonwose.calendar.compose.yearcalendar
import androidx.compose.foundation.lazy.LazyListItemInfo
import androidx.compose.foundation.lazy.LazyListLayoutInfo
import com.kizitonwose.calendar.core.CalendarYear
/**
* Contains useful information about the currently displayed layout state of the calendar.
* For example you can get the list of currently displayed years.
*
* Use [YearCalendarState.layoutInfo] to retrieve this.
*
* @see LazyListLayoutInfo
*/
public class YearCalendarLayoutInfo(
info: LazyListLayoutInfo,
private val getIndexData: (Int) -> CalendarYear,
) : LazyListLayoutInfo by info {
/**
* The list of [YearCalendarItemInfo] representing all the currently visible years.
*/
public val visibleYearsInfo: List
get() = visibleItemsInfo.map { info ->
YearCalendarItemInfo(info, getIndexData(info.index))
}
}
/**
* Contains useful information about an individual year on the calendar.
*
* @param year The year in the list.
* @see YearCalendarLayoutInfo
* @see LazyListItemInfo
*/
public class YearCalendarItemInfo(info: LazyListItemInfo, public val year: CalendarYear) :
LazyListItemInfo by info
© 2015 - 2024 Weber Informatics LLC | Privacy Policy