Skip to content

Commit

Permalink
Remove unnecessary MaterialTheme usage in SettingsScreen
Browse files Browse the repository at this point in the history
If we update the global `MaterialTheme` it will recompose the entire tree, which is not what we want.
  • Loading branch information
msasikanth committed Aug 7, 2024
1 parent daca032 commit bfc6379
Showing 1 changed file with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
},
)
}
}
}
Expand Down

0 comments on commit bfc6379

Please sign in to comment.