Improve settings item color

This commit is contained in:
Ash 2022-04-07 03:22:47 +08:00
parent 890ee337a4
commit 0db39247e3
4 changed files with 8 additions and 7 deletions

View File

@ -39,15 +39,14 @@ fun SelectableSettingGroupItem(
Surface( Surface(
modifier = modifier.clickable { onClick() }, modifier = modifier.clickable { onClick() },
color = Color.Unspecified, color = Color.Unspecified,
contentColor = if (selected) MaterialTheme.colorScheme.surface else MaterialTheme.colorScheme.onSurface
) { ) {
Row( Row(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp)
.background( .background(
if (selected) MaterialTheme.colorScheme.onSurface else Color.Unspecified, color = if (selected) MaterialTheme.colorScheme.onSurface else MaterialTheme.colorScheme.surface,
RoundedCornerShape(24.dp) shape = RoundedCornerShape(24.dp)
) )
.padding(8.dp, 16.dp), .padding(8.dp, 16.dp),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
@ -55,9 +54,9 @@ fun SelectableSettingGroupItem(
icon?.let { icon?.let {
Icon( Icon(
imageVector = it, imageVector = it,
contentDescription = null, contentDescription = title,
modifier = Modifier.padding(start = 8.dp, end = 16.dp), modifier = Modifier.padding(start = 8.dp, end = 16.dp),
tint = if (selected) MaterialTheme.colorScheme.surface.copy(alpha = 0.8f) else MaterialTheme.colorScheme.onSurface.copy(alpha = 0.8f), tint = if (selected) MaterialTheme.colorScheme.surfaceVariant else MaterialTheme.colorScheme.onSurfaceVariant
) )
} }
Column(modifier = Modifier.weight(1f)) { Column(modifier = Modifier.weight(1f)) {
@ -65,6 +64,7 @@ fun SelectableSettingGroupItem(
text = title, text = title,
maxLines = if (desc == null) 2 else 1, maxLines = if (desc == null) 2 else 1,
style = MaterialTheme.typography.titleLarge.copy(fontSize = 20.sp), style = MaterialTheme.typography.titleLarge.copy(fontSize = 20.sp),
color = if (selected) MaterialTheme.colorScheme.surface else MaterialTheme.colorScheme.onSurface,
) )
desc?.let { desc?.let {
Text( Text(

View File

@ -72,6 +72,7 @@ fun SettingsPage(
} }
item { item {
SelectableSettingGroupItem( SelectableSettingGroupItem(
selected = true,
title = stringResource(R.string.color_and_style), title = stringResource(R.string.color_and_style),
desc = stringResource(R.string.color_and_style_desc), desc = stringResource(R.string.color_and_style_desc),
icon = Icons.Outlined.Palette, icon = Icons.Outlined.Palette,

View File

@ -71,7 +71,7 @@
<string name="get_new_updates">获取新的更新</string> <string name="get_new_updates">获取新的更新</string>
<string name="get_new_updates_desc">版本 0.6.1 现已发布</string> <string name="get_new_updates_desc">版本 0.6.1 现已发布</string>
<string name="accounts">账户</string> <string name="accounts">账户</string>
<string name="accounts_desc">本地、Fresh</string> <string name="accounts_desc">本地、FreshRSS</string>
<string name="color_and_style">颜色和样式</string> <string name="color_and_style">颜色和样式</string>
<string name="color_and_style_desc">主题、色彩系统、字体大小</string> <string name="color_and_style_desc">主题、色彩系统、字体大小</string>
<string name="interaction">交互</string> <string name="interaction">交互</string>

View File

@ -71,7 +71,7 @@
<string name="get_new_updates">Get New updates</string> <string name="get_new_updates">Get New updates</string>
<string name="get_new_updates_desc">Version 0.6.1 has been released</string> <string name="get_new_updates_desc">Version 0.6.1 has been released</string>
<string name="accounts">Accounts</string> <string name="accounts">Accounts</string>
<string name="accounts_desc">Local, Fresh</string> <string name="accounts_desc">Local, FreshRSS</string>
<string name="color_and_style">Color &amp; style</string> <string name="color_and_style">Color &amp; style</string>
<string name="color_and_style_desc">Theme, color system, font size</string> <string name="color_and_style_desc">Theme, color system, font size</string>
<string name="interaction">Interaction</string> <string name="interaction">Interaction</string>