Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows insets ignored if isModal = true #61

Open
sergionettl opened this issue Sep 9, 2024 · 1 comment
Open

Windows insets ignored if isModal = true #61

sergionettl opened this issue Sep 9, 2024 · 1 comment

Comments

@sergionettl
Copy link

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
  }
}
@terrakok
Copy link

It is being reproduced with isModal=false as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants