refactor: apply mr feedback

This commit is contained in:
FunkyMuse 2023-07-24 21:39:03 +02:00
parent d280f40c87
commit 0000ecc50c
2 changed files with 14 additions and 4 deletions

View File

@ -46,7 +46,11 @@ fun SettingsCheckBoxComponent(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
modifier = modifier modifier = modifier
.fillMaxWidth() .fillMaxWidth()
.clickable(onClick = { onChange?.invoke(!initialValue) }, interactionSource = interactionSource, indication = indication) .clickable(
onClick = { onChange?.invoke(!initialValue) },
interactionSource = interactionSource,
indication = indication
)
.padding(horizontal = 16.dp, vertical = 6.dp), .padding(horizontal = 16.dp, vertical = 6.dp),
) { ) {
Column( Column(
@ -77,7 +81,10 @@ fun SettingsCheckBoxComponent(
checked = initialValue, checked = initialValue,
onCheckedChange = { onChange?.invoke(it) }, onCheckedChange = { onChange?.invoke(it) },
enabled = isPreferenceEnabled, enabled = isPreferenceEnabled,
colors = CheckboxDefaults.colors(checkedColor = checkboxColor, checkmarkColor = MaterialTheme.colorScheme.surface), colors = CheckboxDefaults.colors(
checkedColor = checkboxColor,
checkmarkColor = MaterialTheme.colorScheme.surface
),
interactionSource = interactionSource interactionSource = interactionSource
) )
} }

View File

@ -16,6 +16,7 @@ import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.simplemobiletools.calculator.compose.theme.model.Theme import com.simplemobiletools.calculator.compose.theme.model.Theme
import com.simplemobiletools.calculator.compose.theme.model.Theme.Companion.systemDefaultMaterialYou import com.simplemobiletools.calculator.compose.theme.model.Theme.Companion.systemDefaultMaterialYou
import com.simplemobiletools.calculator.extensions.config import com.simplemobiletools.calculator.extensions.config
import com.simplemobiletools.commons.helpers.isSPlus
@Composable @Composable
internal fun Theme( internal fun Theme(
@ -30,7 +31,7 @@ internal fun Theme(
val colorScheme = if (!view.isInEditMode) { val colorScheme = if (!view.isInEditMode) {
val colorScheme = when { val colorScheme = when {
theme is Theme.SystemDefaultMaterialYou && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { theme is Theme.SystemDefaultMaterialYou && isSPlus() -> {
if (isSystemInDarkTheme()) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) if (isSystemInDarkTheme()) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
} }
@ -58,7 +59,9 @@ internal fun Theme(
colorScheme colorScheme
} else darkColorScheme } else {
darkColorScheme
}
SideEffect { SideEffect {
systemUiController.setNavigationBarColor(colorScheme.surface, navigationBarContrastEnforced = false) systemUiController.setNavigationBarColor(colorScheme.surface, navigationBarContrastEnforced = false)