diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/BlurModifier.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/BlurModifier.kt index e52a8dacea..70a25dc0e7 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/BlurModifier.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/BlurModifier.kt @@ -15,12 +15,11 @@ import androidx.compose.ui.unit.* import chat.simplex.common.platform.appPlatform import chat.simplex.common.ui.theme.CurrentColors -@Composable fun Modifier.blurredBackgroundModifier( keyboardInset: WindowInsets, handler: AppBarHandler?, blurRadius: State, - prefAlpha: Float, + prefAlpha: State, keyboardCoversBar: Boolean, onTop: Boolean, density: Density @@ -28,18 +27,17 @@ fun Modifier.blurredBackgroundModifier( val graphicsLayer = handler?.graphicsLayer val backgroundGraphicsLayer = handler?.backgroundGraphicsLayer val backgroundGraphicsLayerSize = handler?.backgroundGraphicsLayerSize - if (!(handler != null && graphicsLayer != null && backgroundGraphicsLayer != null && blurRadius.value > 0 && prefAlpha < 1f && backgroundGraphicsLayerSize != null)) + if (!(handler != null && graphicsLayer != null && backgroundGraphicsLayer != null && blurRadius.value > 0 && prefAlpha.value < 1f && backgroundGraphicsLayerSize != null)) return this return if (appPlatform.isAndroid) { - this.androidBlurredModifier(keyboardInset, blurRadius, keyboardCoversBar, onTop, graphicsLayer, backgroundGraphicsLayer, backgroundGraphicsLayerSize, density) + this.desktopBlurredModifier(keyboardInset, blurRadius, keyboardCoversBar, onTop, graphicsLayer, backgroundGraphicsLayer, backgroundGraphicsLayerSize, density) } else { this.desktopBlurredModifier(keyboardInset, blurRadius, keyboardCoversBar, onTop, graphicsLayer, backgroundGraphicsLayer, backgroundGraphicsLayerSize, density) } } -@Composable -fun Modifier.androidBlurredModifier( +private fun Modifier.androidBlurredModifier( keyboardInset: WindowInsets, blurRadius: State, keyboardCoversBar: Boolean, @@ -88,8 +86,7 @@ fun Modifier.androidBlurredModifier( } } -@Composable -fun Modifier.desktopBlurredModifier( +private fun Modifier.desktopBlurredModifier( keyboardInset: WindowInsets, blurRadius: State, keyboardCoversBar: Boolean, diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultTopAppBar.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultTopAppBar.kt index 64608c622c..6fdad6aca8 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultTopAppBar.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/helpers/DefaultTopAppBar.kt @@ -37,7 +37,7 @@ fun DefaultTopAppBar( } else Modifier val themeBackgroundMix = MaterialTheme.colors.background.mixWith(MaterialTheme.colors.onBackground, 0.97f) - val prefAlpha = remember { appPrefs.inAppBarsAlpha.state }.value + val prefAlpha = remember { appPrefs.inAppBarsAlpha.state } val handler = LocalAppBarHandler.current val connection = LocalAppBarHandler.current?.connection val titleText = remember(handler?.title?.value, fixedTitleText) { @@ -56,7 +56,7 @@ fun DefaultTopAppBar( .blurredBackgroundModifier(keyboardInset, handler, remember { appPrefs.appearanceBarsBlurRadius.state }, prefAlpha, handler?.keyboardCoversBar == true, onTop, density) .drawWithCache { val backgroundColor = if (title != null || fixedTitleText != null || connection == null || !onTop) { - themeBackgroundMix.copy(prefAlpha) + themeBackgroundMix.copy(prefAlpha.value) } else { themeBackgroundMix.copy(topTitleAlpha(false, connection)) } @@ -81,7 +81,7 @@ fun DefaultTopAppBar( Row( Modifier .graphicsLayer { - alpha = if (fixedTitleText != null) prefAlpha else topTitleAlpha(true, connection) + alpha = if (fixedTitleText != null) prefAlpha.value else topTitleAlpha(true, connection) } ) { Text(