`I am trying to animate LazyColumn items with state.animateScrollItems() function. But is not not working. It is working very well with state.scrollItmes() function.
I am using compose_ui_verdion 1.2.1, compose_compiler_version 1.3.2 and kotlin version 1.7.20
LazyColumn(
horizontalAlignment = Alignment.CenterHorizontally,
state = state
) {
item {
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color(color = 0x93F1ECEC)),
contentAlignment = Alignment.TopCenter
) {
Text(
text = "Enter purchase details :",
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp, horizontal = 4.dp),
color = MaterialTheme.colors.error
)
}
}
item {
FirstThreeRows {
}
}
item {
Spacer(modifier = Modifier.height(10.dp))
}
item {
ProductListTitle()
}
item {
ProductList() // it is another lazycolumn
}
item {
ItemSelectionRows { focused ->
Log.i(TAG, "HomeScreen2: $focused")
if (focused) {
coroutineScope.launch {
state.animateScrollToItem(2)
}
} else {
coroutineScope.launch {
state.animateScrollToItem(0)
}
}
}
}
item {
ProductButtonRow()
}
item {
ProductPriceColumn()
}
item {
Spacer(modifier = Modifier.height(10.dp))
}
item {
Button(onClick = { /*TODO*/ }) {
Text(text = "Submit")
}
}
item {
Spacer(modifier = Modifier.height(300.dp))
}
}
Please give me a solution.`