Boris Kachscovsky
07/07/2021, 11:20 AMLayout(content = {
Composable1()
Composable2()
ComposableWhoseSizeDependsOnOtherComposables()
} { measurables, constraints ->
// I measure all the elements and get the width i'd like the last element to be
layout(width, height) {
// I place placables for composable 1 and 2
//
// How can i make composable 3's width depend on the measurements I had made on 1 and 2?
}
}
Albert Chang
07/07/2021, 2:27 PMSubcomposeLayout
.Adam Powell
07/07/2021, 3:08 PMBoris Kachscovsky
07/07/2021, 4:13 PMval linePlaceable = measurables.last().measure(
constraints.copy(
minWidth = someMeasuredWidth,
maxWidth = someMeasuredWidth
)
)
Measuring it against those constraints is a nice way to change the size without requiring subcompose layout!