All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.kizitonwose.calendar.compose.weekcalendar.WeekCalendarLayoutInfo.kt Maven / Gradle / Ivy

Go to download

A highly customizable calendar library for Compose Multiplatform, backed by LazyRow/LazyColumn.

There is a newer version: 2.6.0-beta01
Show newest version
package com.kizitonwose.calendar.compose.weekcalendar

import androidx.compose.foundation.lazy.LazyListItemInfo
import androidx.compose.foundation.lazy.LazyListLayoutInfo
import com.kizitonwose.calendar.core.Week

/**
 * Contains useful information about the currently displayed layout state of the calendar.
 * For example you can get the list of currently displayed months.
 *
 * Use [WeekCalendarState.layoutInfo] to retrieve this.
 *
 * @see LazyListLayoutInfo
 */
public class WeekCalendarLayoutInfo(
    info: LazyListLayoutInfo,
    private val getIndexData: (Int) -> Week,
) : LazyListLayoutInfo by info {
    /**
     * The list of [WeekCalendarItemInfo] representing all the currently visible weeks.
     */
    public val visibleWeeksInfo: List
        get() = visibleItemsInfo.map { info ->
            WeekCalendarItemInfo(info, getIndexData(info.index))
        }
}

/**
 * Contains useful information about an individual week on the calendar.
 *
 * @param week The week in the list.

 * @see WeekCalendarLayoutInfo
 * @see LazyListItemInfo
 */
public class WeekCalendarItemInfo(info: LazyListItemInfo, public val week: Week) :
    LazyListItemInfo by info




© 2015 - 2024 Weber Informatics LLC | Privacy Policy