diff --git a/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/bottomsheet/BottomSheetExamples.kt b/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/bottomsheet/BottomSheetExamples.kt index f6a9d89a4..15533e284 100644 --- a/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/bottomsheet/BottomSheetExamples.kt +++ b/catalog/src/main/kotlin/com/adevinta/spark/catalog/examples/samples/bottomsheet/BottomSheetExamples.kt @@ -182,6 +182,7 @@ private fun ConfiguredBottomSheet( BottomSheetContentExamples.List -> ListContent(onHideBottomSheetClicked) } }, + applyTempStatusBarPadding = true, dragHandle = if (isDragHandlerEnabled) { { DragHandle() } } else { diff --git a/spark/src/main/kotlin/com/adevinta/spark/components/bottomsheet/BottomSheet.kt b/spark/src/main/kotlin/com/adevinta/spark/components/bottomsheet/BottomSheet.kt index fdb4beaca..58accc112 100644 --- a/spark/src/main/kotlin/com/adevinta/spark/components/bottomsheet/BottomSheet.kt +++ b/spark/src/main/kotlin/com/adevinta/spark/components/bottomsheet/BottomSheet.kt @@ -29,9 +29,11 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.systemBars import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material3.BottomSheetDefaults import androidx.compose.material3.BottomSheetDefaults.ExpandedShape @@ -102,6 +104,7 @@ public fun BottomSheet( dragHandle: @Composable (() -> Unit)? = { DragHandle() }, + applyTempStatusBarPadding: Boolean = false, content: @Composable ColumnScope.() -> Unit, ) { SparkModalBottomSheet( @@ -109,6 +112,7 @@ public fun BottomSheet( modifier = modifier.sparkUsageOverlay(), sheetState = sheetState, content = content, + applyTempStatusBarPadding = applyTempStatusBarPadding, dragHandle = dragHandle, ) } @@ -152,6 +156,7 @@ internal fun SparkModalBottomSheet( dragHandle: (@Composable () -> Unit)? = { DragHandle() }, contentWindowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.windowInsets }, properties: ModalBottomSheetProperties = ModalBottomSheetDefaults.properties, + applyTempStatusBarPadding: Boolean = false, content: @Composable ColumnScope.() -> Unit, ) { androidx.compose.material3.ModalBottomSheet( @@ -166,9 +171,15 @@ internal fun SparkModalBottomSheet( dragHandle = null, ) { Box { + val systemBarTopInsets = WindowInsets.systemBars.asPaddingValues().calculateTopPadding() + val additionalTopPadding = if (applyTempStatusBarPadding) systemBarTopInsets else 0.dp Column( modifier = Modifier.padding( - top = if (dragHandle != null) ContentTopPadding else ContentTopPaddingNoHandle, + top = if (dragHandle != null) { + ContentTopPadding + additionalTopPadding + } else { + ContentTopPaddingNoHandle + additionalTopPadding + }, ), ) { content()