From 9edc714f3d977edd9cf17f6ad770809f8b57f011 Mon Sep 17 00:00:00 2001 From: Pablo Date: Tue, 7 Jan 2025 14:40:38 +0100 Subject: [PATCH] fix BottomSheetShell paddings and content (#341) Signed-off-by: Pablo Pajuelo Cabezas --- .../ui/designsystem/component/BottomSheet.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt index a24dc5bb8..b1a0a519d 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/BottomSheet.kt @@ -4,15 +4,18 @@ import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.ScrollState import androidx.compose.foundation.background import androidx.compose.foundation.gestures.ScrollableState +import androidx.compose.foundation.layout.Arrangement.spacedBy 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.layout.systemBars import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons @@ -199,8 +202,7 @@ fun BottomSheetShell( sheetState = sheetState, dragHandle = { Box( - modifier = Modifier.background(Color.Transparent) - .padding(top = Spacing.Spacing72), + modifier = Modifier.padding(top = Spacing.Spacing72), ) { BottomSheetIconButton( icon = { @@ -222,7 +224,9 @@ fun BottomSheetShell( val canScrollForward by derivedStateOf { contentScrollState.canScrollForward } Column( - modifier = Modifier.systemBarsPadding(), + modifier = Modifier.padding( + bottom = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding(), + ), ) { Column( modifier = Modifier @@ -287,12 +291,12 @@ fun BottomSheetShell( .heightIn(scrollableContainerMinHeight, scrollableContainerMaxHeight) .then(scrollModifier), horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = spacedBy(Spacing8), ) { content.invoke() - Spacer(modifier = Modifier.weight(1f)) if (showSectionDivider) { HorizontalDivider( - modifier = Modifier.fillMaxWidth().padding(top = Spacing8), + modifier = Modifier.fillMaxWidth(), color = TextColor.OnDisabledSurface, thickness = Border.Thin, )