@@ -3,18 +3,12 @@ package top.yukonga.miuix.kmp.extra
33import androidx.compose.foundation.background
44import androidx.compose.foundation.gestures.detectTapGestures
55import androidx.compose.foundation.layout.Column
6- import androidx.compose.foundation.layout.WindowInsets
7- import androidx.compose.foundation.layout.WindowInsetsSides
8- import androidx.compose.foundation.layout.captionBar
9- import androidx.compose.foundation.layout.displayCutout
106import androidx.compose.foundation.layout.fillMaxSize
117import androidx.compose.foundation.layout.fillMaxWidth
128import androidx.compose.foundation.layout.imePadding
139import androidx.compose.foundation.layout.navigationBarsPadding
14- import androidx.compose.foundation.layout.only
1510import androidx.compose.foundation.layout.padding
1611import androidx.compose.foundation.layout.widthIn
17- import androidx.compose.foundation.layout.windowInsetsPadding
1812import androidx.compose.runtime.Composable
1913import androidx.compose.runtime.LaunchedEffect
2014import androidx.compose.runtime.MutableState
@@ -76,11 +70,12 @@ fun SuperDialog(
7670 content : @Composable () -> Unit
7771) {
7872 val density = LocalDensity .current
73+ val getWindowSize by rememberUpdatedState(getWindowSize())
74+ println (getWindowSize.width.dp / density.density)
7975 val paddingModifier = remember(outsideMargin) { Modifier .padding(horizontal = outsideMargin.width).padding(bottom = outsideMargin.height) }
8076 val roundedCorner by rememberUpdatedState(getRoundedCorner())
8177 val bottomCornerRadius by remember { derivedStateOf { if (roundedCorner != 0 .dp) roundedCorner - outsideMargin.width else 32 .dp } }
82- val getWindowSize by rememberUpdatedState(getWindowSize())
83- val contentAlignment by remember { derivedStateOf { if (getWindowSize.width > getWindowSize.height || getWindowSize.width.dp / density.density > 440 .dp) Alignment .Center else Alignment .BottomCenter } }
78+ val contentAlignment by remember { derivedStateOf { if (getWindowSize.width > getWindowSize.height && getWindowSize.width.dp / density.density > 1200 .dp) Alignment .Center else Alignment .BottomCenter } }
8479
8580 if (! dialogStates.contains(show)) dialogStates.add(show)
8681 LaunchedEffect (show.value) {
@@ -99,8 +94,6 @@ fun SuperDialog(
9994 Modifier
10095 .imePadding()
10196 .navigationBarsPadding()
102- .windowInsetsPadding(WindowInsets .displayCutout.only(WindowInsetsSides .Horizontal ))
103- .windowInsetsPadding(WindowInsets .captionBar.only(WindowInsetsSides .Top ))
10497 } else {
10598 Modifier
10699 }
@@ -117,7 +110,7 @@ fun SuperDialog(
117110 ) {
118111 Column (
119112 modifier = modifier
120- .then( if (contentAlignment != Alignment . Center ) Modifier .fillMaxWidth() else Modifier . widthIn(max = 400 .dp) )
113+ .widthIn(max = 420 .dp)
121114 .pointerInput(Unit ) {
122115 detectTapGestures { /* Do nothing to consume the click */ }
123116 }
0 commit comments