Jonathan
01/17/2024, 11:04 PMBottomSheetScaffold
?
My design calls for the sheet stoping below my top AppBar.
I tried wrapping it in a BoxWithConstraints
and then calculating a height by subtracting the size of my app bar (64.dp
) then using Modifier.requiredHeight(...)
. The only problem is the calculated sheet height doesn’t appear to be correct. It’s off by 34 or so pixels.
Here is a snippet of the code I used:
BoxWithConstraints(Modifier.weight(1F)) {
val sheetHeight = maxHeight - topAppBarHeight
BottomSheetScaffold(
sheetContent = {
Box(
Modifier
.requiredHeight(sheetHeight)
) {
sheetContent()
}
},
scaffoldState = state,
) {}
}
What’s even more interesting, when using the BottomSheetScaffold
from material2 library, the code above works. I’ve attached two image demonstrating my issue. The first is using the Material3 version, the second is Material3.