I want my button disabled state to be animated to ...
# compose
u
I want my button disabled state to be animated to I know I can handroll it via
animateColorAsState
But I don't want to do that, as I already specifcy my button colors via the
ButtonDefault
which sets the color, so I don't want to fight it
Copy code
Composable
fun AnimatedButton(enabled: Boolean, onClick: () -> Unit) {
    val backgroundColor by animateColorAsState(
        if (enabled) Color.Green else Color.Gray
    )

    Button(
        onClick = onClick,
        enabled = enabled,
        colors = ButtonDefaults.buttonColors(
            backgroundColor = backgroundColor
        )
    ) {
        Text("My Button")
    }
}
This is obviously wrong as when the enabled is false, then the color wants to be gray. However that is
backgroundColor
but nits disabled so the color changes to whatever default disabled it Ofcourse I can set
backgroundColor
and
disabledColor
to the same value but thats kinda stupid