From bfc6379f99ef54dd189ec4ea99a4c9d9305873bc Mon Sep 17 00:00:00 2001 From: Sasikanth Miriyampalli Date: Wed, 7 Aug 2024 09:47:45 +0530 Subject: [PATCH] Remove unnecessary `MaterialTheme` usage in `SettingsScreen` If we update the global `MaterialTheme` it will recompose the entire tree, which is not what we want. --- .../rss/reader/settings/ui/SettingsScreen.kt | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/settings/ui/SettingsScreen.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/settings/ui/SettingsScreen.kt index 92557cdb0..12b999655 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/settings/ui/SettingsScreen.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/settings/ui/SettingsScreen.kt @@ -46,7 +46,6 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.TopAppBarDefaults -import androidx.compose.material3.darkColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -486,29 +485,19 @@ private fun BrowserTypeSettingItem( Spacer(Modifier.width(16.dp)) - MaterialTheme( - colorScheme = - darkColorScheme( - primary = AppTheme.colorScheme.tintedSurface, - onPrimary = AppTheme.colorScheme.tintedForeground, - outline = AppTheme.colorScheme.outline, - surfaceVariant = AppTheme.colorScheme.surfaceContainer - ) - ) { - Switch( - checked = checked, - onCheckedChange = { checked -> - val newBrowserType = - if (checked) { - BrowserType.InApp - } else { - BrowserType.Default - } + Switch( + checked = checked, + onCheckedChange = { checked -> + val newBrowserType = + if (checked) { + BrowserType.InApp + } else { + BrowserType.Default + } - onBrowserTypeChanged(newBrowserType) - }, - ) - } + onBrowserTypeChanged(newBrowserType) + }, + ) } } }