Skip to content

Commit fbffbbf

Browse files
committed
library: Add defaultWindowInsetsPadding param in SuperDialog
1 parent a81e6b1 commit fbffbbf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDialog.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,28 @@ import top.yukonga.miuix.kmp.utils.squircleshape.SquircleShape
3636
/**
3737
* A dialog with a title, a summary, and a content.
3838
*
39+
* @param modifier The modifier to be applied to the [SuperDialog].
3940
* @param title The title of the [SuperDialog].
4041
* @param titleColor The color of the title.
4142
* @param summary The summary of the [SuperDialog].
4243
* @param summaryColor The color of the summary.
4344
* @param show The state of the [SuperDialog].
4445
* @param onDismissRequest The callback when the [SuperDialog] is dismissed.
4546
* @param insideMargin The margin inside the [SuperDialog].
47+
* @param defaultWindowInsetsPadding Whether to apply default window insets padding to the [SuperDialog].
4648
* @param content The [Composable] content of the [SuperDialog].
4749
*/
4850
@Composable
4951
fun SuperDialog(
52+
modifier: Modifier = Modifier,
5053
title: String? = null,
5154
titleColor: Color = MiuixTheme.colorScheme.onSurface,
5255
summary: String? = null,
5356
summaryColor: Color = MiuixTheme.colorScheme.onSurfaceVariantDialog,
5457
show: MutableState<Boolean>,
5558
onDismissRequest: () -> Unit,
5659
insideMargin: DpSize? = null,
60+
defaultWindowInsetsPadding: Boolean = true,
5761
content: @Composable () -> Unit
5862
) {
5963
@Suppress("NAME_SHADOWING")
@@ -72,15 +76,19 @@ fun SuperDialog(
7276
}
7377

7478
Box(
75-
modifier = Modifier
76-
.imePadding()
79+
modifier = if (defaultWindowInsetsPadding) {
80+
modifier.imePadding()
81+
} else {
82+
modifier
83+
}
7784
.fillMaxSize()
7885
.pointerInput(Unit) {
7986
detectTapGestures(onTap = {
8087
dismissDialog()
8188
onDismissRequest()
8289
})
8390
}
91+
8492
.then(paddingModifier)
8593
) {
8694
Column(

0 commit comments

Comments
 (0)