https://kotlinlang.org logo
Title
c

Colton Idle

05/12/2023, 6:07 PM
Funny enough. Sorta similar to the above since I'm working with indication for the first time. Ripple does not run to completion if I change color of my text. If I remove my text color changing, then my ripple runs to completion. So... how do I get my ripple to complete while changing color? Code in thread
Doesn't ripple completely
@Composable
private fun BottomNavItem2(
    name: String,
    selected: Boolean,
    onClick: () -> Unit
) {
    Column(
        modifier = Modifier.clickable(
            indication = rememberRipple(false),
            onClick = onClick,
            interactionSource = MutableInteractionSource()
        ),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        val color =
            if (selected) Color.Red else Color.Blue
        Text(
            text = name,
            color = color,
            modifier = Modifier.padding(8.dp)
        )
    }
}
Does ripple completely, but doesn't change color
@Composable
private fun BottomNavItem2(
    name: String,
    selected: Boolean,
    onClick: () -> Unit
) {
    Column(
        modifier = Modifier.clickable(
            indication = rememberRipple(false),
            onClick = onClick,
            interactionSource = MutableInteractionSource()
        ),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        val color = Color.Blue
        Text(
            text = name,
            color = color,
            modifier = Modifier.padding(8.dp)
        )
    }
}
g

Giang

05/12/2023, 7:23 PM
you may need to remember the interaction source?
interactionSource = remember { MutableInteractionSource() }
c

Colton Idle

05/13/2023, 2:16 PM
That didn't work unfortunately.
Actually, I re-deployed and now it worked.
lol.
thanks!