Updated on 2026-08-14

This commit is contained in:
Tangem 2025-05-22 10:43:14 +03:00
parent 92f2c8fcf0
commit bca3dd3459
6 changed files with 135 additions and 28 deletions

View file

@ -107,7 +107,7 @@ fun TangemTheme(
CompositionLocalProvider(
LocalTangemShimmer provides TangemShimmer,
LocalMainBottomSheetColor provides remember { mutableStateOf(Color.Unspecified) },
LocalRootBackgroundColor provides remember { mutableStateOf(rootBackgroundColor) },
LocalRootBackgroundColor provides remember(rootBackgroundColor) { mutableStateOf(rootBackgroundColor) },
LocalTextSelectionColors provides TangemTextSelectionColors,
) {
ProvideTextStyle(

View file

@ -0,0 +1,31 @@
package com.tangem.core.ui.utils
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import com.tangem.core.ui.res.LocalRootBackgroundColor
@Composable
fun ChangeRootBackgroundColorEffect(color: Color) {
var rootBackgroundColor by LocalRootBackgroundColor.current
var previousColor by remember { mutableStateOf(rootBackgroundColor) }
DisposableEffect(color) {
rootBackgroundColor = color
onDispose {
rootBackgroundColor = previousColor
}
}
LaunchedEffect(rootBackgroundColor) {
if (rootBackgroundColor != color) {
previousColor = rootBackgroundColor
rootBackgroundColor = color
}
}
}