Is there a good way to set the max bottom sheet he...
# compose
j
Is there a good way to set the max bottom sheet height of Material3
BottomSheetScaffold
? 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:
Copy code
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.