Daniele B
05/24/2021, 8:59 AMiconComposable and textComposable based on the selected flag. How should I do this correct?Bino
05/24/2021, 9:03 AMBino
05/24/2021, 9:06 AMval color by animateColorAsState(
targetColor = if (!isSelected) Color.Red else Color.Green,
animationSpec = tween(durationMillis = 1000)
)Daniele B
05/24/2021, 9:09 AMiconComposable and the textComposable though?Bino
05/24/2021, 9:15 AM@Composable
fun iconComposable(color: Color) {
You could also put the selectionState into the composable but to reuse the same color I would put it into the callers codeDaniele B
05/24/2021, 9:28 AMBino
05/24/2021, 9:56 AMval color by animateColorAsState(
targetValue = if (!isSelected) MaterialTheme.colors.primary else MaterialTheme.colors.error,
animationSpec = tween(durationMillis = 1000)
)Albert Chang
05/24/2021, 10:06 AMLocalContentColor. Example.Daniele B
05/24/2021, 10:14 AM