https://kotlinlang.org logo
#compose
Title
# compose
a

AmrJyniat

08/18/2022, 8:56 AM
Is there a way to make all buttons color for a specific page/Composable equal X color by default?
c

Csaba Szugyiczki

08/18/2022, 9:00 AM
You can “redifine” your Theme values for a Subcomposition anywhere in your app
a

AmrJyniat

08/18/2022, 9:03 AM
How to do so?
c

Csaba Szugyiczki

08/18/2022, 9:03 AM
Just wrap your screen again with MaterialTheme (if you are using Material) or your Custom Theme
Copy code
MaterialTheme(
    colors = …,
    typography = …,
    shapes = …
) {
    // app content

    YourScreen() {
        MaterialTheme(
            colors = …,
        ) {
            // Now your screen is using the colors provided in the second MaterialTheme
        }
    }

}
s

Stylianos Gakis

08/18/2022, 9:04 AM
Owl does this, you can draw some inspiration from there. Declaration, usage #1, #2 and so on.
3 Views