Skip to content

Commit 051fa15

Browse files
committed
library: Opt window dimming of the MiuixPopup
1 parent 4fda6f7 commit 051fa15

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ fun SuperDialog(
112112
}
113113
.align(contentAlignment)
114114
.graphicsLayer(
115-
shadowElevation = 12f,
116115
shape = SquircleShape(bottomCornerRadius),
117116
clip = false
118117
)

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/theme/MiuixColor.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import androidx.compose.ui.graphics.Color
99
/**
1010
* The default color scheme for the Miuix components.
1111
*
12-
* @param primary The primary color.Cases:Switch, Button, Slider
13-
* @param onPrimary The color of the text on primary color.Cases:Switch, Button, Slider
12+
* @param primary The primary color. Cases: Switch, Button, Slider.
13+
* @param onPrimary The color of the text on primary color. Cases: Switch, Button, Slider.
1414
* @param primaryVariant The variant color of the primary color.Cases:Card
1515
* @param onPrimaryVariant The color of the text on primary variant color.
1616
* @param disabledPrimary The disabled primary color of the switch.
@@ -54,6 +54,7 @@ import androidx.compose.ui.graphics.Color
5454
* @param onSurfaceContainerHigh The color of the text on surface container high color.
5555
* @param surfaceContainerHighest The container color of the surface color.
5656
* @param onSurfaceContainerHighest The color of the text on surface container highest color.
57+
* @param windowDimming The color of the window dimming. Cases: Dialog, Dropdown.
5758
*/
5859
@Stable
5960
class MiuixColor(
@@ -102,6 +103,7 @@ class MiuixColor(
102103
onSurfaceContainerHigh: Color,
103104
surfaceContainerHighest: Color,
104105
onSurfaceContainerHighest: Color,
106+
windowDimming: Color
105107
) {
106108
val primary by mutableStateOf(primary, structuralEqualityPolicy())
107109
val onPrimary by mutableStateOf(onPrimary, structuralEqualityPolicy())
@@ -148,6 +150,7 @@ class MiuixColor(
148150
val onSurfaceContainerHigh by mutableStateOf(onSurfaceContainerHigh, structuralEqualityPolicy())
149151
val surfaceContainerHighest by mutableStateOf(surfaceContainerHighest, structuralEqualityPolicy())
150152
val onSurfaceContainerHighest by mutableStateOf(onSurfaceContainerHighest, structuralEqualityPolicy())
153+
val windowDimming by mutableStateOf(windowDimming, structuralEqualityPolicy())
151154
}
152155

153156
fun lightColorScheme() = MiuixColor(
@@ -195,7 +198,8 @@ fun lightColorScheme() = MiuixColor(
195198
surfaceContainerHigh = Color(0xFFEDEDED),
196199
onSurfaceContainerHigh = Color(0xFFA5A5A5),
197200
surfaceContainerHighest = Color(0xFFE8E8E8),
198-
onSurfaceContainerHighest = Color.Black
201+
onSurfaceContainerHighest = Color.Black,
202+
windowDimming = Color.Black.copy(alpha = 0.3f)
199203
)
200204

201205
fun darkColorScheme() = MiuixColor(
@@ -243,5 +247,6 @@ fun darkColorScheme() = MiuixColor(
243247
surfaceContainerHigh = Color(0xFF2D2D2D),
244248
onSurfaceContainerHigh = Color(0xFF6C6C6C),
245249
surfaceContainerHighest = Color(0xFF2D2D2D),
246-
onSurfaceContainerHighest = Color(0xFFE9E9E9)
250+
onSurfaceContainerHighest = Color(0xFFE9E9E9),
251+
windowDimming = Color.Black.copy(alpha = 0.6f)
247252
)

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/utils/MiuixPopupUtil.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import androidx.compose.foundation.layout.fillMaxSize
1414
import androidx.compose.runtime.Composable
1515
import androidx.compose.runtime.mutableStateOf
1616
import androidx.compose.ui.Modifier
17-
import androidx.compose.ui.graphics.Color
1817
import androidx.compose.ui.zIndex
1918
import top.yukonga.miuix.kmp.basic.Box
2019
import top.yukonga.miuix.kmp.basic.Scaffold
20+
import top.yukonga.miuix.kmp.theme.MiuixTheme
2121

2222
/**
2323
* A util class for show popup and dialog.
@@ -82,7 +82,7 @@ class MiuixPopupUtil {
8282
Box(
8383
modifier = Modifier
8484
.fillMaxSize()
85-
.background(Color.Black.copy(alpha = 0.3f))
85+
.background(MiuixTheme.colorScheme.windowDimming)
8686
)
8787
}
8888
AnimatedVisibility(
@@ -115,7 +115,7 @@ class MiuixPopupUtil {
115115
Box(
116116
modifier = Modifier
117117
.fillMaxSize()
118-
.background(Color.Black.copy(alpha = 0.3f))
118+
.background(MiuixTheme.colorScheme.windowDimming)
119119
)
120120
}
121121
}

0 commit comments

Comments
 (0)