fix: fix theme switch
This commit is contained in:
@@ -29,16 +29,17 @@ import com.rosetta.messenger.ui.components.AppleEmojiText
|
||||
@Composable
|
||||
fun ThemeScreen(
|
||||
isDarkTheme: Boolean,
|
||||
currentThemeMode: String,
|
||||
onBack: () -> Unit,
|
||||
onThemeChange: (Boolean) -> Unit
|
||||
onThemeModeChange: (String) -> Unit
|
||||
) {
|
||||
val backgroundColor = if (isDarkTheme) Color(0xFF1A1A1A) else Color(0xFFFFFFFF)
|
||||
val surfaceColor = if (isDarkTheme) Color(0xFF2C2C2E) else Color(0xFFF2F2F7)
|
||||
val textColor = if (isDarkTheme) Color.White else Color.Black
|
||||
val secondaryTextColor = if (isDarkTheme) Color(0xFF8E8E93) else Color(0xFF666666)
|
||||
|
||||
|
||||
// Theme mode: "light", "dark", "auto"
|
||||
var themeMode by remember { mutableStateOf(if (isDarkTheme) "dark" else "light") }
|
||||
var themeMode by remember { mutableStateOf(currentThemeMode) }
|
||||
|
||||
// Handle back gesture
|
||||
BackHandler { onBack() }
|
||||
@@ -105,7 +106,7 @@ fun ThemeScreen(
|
||||
onClick = {
|
||||
if (themeMode != "light") {
|
||||
themeMode = "light"
|
||||
onThemeChange(false)
|
||||
onThemeModeChange("light")
|
||||
}
|
||||
},
|
||||
textColor = textColor,
|
||||
@@ -113,7 +114,7 @@ fun ThemeScreen(
|
||||
showDivider = true,
|
||||
isDarkTheme = isDarkTheme
|
||||
)
|
||||
|
||||
|
||||
TelegramThemeOption(
|
||||
icon = TablerIcons.Moon,
|
||||
title = "Dark",
|
||||
@@ -121,7 +122,7 @@ fun ThemeScreen(
|
||||
onClick = {
|
||||
if (themeMode != "dark") {
|
||||
themeMode = "dark"
|
||||
onThemeChange(true)
|
||||
onThemeModeChange("dark")
|
||||
}
|
||||
},
|
||||
textColor = textColor,
|
||||
@@ -129,14 +130,16 @@ fun ThemeScreen(
|
||||
showDivider = true,
|
||||
isDarkTheme = isDarkTheme
|
||||
)
|
||||
|
||||
|
||||
TelegramThemeOption(
|
||||
icon = TablerIcons.DeviceMobile,
|
||||
title = "System",
|
||||
isSelected = themeMode == "auto",
|
||||
onClick = {
|
||||
themeMode = "auto"
|
||||
// For now, we'll just keep the current theme
|
||||
if (themeMode != "auto") {
|
||||
themeMode = "auto"
|
||||
onThemeModeChange("auto")
|
||||
}
|
||||
},
|
||||
textColor = textColor,
|
||||
secondaryTextColor = secondaryTextColor,
|
||||
|
||||
Reference in New Issue
Block a user