this code not work as expected, I want it to automatically scroll up to display the full height of the card when expanded inside lazy column
val listState = rememberLazyListState()
val coroutineScope = rememberCoroutineScope()
LazyColumn(
modifier = Modifier.padding(start = 20.dp, end = 20.dp, top = 20.dp),
state = listState
) {
item { Header(brand = brand) }
itemsIndexed(items) { index, item ->
ExpandableCard(
engagementPointItem = item,
isExpanded = expandedCardsStates[item.id] ?: false,
onCardClicked = {
viewModel.toggleExpandedState(item.id)
coroutineScope.launch {
listState.animateScrollToItem(index = index)
}
}
)
}
}