@@ -28,6 +28,7 @@ import androidx.compose.ui.graphics.graphicsLayer
2828import androidx.compose.ui.input.pointer.pointerInput
2929import androidx.compose.ui.text.font.FontWeight
3030import androidx.compose.ui.text.style.TextAlign
31+ import androidx.compose.ui.unit.Dp
3132import androidx.compose.ui.unit.DpSize
3233import androidx.compose.ui.unit.dp
3334import androidx.compose.ui.unit.sp
@@ -51,6 +52,7 @@ import top.yukonga.miuix.kmp.utils.squircleshape.SquircleShape
5152 * @param backgroundColor The background color of the [SuperDialog].
5253 * @param show The state of the [SuperDialog].
5354 * @param onDismissRequest The callback when the [SuperDialog] is dismissed.
55+ * @param outsideMargin The margin outside the [SuperDialog].
5456 * @param insideMargin The margin inside the [SuperDialog].
5557 * @param defaultWindowInsetsPadding Whether to apply default window insets padding to the [SuperDialog].
5658 * @param content The [Composable] content of the [SuperDialog].
@@ -65,17 +67,16 @@ fun SuperDialog(
6567 backgroundColor : Color = MiuixTheme .colorScheme.surfaceVariant,
6668 show : MutableState <Boolean >,
6769 onDismissRequest : () -> Unit ,
68- insideMargin : DpSize ? = null,
70+ outsideMargin : DpSize = DpSize (12.dp, 12.dp),
71+ insideMargin : Dp = 24.dp,
6972 defaultWindowInsetsPadding : Boolean = true,
7073 content : @Composable () -> Unit
7174) {
72- @Suppress(" NAME_SHADOWING" )
73- val insideMargin = remember { insideMargin } ? : remember { DpSize (12 .dp, 12 .dp) }
74- val paddingModifier = remember(insideMargin) {
75- Modifier .padding(horizontal = insideMargin.width).padding(bottom = insideMargin.height)
75+ val paddingModifier = remember(outsideMargin) {
76+ Modifier .padding(horizontal = outsideMargin.width).padding(bottom = outsideMargin.height)
7677 }
7778 val roundedCorner by rememberUpdatedState(getRoundedCorner())
78- val bottomCornerRadius by remember { derivedStateOf { if (roundedCorner != 0 .dp) roundedCorner - insideMargin .width else 32 .dp } }
79+ val bottomCornerRadius by remember { derivedStateOf { if (roundedCorner != 0 .dp) roundedCorner - outsideMargin .width else 32 .dp } }
7980 val getWindowSize by rememberUpdatedState(getWindowSize())
8081 val contentAlignment by remember { derivedStateOf { if (getWindowSize.width > getWindowSize.height) Alignment .Center else Alignment .BottomCenter } }
8182
@@ -119,7 +120,7 @@ fun SuperDialog(
119120 color = backgroundColor,
120121 shape = SquircleShape (bottomCornerRadius)
121122 )
122- .padding(24 .dp ),
123+ .padding(insideMargin ),
123124 ) {
124125 title?.let {
125126 Text (
0 commit comments