Appearance: dynamic colour as a GroupedSwitchRow, subtask inset in compact (#118)
This commit is contained in:
1 parent
ba05c442f0
commit
89fe7c17ea
3 files changed
+11
-23
No files matched your search
@@ -16,7 +16,6 @@ import androidx.compose.material.icons.rounded.Search
|
||||
import androidx.compose.material.icons.rounded.Settings
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@@ -89,27 +88,18 @@ internal fun AppearanceScreen(
|
||||
leading = { Icon(Icons.Rounded.DarkMode, contentDescription = null) },
|
||||
onClick = { showTheme = true },
|
||||
)
|
||||
GroupedRow(
|
||||
GroupedSwitchRow(
|
||||
title = stringResource(R.string.settings_dynamic_color),
|
||||
summary = if (dynamicColorAvailable) {
|
||||
stringResource(R.string.settings_dynamic_color_hint)
|
||||
} else {
|
||||
stringResource(R.string.settings_dynamic_color_unavailable)
|
||||
},
|
||||
checked = state.settings.dynamicColor && dynamicColorAvailable,
|
||||
onCheckedChange = viewModel::setDynamicColor,
|
||||
position = Position.Bottom,
|
||||
enabled = dynamicColorAvailable,
|
||||
leading = { Icon(Icons.Rounded.Palette, contentDescription = null) },
|
||||
trailing = {
|
||||
Switch(
|
||||
checked = state.settings.dynamicColor && dynamicColorAvailable,
|
||||
onCheckedChange = viewModel::setDynamicColor,
|
||||
enabled = dynamicColorAvailable,
|
||||
)
|
||||
},
|
||||
onClick = if (dynamicColorAvailable) {
|
||||
{ viewModel.setDynamicColor(!state.settings.dynamicColor) }
|
||||
} else {
|
||||
null
|
||||
},
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(8.dp))
|
||||
@@ -287,13 +277,11 @@ private fun actionStyleLabel(style: ActionStyle): Int = when (style) {
|
||||
}
|
||||
|
||||
/** The home top bar's own actions, as the Buttons choice previews them. */
|
||||
private val PreviewActions: List<Pair<ImageVector, RoundedPolygon>> by lazy {
|
||||
listOf(
|
||||
Icons.Rounded.Search to ActionShapes.Search,
|
||||
Icons.Rounded.Settings to ActionShapes.Settings,
|
||||
Icons.Rounded.Add to ActionShapes.AddList,
|
||||
)
|
||||
}
|
||||
private val PreviewActions: List<Pair<ImageVector, RoundedPolygon>> = listOf(
|
||||
Icons.Rounded.Search to ActionShapes.Search,
|
||||
Icons.Rounded.Settings to ActionShapes.Settings,
|
||||
Icons.Rounded.Add to ActionShapes.AddList,
|
||||
)
|
||||
|
||||
private fun themeLabel(mode: ThemeMode): Int = when (mode) {
|
||||
ThemeMode.SYSTEM -> R.string.settings_theme_system
|
||||
|
||||
@@ -1185,7 +1185,7 @@ private fun SubtaskRow(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = byDensity(56.dp, 48.dp))
|
||||
.padding(start = 12.dp, end = 16.dp, top = byDensity(6.dp, 0.dp), bottom = byDensity(6.dp, 0.dp)),
|
||||
.padding(start = 12.dp, end = 16.dp, top = byDensity(6.dp, 2.dp), bottom = byDensity(6.dp, 2.dp)),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
// No colour bar — that absence (with the grouped nesting) marks the row
|
||||
|
||||
+1
-1
Submodule floret-kit updated: 4d9c014eff...34b86dbfe5.
Reference in new issue
Block a user