I was playing around with BottomSheetScaffold and could't figure out how to set a top margin / min offset / anchor for the sheet.
Setting up the sheet like this:
val scaffoldState = rememberBottomSheetScaffoldState()
BottomSheetScaffold(
sheetContent = {
LazyColumn(modifier = Modifier
.fillMaxSize()
.padding(10.dp)
) {
items(100) {
Text(text = "Sheet item $it")
Spacer(modifier = Modifier.height(10.dp))
}
}
},
scaffoldState = scaffoldState,
sheetPeekHeight = 100.dp,
sheetShape = RoundedCornerShape(10.dp),
sheetBackgroundColor = Color.Gray
) { innerPadding ->
Box(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding)
.background(Color.Green),
contentAlignment = Alignment.Center
) { Text(text = "Content") }
}
Results in this bottom sheet in the app:
Collapsed:

Expanded:

What I am looking for is to add a top margin for the sheet so that it doesn't expand more than to this state.

I know I could add a height to the sheet content, but then i had to calculate height = windowHeight - bottomNavHeight - sheetTopMargin and that just feels more complicated that it should be.
Is there any easier way to set the top sheet margin?