mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Tweak TriStateItem
view to match in earlier app version (#8898)
* Tweak `TriStateItem` view to match in earlier app version * Apply to disabled state too
This commit is contained in:
parent
7329f03bc5
commit
db4ae134aa
1 changed files with 9 additions and 2 deletions
|
@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.material.ContentAlpha
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowDownward
|
import androidx.compose.material.icons.filled.ArrowDownward
|
||||||
import androidx.compose.material.icons.filled.ArrowUpward
|
import androidx.compose.material.icons.filled.ArrowUpward
|
||||||
|
@ -46,6 +47,8 @@ fun TriStateItem(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(24.dp),
|
horizontalArrangement = Arrangement.spacedBy(24.dp),
|
||||||
) {
|
) {
|
||||||
|
val stateAlpha = if (onClick != null) 1f else ContentAlpha.disabled
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = when (state) {
|
imageVector = when (state) {
|
||||||
TriStateFilter.DISABLED -> Icons.Rounded.CheckBoxOutlineBlank
|
TriStateFilter.DISABLED -> Icons.Rounded.CheckBoxOutlineBlank
|
||||||
|
@ -54,13 +57,17 @@ fun TriStateItem(
|
||||||
},
|
},
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = if (state == TriStateFilter.DISABLED) {
|
tint = if (state == TriStateFilter.DISABLED) {
|
||||||
MaterialTheme.colorScheme.onSurfaceVariant
|
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = stateAlpha)
|
||||||
} else {
|
} else {
|
||||||
MaterialTheme.colorScheme.primary
|
when (onClick) {
|
||||||
|
null -> MaterialTheme.colorScheme.onSurface.copy(alpha = ContentAlpha.disabled)
|
||||||
|
else -> MaterialTheme.colorScheme.primary
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = label,
|
text = label,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = stateAlpha),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue