Skip to content

Commit

Permalink
fix BottomSheetShell paddings and content (#341)
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Pajuelo Cabezas <[email protected]>
  • Loading branch information
Balcan authored Jan 7, 2025
1 parent 6ad6501 commit 9edc714
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand All @@ -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
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit 9edc714

Please sign in to comment.