Michal Klimczak
03/21/2022, 1:47 PMdecorationBox
and showing / hiding the texfield itself when its focus / value changes. There is an issue that when it hides, there is an exception. I guess we should not completely get rid of the inner text field in this scenario, rather hide it - so a simple if
and AnimatedVisibility
will not work here. What I'm looking for is something like the old View.GONE
. Or just a possibility to go from wrapContent to 0 height and vice versa. Any hints how to best achieve it?Zach Klippenstein (he/him) [MOD]
03/21/2022, 2:21 PMMichal Klimczak
03/21/2022, 2:23 PMlayout
usage then, thanks 🙂Box(modifier = Modifier
.alpha(labelProgress)
.layout { measurable, constraints ->
val placeable = measurable.measure(constraints)
layout(placeable.width, (placeable.height * labelProgress).toInt()) {
placeable.placeRelative(0, 0, 0f)
}
}
) {
content()
}
where
val labelProgress by transition.animateFloat(
label = "LabelProgress",
transitionSpec = { tween(durationMillis = AnimationDuration) }
) {
when (it) {
UnfocusedEmpty -> 0f
UnfocusedNotEmpty, Focused -> 1f
}
}