Benjamin Deroche
10/03/2023, 8:58 AM@Composable
, then how do I get access to MaterialTheme
there?
@Composable
fun Modifier.underlined(
strokeWidth: Float = 8f,
color: Color = MaterialTheme.colors.primary
) = composed(
factory = {
drawBehind {
val width: Float = size.width
val height: Float = size.height - strokeWidth / 2
drawLine(
color = color,
start = Offset(x = 0f, y = height),
end = Offset(x = width, y = height),
strokeWidth = strokeWidth
)
}
}
)
Blundell
10/03/2023, 9:05 AMascii
10/03/2023, 5:37 PMcomposed
is more for stateful modifiers. Its overkill for something as simple as accessing theme colors, and comes with a (minor?) performance cost too.