Updated on 2026-08-14
This commit is contained in:
parent
92f2c8fcf0
commit
bca3dd3459
6 changed files with 135 additions and 28 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue