Is there a `Modifier.animateItemPlacement` equival...
# compose
u
Is there a
Modifier.animateItemPlacement
equivalent for a plain
Column
(not lazy?) i.e. to animate item insertion/deletion in the list? (
animateContentSize
won't do)
Copy code
val players by remember { AppComponent.dao.players() }.collectAsState(emptyList())

Column {
    for (player in players) {
        Text(
            modifier = Modifier
                .fillMaxWidth()
                .wrapContentHeight()
                .padding(16.dp),
            text = "player=$player"
        )
        Divider()
    }
}
I know this could be made a
LazyColumn
but for research purpose let assume not
t
You can use
AnimatedContent
with an empty transition, and
Modifier.animateEnterExit
to simulate the same animation behavior.
u
animatedcontent where, on the whole column or each item?
t
The whole column
You have to do something like
EnterTransition.None with ExitTransition.None using null
for the transitionSpec, and use that modifier on each child you want animated
u
but wpuld that animate say deleting from middlr of the list?
t
You can, with an
animateEnterExit
on the deleted child. The animated state would be a list of children (or IDs) to show in the column.
163 Views