https://kotlinlang.org logo
#compose
Title
# compose
w

wintersoldier

02/15/2023, 9:28 AM
Will there be any BottomSheet composable from Material which allows applying custom scrim colors & draggable to full screen even with content which occupies only half the height of the bottomsheet.
Already checked
Bottomsheetscaffold
, It doesn't allow to apply scrim. With
ModalBottomSheetLayout
it expands only based on wrap content!
c

Chris Fillmore

02/15/2023, 11:21 AM
If you want it to expand to full screen, add a
Spacer(Modifier.weight(1f))
to the end of the sheet content
w

wintersoldier

02/15/2023, 11:43 AM
Hi Chris , This solution works when I did some workaround, I made the host Composable content weight based on sheetstate,
Copy code
ModalBottomSheetLayout(
  sheetContent = {
    LazyColumn(modifier = if(bottomsheetState.currentValue == ModalBottomSheetValue.Expanded) Modifier.weight(1f) else Modifier){
      item {
        repeat(100) {
          Text(
            text = "Content",
            modifier = Modifier
              .padding(all = 16.dp)
              .fillMaxWidth()
              .clickable {
              },
          )
        }
      }
    }
  },
  sheetState = bottomsheetState,
) {
}
j

jossiwolf

02/15/2023, 4:02 PM
M3's
ModalBottomSheet
has a
scrimColor
parameter. Changing the touch input area to diverge from the visual boundaries is not something we recommend and do not support.
9 Views