ascii
09/14/2023, 3:54 AM@Stable
data class Item(/* normal values */) {
/** initially collapsed */
val expanded = mutableStateOf(false)
}
Then, in the composable:
LazyColumn {
items(list) {
var expanded by remember { item.expanded } // toggled when user clicks on something
AlwaysVisibleContent()
AnimatedVisibility(expanded) { OtherContent() }
}
}
It works of course, but are there any pitfalls to sticking a MutableState into the Item class? I'd rather keep Compose-specific stuff in composables only.