This code is put inside Box ```val state = viewMod...
# compose
d
This code is put inside Box
Copy code
val state = viewModel.currentState.collectAsState(viewModel.getInitialState())

Column(Modifier.fillMaxSize() + Modifier.drawBackground(color = Color.Blue)){
    AdapterList(modifier = Modifier.fillMaxSize(), data = state.value.dataList) {
        Text(
            modifier = Modifier.fillMaxWidth() + Modifier.preferredHeight(80.dp),
            text = it.title,
            color = Color.White
        )
    }
}
and gives me a runtime error while executing
Copy code
LayoutNode@6292b16 children: 1 measureBlocks: MeasuringIntrinsicsMeasureBlocks@a9f8420{ measureBlock=androidx.ui.foundation.BoxKt$Box$1$1@0ed31d9 } is not measured, draw requested
When I remove AdapterList, it runs just fine EDIT: it's not working when data parameter is an empty list
a
This could be fixed by https://android-review.googlesource.com/c/platform/frameworks/support/+/1285864/ in dev11. The possible current workaround is to use VerticalScroller and Column instead of AdapterList
👍 2
d
@Andrey Kulikov Actually, it doesn't work with VerticalScroller + Column either, the same error appears The Box that the error is relating to is a child of ConstraintLayout (constraints are correctly set), could it be that its children are not properly measured for the purposes of VerticalScroller/AdapterList?
Yup, it does work when I redo the layout using Column+weight instead of ConstraintLayout. But... it doesn't update the list on the screen. Only when the app goes to background and then to foreground, AdapterList elements appear correctly. I think it's because of
collectAsState
(just a guess, the value was not updated when I printed it to console)
a
hm, could you please file two separate bugs for both issues(about constrains layout and list not updating without constraint layout)? we will take a look. thanks!