Remove redundant inset handling in AdaptiveSheet

The Dialog is handling it anyway, so this doesn't really do anything useful.
We might need to add this back if Dialog actually handles edge-to-edge properly.
This commit is contained in:
arkon 2023-05-24 18:10:17 -04:00
parent 3ae1e37c40
commit e3b2720924
5 changed files with 9 additions and 25 deletions

View File

@ -5,12 +5,6 @@ import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.safeContent
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@ -79,14 +73,9 @@ fun AdaptiveSheet(
tonalElevation: Dp = 1.dp,
enableSwipeDismiss: Boolean = true,
onDismissRequest: () -> Unit,
content: @Composable (PaddingValues) -> Unit,
content: @Composable () -> Unit,
) {
val isTabletUi = isTabletUi()
val contentPadding = if (isTabletUi) {
PaddingValues()
} else {
WindowInsets.safeContent.only(WindowInsetsSides.Bottom).asPaddingValues()
}
Dialog(
onDismissRequest = onDismissRequest,
@ -98,7 +87,7 @@ fun AdaptiveSheet(
enableSwipeDismiss = enableSwipeDismiss,
onDismissRequest = onDismissRequest,
) {
content(contentPadding)
content()
}
}
}

View File

@ -4,7 +4,6 @@ import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.pager.rememberPagerState
@ -43,11 +42,11 @@ fun TabbedDialog(
onDismissRequest: () -> Unit,
tabTitles: List<String>,
tabOverflowMenuContent: (@Composable ColumnScope.(() -> Unit) -> Unit)? = null,
content: @Composable (PaddingValues, Int) -> Unit,
content: @Composable (Int) -> Unit,
) {
AdaptiveSheet(
onDismissRequest = onDismissRequest,
) { contentPadding ->
) {
val scope = rememberCoroutineScope()
val pagerState = rememberPagerState { tabTitles.size }
@ -87,7 +86,7 @@ fun TabbedDialog(
state = pagerState,
verticalAlignment = Alignment.Top,
) { page ->
content(contentPadding, page)
content(page)
}
}
}

View File

@ -55,10 +55,9 @@ fun LibrarySettingsDialog(
stringResource(R.string.action_sort),
stringResource(R.string.action_display),
),
) { contentPadding, page ->
) { page ->
Column(
modifier = Modifier
.padding(contentPadding)
.padding(vertical = TabbedDialogPaddings.Vertical)
.verticalScroll(rememberScrollState()),
) {

View File

@ -69,10 +69,9 @@ fun ChapterSettingsDialog(
},
)
},
) { contentPadding, page ->
) { page ->
Column(
modifier = Modifier
.padding(contentPadding)
.padding(vertical = TabbedDialogPaddings.Vertical)
.verticalScroll(rememberScrollState()),
) {

View File

@ -42,10 +42,8 @@ fun SourceFilterDialog(
AdaptiveSheet(
onDismissRequest = onDismissRequest,
) { contentPadding ->
LazyColumn(
contentPadding = contentPadding,
) {
) {
LazyColumn {
stickyHeader {
Row(
modifier = Modifier