Mikael Alfredsson
12/27/2021, 7:04 PM@Composable
fun Test(
content: @Composable () -> Unit
) {
Box(
Modifier.layout { measurable, constraints ->
layout(constraints.minWidth, constraints.minHeight){
val placeable = measurable.measure(constraints)
placeable.place(0,0)
}
}
) {
content()
}
}
@Preview
@Composable
fun TestPreview() {
Test(){
Text(text = "test")
}
}
Chrimaeon
12/27/2021, 7:38 PMMikael Alfredsson
12/27/2021, 7:38 PMava.lang.IllegalStateException: Measurable could be only measured from the parent's measure or layout block.Parents state is NeedsRelayout
Chrimaeon
12/27/2021, 7:42 PMMikael Alfredsson
12/27/2021, 7:44 PMChrimaeon
12/27/2021, 7:46 PMmeasure
is still outside the layout
Mikael Alfredsson
12/27/2021, 7:47 PMChrimaeon
12/27/2021, 7:53 PM