Trying to achieve 3 items in row equally distributed horizontally with option to show/hide some of them in compose v1.3.3.
If it's a simple if statement to include view in compose all works fine (without animation)
Row(
modifier = modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Text(text = "abc", modifier = modifier.weight(1f))
if (false) {
Text(text = "def", modifier = modifier.weight(1f))
}
if(true) {
Text(text = "zxc", modifier = modifier.weight(1f))
}
}
As soon as item wrapped with AnimatedVisibility as condition UI becomes broken.
Row(
modifier = modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Text(text = "abc", modifier = modifier.weight(1f))
AnimatedVisibility(visible = false) {
Text(text = "def", modifier = modifier.weight(1f))
}
AnimatedVisibility(visible = true) {
Text(text = "zxc", modifier = modifier.weight(1f))
}
}
Seems like visibility + size changes same time could ruin the UI.
Is there a way for smooth animation without implementing very custom ones?