mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 16:55:26 +02:00
Inline theming modes
This commit is contained in:
parent
781d6b350a
commit
0b5066fa18
@ -41,8 +41,6 @@ import androidx.compose.material3.Icon
|
|||||||
import androidx.compose.material3.ListItem
|
import androidx.compose.material3.ListItem
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@ -134,16 +132,6 @@ private fun ThemesScreen(
|
|||||||
monetMode: MonetMode,
|
monetMode: MonetMode,
|
||||||
onMonetModeChange: (MonetMode) -> Unit
|
onMonetModeChange: (MonetMode) -> Unit
|
||||||
) {
|
) {
|
||||||
val themingModes by remember {
|
|
||||||
mutableStateOf(
|
|
||||||
mapOf(
|
|
||||||
ThemingMode.AUTO to (R.string.auto_label to Icons.Outlined.HdrAuto),
|
|
||||||
ThemingMode.FORCE_LIGHT to (R.string.force_light_mode to Icons.Outlined.LightMode),
|
|
||||||
ThemingMode.FORCE_DARK to (R.string.force_dark_mode to Icons.Outlined.DarkMode)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
UnittoScreenWithLargeTopBar(
|
UnittoScreenWithLargeTopBar(
|
||||||
title = stringResource(R.string.theme_setting),
|
title = stringResource(R.string.theme_setting),
|
||||||
navigationIcon = { NavigateUpButton(navigateUpAction) }
|
navigationIcon = { NavigateUpButton(navigateUpAction) }
|
||||||
@ -170,15 +158,24 @@ private fun ThemesScreen(
|
|||||||
.wrapContentWidth()
|
.wrapContentWidth()
|
||||||
) {
|
) {
|
||||||
SegmentedButtonsRow(modifier = Modifier.padding(56.dp, 8.dp, 24.dp, 2.dp)) {
|
SegmentedButtonsRow(modifier = Modifier.padding(56.dp, 8.dp, 24.dp, 2.dp)) {
|
||||||
themingModes.forEach { (mode, visuals) ->
|
|
||||||
val (label, icon) = visuals
|
|
||||||
SegmentedButton(
|
SegmentedButton(
|
||||||
label = stringResource(label),
|
label = stringResource(R.string.auto_label),
|
||||||
onClick = { onThemeChange(mode) },
|
onClick = { onThemeChange(ThemingMode.AUTO) },
|
||||||
selected = mode == currentThemingMode,
|
selected = ThemingMode.AUTO == currentThemingMode,
|
||||||
icon = icon
|
icon = Icons.Outlined.HdrAuto
|
||||||
|
)
|
||||||
|
SegmentedButton(
|
||||||
|
label = stringResource(R.string.force_light_mode),
|
||||||
|
onClick = { onThemeChange(ThemingMode.FORCE_LIGHT) },
|
||||||
|
selected = ThemingMode.FORCE_LIGHT == currentThemingMode,
|
||||||
|
icon = Icons.Outlined.LightMode
|
||||||
|
)
|
||||||
|
SegmentedButton(
|
||||||
|
label = stringResource(R.string.force_dark_mode),
|
||||||
|
onClick = { onThemeChange(ThemingMode.FORCE_DARK) },
|
||||||
|
selected = ThemingMode.FORCE_DARK == currentThemingMode,
|
||||||
|
icon = Icons.Outlined.DarkMode
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user