Skip to content

Commit

Permalink
Fix BottomSheetShell to accurately draws scrim over system bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Jun 3, 2024
1 parent 59779d1 commit ec9ef3c
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import androidx.compose.foundation.gestures.ScrollableState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
Expand All @@ -35,7 +34,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import org.hisp.dhis.mobile.ui.designsystem.component.internal.bottomSheet.rememberDimensionByName
import org.hisp.dhis.mobile.ui.designsystem.theme.Border
import org.hisp.dhis.mobile.ui.designsystem.theme.InternalSizeValues
import org.hisp.dhis.mobile.ui.designsystem.theme.Shape
Expand Down Expand Up @@ -162,10 +160,6 @@ fun BottomSheetShell(
) {
val sheetState = rememberModalBottomSheetState(true)
val scope = rememberCoroutineScope()
// TODO - hack to get navigation bar padding does not take into account IME padding (reflection)
// TODO - Should be remove when google publish https://issuetracker.google.com/issues/274872542
val topInsets = WindowInsets(top = rememberDimensionByName("status_bar_height"))
val bottomInsets = WindowInsets(bottom = rememberDimensionByName("navigation_bar_height"))

ModalBottomSheet(
modifier = modifier,
Expand Down Expand Up @@ -195,13 +189,11 @@ fun BottomSheetShell(
}
}
},
windowInsets = topInsets,
) {
val canScrollForward by derivedStateOf { contentScrollState.canScrollForward }

Column(
modifier = Modifier
.padding(bottomInsets.asPaddingValues()),
modifier = Modifier.systemBarsPadding(),
) {
Column(
modifier = Modifier
Expand Down

0 comments on commit ec9ef3c

Please sign in to comment.