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

Style improvements for 0.9.x #360

Merged
merged 1 commit into from
Oct 15, 2024
Merged

Style improvements for 0.9.x #360

merged 1 commit into from
Oct 15, 2024

Conversation

chrisbanes
Copy link
Owner

@chrisbanes chrisbanes commented Oct 15, 2024

This re-introduces a more global way to set styling properties, but this time via a new LocalHazeStyle composition local. As we now have 3 different sources for styling information, we now have documented precedence rules.

Also made the Modifier.Node implementations public, for more custom use cases.

To quickly illustrate all of the ways to set styling properties:

LocalHazeStyle

CompositionLocalProvider(LocalHazeStyle provides fooStyle) {
    Box(
       Modifier.hazeChild(state = hazeState)
    )
}

style on hazeChild

Box(
   Modifier.hazeChild(state = hazeState, style = fooStyle)
)

// or... (these are equivalent)

Box(
    Modifier.hazeChild(state = hazeState) {
        style = fooStyle
    }
)

Individual styling properties

Box(
    Modifier.hazeChild(state = hazeState) {
        tints = listOf(...)
    }
)

Fixes #340

@chrisbanes chrisbanes enabled auto-merge (squash) October 15, 2024 20:49
@chrisbanes chrisbanes merged commit 9c411e7 into main Oct 15, 2024
2 checks passed
@chrisbanes chrisbanes deleted the cb/style branch October 15, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default HazeStyle no more?
1 participant