Hello everyone,
Is it possible to perform a transition tween animation for width property which starts from a specific
dp
value and ends with
fillMaxWidth
?
For example:
Copy code
val width = DpPropKey("width")
val transitionDefinition = transitionDefinition<ButtonState> {
state(ButtonState.COLLAPSED) {
this[width] = 60.dp
}
state(ButtonState.EXPANDED) {
this[width] = ??? // how can I represent a `fillMaxWidth` value here?
}
}
Thanks!
a
Ali Albaali
02/05/2021, 11:35 AM
Try Modifier.animateContentSize()
m
morfly
02/06/2021, 2:38 AM
thanks, will try it.
Also, i’ve found out that
WithConstraints
composable may help in this case, as it allows to get the computed width and height values