当某个布尔变量为真时,我 Composables 中的文本被划掉了。如何在重新组合时通过动画来改变 TextStyle,使得这条线条是淡入而不是突然出现和消失?
@Composable
fun MyComposable(
completed: Boolean
) {
val textStyle = TextStyle(textDecoration = if (completed) TextDecoration.LineThrough else null)
Text(
text = title,
color = textColor,
style = textStyle,
modifier = Modifier.align(Alignment.CenterVertically)
)