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

The scrollbar properties should be mutable #47

Closed
wants to merge 1 commit into from

Conversation

Hamza417
Copy link

The settings properties are stored using a data class with immutable properties. I think it'd better to have them as mutable to individually modify them on the go or as required using the .apply { } like this

LazyVerticalGridScrollbar(
    state = listState,
    settings = ScrollbarSettings.Default.apply {
        thumbUnselectedColor = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5F),
        thumbSelectedColor = MaterialTheme.colorScheme.onSurface,
    }
)

I'm not sure if a data class should have mutable properties, and a model class with setters would be a better choice here?

@nanihadesuka nanihadesuka self-assigned this Nov 30, 2024
@nanihadesuka nanihadesuka added invalid This doesn't seem right wontfix This will not be worked on labels Nov 30, 2024
@nanihadesuka
Copy link
Owner

Passing a class with public mutable parameters to a composable is a bad idea, as compose engine can't then detect changes.
What you want can be easily done by doing ScrollbarSettings.Default.copy(...)

Will close as this is not a desired change.

@Hamza417 Hamza417 deleted the patch-1 branch December 1, 2024 03:38
@Hamza417 Hamza417 restored the patch-1 branch December 1, 2024 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants