From f68b696a5b68580fac5bedac0a4502f8406e04d6 Mon Sep 17 00:00:00 2001 From: maxrave-dev Date: Fri, 10 Jan 2025 23:46:15 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ModalBottomSheet):=20Remove?= =?UTF-8?q?=20bottom=20padding=20from=20ModalBottomSheet.=20Fixed=20#690?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/component/ModalBottomSheet.kt | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt b/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt index 7965f54d..1928b165 100644 --- a/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt +++ b/app/src/main/java/com/maxrave/simpmusic/ui/component/ModalBottomSheet.kt @@ -22,9 +22,12 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +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.height +import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -296,6 +299,7 @@ fun NowPlayingBottomSheet( contentColor = Color.Transparent, dragHandle = null, scrimColor = Color.Black.copy(alpha = .5f), + contentWindowInsets = { WindowInsets(0, 0, 0, 0) } ) { Card( modifier = @@ -542,6 +546,7 @@ fun NowPlayingBottomSheet( ) { viewModel.onUIEvent(NowPlayingBottomSheetUIEvent.Share) } + EndOfModalBottomSheet() } } } @@ -714,6 +719,7 @@ fun AddToPlaylistModalBottomSheet( contentColor = Color.Transparent, dragHandle = null, scrimColor = Color.Black.copy(alpha = .5f), + contentWindowInsets = { WindowInsets(0, 0, 0, 0) } ) { Card( modifier = @@ -786,6 +792,7 @@ fun AddToPlaylistModalBottomSheet( } } } + EndOfModalBottomSheet() } } } @@ -814,6 +821,7 @@ fun SleepTimerBottomSheet( contentColor = Color.Transparent, dragHandle = null, scrimColor = Color.Black.copy(alpha = .5f), + contentWindowInsets = { WindowInsets(0, 0, 0, 0) }, ) { Card( modifier = @@ -868,6 +876,7 @@ fun SleepTimerBottomSheet( Text(text = stringResource(R.string.set), style = typo.labelSmall) } Spacer(modifier = Modifier.height(5.dp)) + EndOfModalBottomSheet() } } } @@ -901,6 +910,7 @@ fun ArtistModalBottomSheet( contentColor = Color.Transparent, dragHandle = null, scrimColor = Color.Black.copy(alpha = .5f), + contentWindowInsets = { WindowInsets(0, 0, 0, 0) }, ) { Card( modifier = @@ -966,6 +976,9 @@ fun ArtistModalBottomSheet( } } } + item { + EndOfModalBottomSheet() + } } } } @@ -1047,6 +1060,7 @@ fun LocalPlaylistBottomSheet( contentColor = Color.Transparent, dragHandle = null, scrimColor = Color.Black.copy(alpha = .5f), + contentWindowInsets = { WindowInsets(0, 0, 0, 0) }, ) { Card( modifier = @@ -1101,6 +1115,7 @@ fun LocalPlaylistBottomSheet( ) { Text(text = stringResource(id = R.string.save)) } + EndOfModalBottomSheet() } } } @@ -1113,6 +1128,7 @@ fun LocalPlaylistBottomSheet( contentColor = Color.Transparent, dragHandle = null, scrimColor = Color.Black.copy(alpha = .5f), + contentWindowInsets = { WindowInsets(0, 0, 0, 0) }, ) { Card( modifier = @@ -1178,18 +1194,20 @@ fun LocalPlaylistBottomSheet( onDelete() hideModalBottomSheet() } + EndOfModalBottomSheet() } } } } } -@Preview( - uiMode = Configuration.UI_MODE_NIGHT_YES, - showBackground = true, - name = "Dark Mode", - group = "Local Playlist", -) @Composable -fun LocalPlaylistBottomSheetPreview() { +fun EndOfModalBottomSheet() { + Box( + modifier = + Modifier + .fillMaxWidth() + .height(WindowInsets.navigationBars.asPaddingValues() + .calculateBottomPadding().value.toInt().dp + 8.dp), + ) {} } \ No newline at end of file