Colton Idle
07/11/2022, 5:09 PM@Composable
fun MyText(text: String, style:MyTextStyle, color: Color) {
val selectedStyle = when (style) {
MyTextStyle.H1 -> MyTypography.H1 //maps enum to TextStyle
MyTextStyle.H2 -> MyTypography.H2
}
Text(text = text, color = color, style = selectedStyle)
}
Does this seem like a bad idea to anyone? The map of an enum to a text style feels off, but I think this would get the job done.Francesc
07/11/2022, 6:07 PM@Composable
fun HeaderText(text: String, color: Color, ...) {
Text(
text = text,
style = MaterialTheme.typography.h1,
...
}
and similar for every other oneZoltan Demant
07/12/2022, 5:42 AM