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

Issues when items are not of uniform size #40

Open
spacecowboy opened this issue Aug 11, 2024 · 9 comments
Open

Issues when items are not of uniform size #40

spacecowboy opened this issue Aug 11, 2024 · 9 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@spacecowboy
Copy link

First, thanks for the library. It really fills a gap in the compose eco system.

I tried to see what happened when I integrated it into my app and not entirely unexpectedly it behaves a bit weird when the items in the column are of varying sizes. Here is a video with the default settings:

ScrollBarDefault2.webm

As you can see, the scrollbar changes size as you scroll and even appears to flicker at some point.

I also tried setting the length of the indicator to a fixed value:

            settings = ScrollbarSettings.Default.copy(
                thumbMaxLength = 0.1f,
                thumbMinLength = 0.1f,
            )

Which fixes the flickering, but has the side effect that the indicator can't reach the bottom of the screen:

ScrollBarFixedLength2.webm

Do you know of any setting that could be tweaked to improve the experience when the items are of varying size?

@nanihadesuka nanihadesuka self-assigned this Aug 11, 2024
@nanihadesuka nanihadesuka added the bug Something isn't working label Aug 11, 2024
@nanihadesuka
Copy link
Owner

This looks like a regression the tests didn't catch. This was working smoothly before. Will check.

@nanihadesuka
Copy link
Owner

nanihadesuka commented Aug 11, 2024

@spacecowboy are you adding by any chance padding to the lazy column like this?

                contentPadding = PaddingValues(top = 400.dp)

Try removing the contentPadding and add it as a Spacer item the list. I think there is a bug in the LazyListState that returns wrong values when contentPadding is added

@nanihadesuka
Copy link
Owner

@spacecowboy https://issuetracker.google.com/issues/358798740

I don't think I can do a workaround, so we will have to wait for this to be solved or not using contentpadding

@nanihadesuka
Copy link
Owner

Will wait for upstream updates from compose team

@nanihadesuka nanihadesuka added the wontfix This will not be worked on label Aug 11, 2024
@spacecowboy
Copy link
Author

@spacecowboy are you adding by any chance padding to the lazy column like this?

                contentPadding = PaddingValues(top = 400.dp)

Try removing the contentPadding and add it as a Spacer item the list. I think there is a bug in the LazyListState that returns wrong values when contentPadding is added

I did indeed have some vertical contentpadding. Removing it made it better, but if the thumbLength is fixed, it still can't reach the bottom. But it's better though:

3fixed.webm

But compare with the default values where it will vary in size but reach the bottom:

3default.webm

@Anthonyy232
Copy link

Anthonyy232 commented Aug 13, 2024

Have encountered the same size-varying issue, but my items are constant size -- however they are images which take a bit more to load

Here's a gist of my code while removing padding from the grid, here's the full repo

The recording:

Screen.Recording.20240812.175313.Paperize.mp4

@nanihadesuka nanihadesuka removed the wontfix This will not be worked on label Aug 13, 2024
@nanihadesuka
Copy link
Owner

Seems there are two distinct issues that are interacting together. I will recheck again in case I missed something.

@nanihadesuka
Copy link
Owner

Ok, official compose devs said this is "working as intended". Will try to find a workaround.

@nanihadesuka nanihadesuka added the enhancement New feature or request label Aug 16, 2024
@spacecowboy
Copy link
Author

Thank you for your efforts @nanihadesuka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants