Lukasz Kalnik
02/02/2022, 4:49 PMMaterialTheme
a separate typography
for a TextButton
? Currently there is only typography.button
. But in our design the regular Button
uses a different text color than a TextButton
.Joseph Hawkes-Cates
02/02/2022, 4:53 PMChris Sinco [G]
02/02/2022, 4:55 PMLukasz Kalnik
02/02/2022, 4:57 PMButton
composable?typography.button
and I cannot have different typographies for a TextButton
and a button with filled background.Chris Sinco [G]
02/02/2022, 4:58 PMcolors
parameter
• Override all styles by passing a textStyle in the Text composable within the Button content slotLukasz Kalnik
02/02/2022, 5:00 PMTextButton
. I was hoping the MaterialTheme supports such differentiation but looks like it doesn't.TextButton
with the appropriate color.Joseph Hawkes-Cates
02/02/2022, 5:01 PMLukasz Kalnik
02/02/2022, 5:01 PMChris Sinco [G]
02/02/2022, 5:02 PMMaterialTheme.typography.button
doesn’t have a color in the styleLukasz Kalnik
02/02/2022, 5:10 PMChris Sinco [G]
02/02/2022, 5:19 PMLukasz Kalnik
02/02/2022, 5:25 PMMaterialTheme
and assigning custom `TextStyle`s as needed. The only problem was that the MaterialTheme
doesn't differentiate between a Button
and TextButton
style out-of-the-box.Button
styling actually works.
So I can pass colors
to a Button
, but won't they get overridden by the theme typography through ProvideTextStyle
? What's the precedence here?ProvideTextStyle
only provides style for what's missing).Chris Sinco [G]
02/02/2022, 11:25 PMProvideTextStyle
is there to make any Text within the Button hierarchy look consistent if the user doesn’t pass an explicit style to them within the contents of the Button. But if you do pass your own style, it will override ProvideTextStyle
/ CompositionLocal
since it’s the closest resolved style in the hierarchy:
Button(onClick = { ... }) {
Text(style = customStyle)
}
Typography
in MaterialTheme
is that even though you can put colors in a TextStyle
we chose not to since the Material Design spec decouples colors from type