Переглянути джерело

Tweak `TriStateItem` view to match in earlier app version (#8898)

* Tweak `TriStateItem` view to match in earlier app version

* Apply to disabled state too
zbue 2 роки тому
батько
коміт
db4ae134aa

+ 9 - 2
app/src/main/java/eu/kanade/presentation/components/SettingsItems.kt

@@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Spacer
 import androidx.compose.foundation.layout.fillMaxWidth
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.size
+import androidx.compose.material.ContentAlpha
 import androidx.compose.material.icons.Icons
 import androidx.compose.material.icons.filled.ArrowDownward
 import androidx.compose.material.icons.filled.ArrowUpward
@@ -46,6 +47,8 @@ fun TriStateItem(
         verticalAlignment = Alignment.CenterVertically,
         horizontalArrangement = Arrangement.spacedBy(24.dp),
     ) {
+        val stateAlpha = if (onClick != null) 1f else ContentAlpha.disabled
+
         Icon(
             imageVector = when (state) {
                 TriStateFilter.DISABLED -> Icons.Rounded.CheckBoxOutlineBlank
@@ -54,13 +57,17 @@ fun TriStateItem(
             },
             contentDescription = null,
             tint = if (state == TriStateFilter.DISABLED) {
-                MaterialTheme.colorScheme.onSurfaceVariant
+                MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = stateAlpha)
             } else {
-                MaterialTheme.colorScheme.primary
+                when (onClick) {
+                    null -> MaterialTheme.colorScheme.onSurface.copy(alpha = ContentAlpha.disabled)
+                    else -> MaterialTheme.colorScheme.primary
+                }
             },
         )
         Text(
             text = label,
+            color = MaterialTheme.colorScheme.onSurface.copy(alpha = stateAlpha),
             style = MaterialTheme.typography.bodyMedium,
         )
     }