Let's say I have a Composable like this :
@Composable
fun LoadingButton() {
val (isLoading, setIsLoading) = state { false }
Button(
onClick = setIsLoading,
text = {
if (isLoading) {
Text(text = "Short text")
} else {
Text(text = "Very very very long text")
}
}
)
}
How can I animate the width update of my button ?
I'm well aware that I could add a preferredWidth modifier to the button and animate this width with :
val buttonWidth = animate(target = if (isLoading) LoadingButtonMinWidth else LoadingButtonMaxWidth)
But this is not my what I want. I need to animate the automatic "wrap-content" width.
Thanks in advance.