Archie
09/30/2020, 8:09 AMnickbutcher
09/30/2020, 8:43 AMactiveColor
at call sites
2. Wrap the TextField
composable(s) in your own composable which configures the activeColor
param to something else and use your composable throughout.
3. Create a 'theme overlay' another theme the sets primary
to your blue color and wrap components that don't want to use the red primary in that.
cc @Louis Pullen-Freilich [G]@Composable fun MyTextField(
// copy all params from TextField
activeColor: Color = // your blue color,
) {
TextField(
// forward on params
)
}
Then you have to use this throughout. You'd obviously have to do this for all composables which you want to change the default color.@Composable fun RedTheme(…) {
MaterialTheme(
…
colors = redColors
)
}
@Composable fun BlueTheme {
MaterialTheme(
colors = blueColors
)
}
Then use the RedTheme
for most of the app but in places you want to deviate, wrap them:
…
BlueTheme {
TextField(…)
}
Archie
09/30/2020, 9:35 AMnickbutcher
09/30/2020, 10:19 AMYann Badoual
10/01/2020, 10:13 AM@ComposableAlias
annotation that you could set on a function, and said function would define only parameter that you want to override default value for. And it would generate the content, not having to keep the signature up to date each time to composable changes.
ie:
@ComposableAlias("TextField")
fun CustomTextField(
activeColor: Color = myCustomActiveColor
){
// Empty
}
And it would generate a full composable with complete signature for each TextField
function having an activeColor
parameterArchie
10/01/2020, 10:15 AMYann Badoual
10/01/2020, 11:54 AMAbstractProcessor
class in the classpath 🤷♂️Colton Idle
03/14/2021, 7:28 PM