Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent padding/height #63

Open
CmdrSharp opened this issue Apr 20, 2022 · 6 comments
Open

Inconsistent padding/height #63

CmdrSharp opened this issue Apr 20, 2022 · 6 comments
Labels
Blocked Blocked by external dependency

Comments

@CmdrSharp
Copy link

Hi! Thanks for a great composable :)

I've found that the padding seems a tad inconsistent. Below are three screenshots. The text at the bottom is positioned the same across all three, but note how the calendar has padding on some months, and none on others.
From my testing, it seems that some months in each year (different for different years) get padded.

See the screenshots, where you can notice this clearly on the month April.

The following months have padding added in 2022

  • April
  • September
  • December

In 2023 the following months have padding:

  • June
  • September

And in 2024, the following:

  • August
  • November

..And so on. I find no good reason for this behaviour when looking through the source.

Here's an example to reproduce:

import androidx.compose.foundation.layout.Column
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.navigation.NavController
import io.github.boguszpawlowski.composecalendar.SelectableCalendar
import io.github.boguszpawlowski.composecalendar.rememberSelectableCalendarState
import java.time.DayOfWeek

@Composable
fun SplashScreen(navController: NavController) {
    val state = rememberSelectableCalendarState()

    Column {
        SelectableCalendar(
            calendarState = state,
            showAdjacentMonths = true,
            firstDayOfWeek = DayOfWeek.MONDAY,
        )

        Text(text = "Test")
    }
}

image
image
image

@CmdrSharp
Copy link
Author

Some further debugging: This only occurs with horizontalSwipeEnabled set to true.

@boguszpawlowski
Copy link
Owner

boguszpawlowski commented Apr 20, 2022

Hi @CmdrSharp Thank you for submitting the issue. Unfortunately, the bug is caused by Horizontal Pager, which calculates its height eagerly, thus setting it to a height of a month with 5 rows. So right now I don't think its fixable from my side, but I will check if its an expected behaviour of the pager over the weekend.

@CmdrSharp
Copy link
Author

I understand. A possible workaround is mentioned here: google/accompanist#1050

@CmdrSharp
Copy link
Author

Another interesting note @boguszpawlowski: Note how June and April have the same amount of row, yet one has padding, and one does not.

@boguszpawlowski
Copy link
Owner

@CmdrSharp Thanks for the workaround! I will see if it's fixing the problem in this case.

@boguszpawlowski
Copy link
Owner

@CmdrSharp Sorry for a late reply, I was able to try the workaround, but the results were pretty laggy and inconsistent. So, until a better workaround comes, or this will be fixed from the Accompanist side, I will leave mark this issue as blocked.

@boguszpawlowski boguszpawlowski added the Blocked Blocked by external dependency label May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked Blocked by external dependency
Projects
None yet
Development

No branches or pull requests

2 participants