Niko
11/15/2021, 1:55 PM@Preview
composables ATMNiko
11/15/2021, 1:58 PM@ExperimentalAnimationApi
@Preview("list with different states")
@Composable
fun AListPreview() {
AList(
aa = flowOf(
listOf(
A(Id(1), "TODO #1"),
A(Id(2), "TODO #2")
)
)
)
}
and
@ExperimentalAnimationApi
@Composable
fun AList(aa: Flow<List<A>>) {
val state by aa.collectAsState(initial = emptyList())
val deleted = remember { mutableStateListOf<A>() }
LazyColumn(modifier = Modifier.fillMaxWidth()) {
item {
Text(
text = stringResource(
id = R.string.main_aa,
state.size
)
)
}
and the preview always displays the text with 0
and no rows obviously are displayed. Running actually the code in a emulator will display rows correctlyAbhinav Suthar
11/15/2021, 2:09 PMNiko
11/15/2021, 2:28 PM