based on a parent layout? For example if I have a column with a few composables and I want the BottomSheet in collapsed state to be just below the last one of them, how would I go about this? I thought about a custom
Layout
modifier to measure children height, but how do I then pass this into
sheetPeekHeight
?
n
nitrog42
06/08/2021, 3:08 PM
I have a probably bad but working way with :
you put a spacer (or a box) at the place you want to know "the height" and then :
Copy code
Spacer(
Modifier
.onGloballyPositioned {
//Calculate the height of the sheet to display when collapsed
if (!expanded) {
onPeekSizeCalculated(it.positionInParent().y)
}
}
}
You can either use a lambda to know the value, or use a mutablestate (peekSize = it.positionInParent.y)