Kevin Hester
02/17/2020, 6:49 PMText(
text = "9:49 AM",
modifier = LayoutPadding(left = 8.dp),
style = MaterialTheme.typography().caption.merge(
TextStyle(
color = palette.onSecondary.copy(
alpha = 0.2f
)
)
)
)
If so, what about letting TextStyles have an + operator to make their usage more similar to Modifiers?Louis Pullen-Freilich [G]
02/17/2020, 6:58 PM.copy(color =...
instead of needing to fully merge.
Although instead of copying text styles and changing opacity, you should take a look at ProvideEmphasis
- it's intended for the use case of modifying opacity of some contentKevin Hester
02/17/2020, 7:16 PMLouis Pullen-Freilich [G]
02/17/2020, 7:18 PMKevin Hester
02/17/2020, 7:22 PMProvideEmphasis(emphasis = MaterialTheme.emphasisLevels().disabled) {
Text(
text = dateFormat.format(msg.date),
modifier = LayoutPadding(left = 8.dp),
style = MaterialTheme.typography().caption
)
}
Louis Pullen-Freilich [G]
02/17/2020, 7:23 PMKevin Hester
02/17/2020, 7:24 PMLouis Pullen-Freilich [G]
02/17/2020, 7:26 PMval TimestampEmphasis = object: Emphasis {
override fun emphasize(color: Color) = color.copy(alpha = 0.12f)
}
ProvideEmphasis(TimestampEmphasis) { ... }
Kevin Hester
02/17/2020, 7:27 PM