kizitonwose / Calendar

A highly customizable calendar view and compose library for Android.
MIT License
4.5k stars 492 forks source link

Bug with WeekCalendar #548

Open veydoge opened 1 month ago

veydoge commented 1 month ago

Library information:

Describe the bug**

Strange gap between second and third element in WeekCalendar. Also not all containers are same size when aspectRatio(1f). First two are a bit bigger than the others.

To Reproduce (if applicable)

Steps to reproduce the behavior: 1, Run in preview mode or run app

Expected behavior (if applicable)

No gap, same size

Screenshots? (if applicable)

image image

Additional information

Code used:

        val state = rememberWeekCalendarState(
            startDate = startWeek,
        endDate = endWeek,
        firstVisibleWeekDate = LocalDate.now(),
        firstDayOfWeek = DayOfWeek.MONDAY
        )
        val visibleWeek = rememberFirstVisibleWeekAfterScroll(state = state)
        Text(text = getWeekPageTitle(visibleWeek))

        WeekCalendar(
            state = state,
            dayContent = { Day(it, {}) },
        )
        Text("123")
@Composable
fun Day(day: WeekDay, onClick: (CalendarDay) -> Unit) {
    Box(
        modifier = Modifier.aspectRatio(1f).background(Color.Green),
        contentAlignment = Alignment.Center
    ) { // Change the color of in-dates and out-dates, you can also hide them completely!
        Text(
            text = day.date.dayOfMonth.toString(),
        )
    }
}