FlexibleBottomSheet
FlexibleBottomSheet copied to clipboard
Windows insets ignored if isModal = true
Please complete the following information:
- Library Version: v0.1.5
- Affected Device(s): all
Describe the Bug: (when isModal is true) Even if you set the windowInsets to PaddingValues(0.dp) and containSystemBars = true, the statusBar padding is applied.
Expected Behavior: window insets are respected. E.g. If no systemBar window insets are added FullyExpanded bottom sheet should overlap top of the screen (edge to edge behaviour)
Note: The origin of the problem seems to come from: FlexibleBottomSheet.kt L292
modifier = if (sheetState.isModal) {
Modifier
.fillMaxWidth()
.sheetPaddings(sheetState)
} else {
Modifier
.fillMaxWidth()
},
public fun Modifier.sheetPaddings(sheetState: FlexibleSheetState): Modifier = composed {
val systemBarsPadding = WindowInsets.systemBars.asPaddingValues()
val paddings =
systemBarsPadding.calculateBottomPadding() + systemBarsPadding.calculateTopPadding()
val availableHeight = screenHeight() * (1 - sheetState.flexibleSheetSize.fullyExpanded)
val padding = availableHeight - paddings
if (sheetState.currentValue == FlexibleSheetValue.FullyExpanded && padding.toPx() > 0) {
Modifier.padding(bottom = availableHeight - paddings)
} else {
this
}
}