Thomas Hormes
10/10/2023, 7:33 AMThomas Hormes
10/10/2023, 7:34 AM@Composable
fun Test() {
var isColumn by remember { mutableStateOf(false) }
Column() {
Button({ isColumn = !isColumn }) {
Text("switch")
}
AnimatedContent(
targetState = isColumn,
label = "label",
) {
if (it) {
Column(
verticalArrangement = Arrangement.SpaceEvenly,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) {
Box(Modifier
.size(40.dp)
.clip(CircleShape)
.background(Color.Red)
)
Box(Modifier
.size(40.dp)
.clip(CircleShape)
.background(Color.Green)
)
Box(Modifier
.size(40.dp)
.clip(CircleShape)
.background(Color.Blue)
)
}
} else {
Row(
horizontalArrangement = Arrangement.SpaceEvenly,
modifier = Modifier.fillMaxSize()
) {
Box(Modifier
.size(40.dp)
.clip(CircleShape)
.background(Color.Red)
)
Box(Modifier
.size(40.dp)
.clip(CircleShape)
.background(Color.Green)
)
Box(Modifier
.size(40.dp)
.clip(CircleShape)
.background(Color.Blue)
)
}
}
}
}
}
Since, the items all stay the same, I want them to move from their origin positions in the Row to their destination positions in the Column, vice versa.ascii
10/10/2023, 8:30 AMmovableContentOf
. I remember seeing official docs on this but I'm unable to find it now.ascii
10/10/2023, 8:38 AMThomas Hormes
10/10/2023, 9:01 AMBrian Mbigo
10/10/2023, 12:23 PMascii
10/11/2023, 3:37 AM