mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-24 12:08:55 +02:00
AdaptiveSheet: Wrap inside Dialog (#9279)
Because of Compose issue, the style of the sheet surface is adjusted as a workaround Ref https://issuetracker.google.com/issues/246909281
This commit is contained in:
@@ -14,6 +14,8 @@ import androidx.compose.foundation.layout.only
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import cafe.adriel.voyager.core.lifecycle.DisposableEffectIgnoringConfiguration
|
||||
import cafe.adriel.voyager.core.screen.Screen
|
||||
import cafe.adriel.voyager.navigator.Navigator
|
||||
@@ -78,17 +80,24 @@ fun AdaptiveSheet(
|
||||
content: @Composable (PaddingValues) -> Unit,
|
||||
) {
|
||||
val isTabletUi = isTabletUi()
|
||||
AdaptiveSheetImpl(
|
||||
isTabletUi = isTabletUi,
|
||||
tonalElevation = tonalElevation,
|
||||
enableSwipeDismiss = enableSwipeDismiss,
|
||||
Dialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
properties = DialogProperties(
|
||||
usePlatformDefaultWidth = false,
|
||||
),
|
||||
) {
|
||||
val contentPadding = if (isTabletUi) {
|
||||
PaddingValues()
|
||||
} else {
|
||||
WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()
|
||||
AdaptiveSheetImpl(
|
||||
isTabletUi = isTabletUi,
|
||||
tonalElevation = tonalElevation,
|
||||
enableSwipeDismiss = enableSwipeDismiss,
|
||||
onDismissRequest = onDismissRequest,
|
||||
) {
|
||||
val contentPadding = if (isTabletUi) {
|
||||
PaddingValues()
|
||||
} else {
|
||||
WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()
|
||||
}
|
||||
content(contentPadding)
|
||||
}
|
||||
content(contentPadding)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ object LibraryTab : Tab {
|
||||
}
|
||||
|
||||
LaunchedEffect(state.selectionMode, state.dialog) {
|
||||
HomeScreen.showBottomNav(!state.selectionMode && state.dialog !is LibraryScreenModel.Dialog.SettingsSheet)
|
||||
HomeScreen.showBottomNav(!state.selectionMode)
|
||||
}
|
||||
|
||||
LaunchedEffect(state.isLoading) {
|
||||
|
||||
Reference in New Issue
Block a user