@@ -38,6 +38,7 @@ class MiuixPopupUtil {
3838 companion object {
3939 private var isPopupShowing = mutableStateOf(false )
4040 private var isDialogShowing = mutableStateOf(false )
41+ private var isWindowDimming = mutableStateOf(false )
4142 private var popupContext = mutableStateOf< (@Composable () -> Unit )? > (null )
4243 private var dialogContext = mutableStateOf< (@Composable () -> Unit )? > (null )
4344 private var popupTransformOrigin = mutableStateOf({ TransformOrigin .Center })
@@ -73,16 +74,19 @@ class MiuixPopupUtil {
7374 *
7475 * @param transformOrigin The pivot point in terms of fraction of the overall size,
7576 * used for scale transformations. By default it's [TransformOrigin.Center].
77+ * @param windowDimming Whether to dim the window when the popup is showing.
7678 * @param content The [Composable] content of the popup.
7779 */
7880 @Composable
7981 fun showPopup (
8082 transformOrigin : (() -> TransformOrigin ) = { TransformOrigin .Center },
83+ windowDimming : Boolean = true,
8184 content : (@Composable () -> Unit )? = null,
8285 ) {
8386 if (isPopupShowing.value) return
8487 popupTransformOrigin.value = transformOrigin
8588 isPopupShowing.value = true
89+ isWindowDimming.value = windowDimming
8690 popupContext.value = content
8791 }
8892
@@ -118,7 +122,7 @@ class MiuixPopupUtil {
118122 dimExitDuration = 150
119123 }
120124 AnimatedVisibility (
121- visible = isDialogShowing.value || isPopupShowing.value,
125+ visible = ( isDialogShowing.value || isPopupShowing.value) && isWindowDimming .value,
122126 modifier = Modifier .zIndex(1f ).fillMaxSize(),
123127 enter = fadeIn(animationSpec = tween(dimEnterDuration, easing = DecelerateEasing (1.5f ))),
124128 exit = fadeOut(animationSpec = tween(dimExitDuration, easing = DecelerateEasing (1.5f )))
@@ -165,7 +169,7 @@ class MiuixPopupUtil {
165169 dialogContext.value?.invoke()
166170 }
167171 AnimatedVisibility (
168- visible = isPopupShowing.value && isDialogShowing.value,
172+ visible = isPopupShowing.value && isDialogShowing.value && isWindowDimming.value ,
169173 modifier = Modifier .zIndex(1f ).fillMaxSize(),
170174 ) {
171175 Box (
0 commit comments