keep the menu icons on their content colour so they are not black

Color.Unspecified disables Icon's colour filter, which fell back to the vector's black; only
the filled star should be the primary colour.
This commit is contained in:
austinried
2026-10-04 00:29:59 +00:00
parent da1c6f37d8
commit a43f9f3412
@@ -22,6 +22,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem import androidx.compose.material3.ListItem
import androidx.compose.material3.ListItemDefaults import androidx.compose.material3.ListItemDefaults
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text import androidx.compose.material3.Text
@@ -235,7 +236,7 @@ private fun StarItem(
MenuItem( MenuItem(
starIcon(starred), starIcon(starred),
starLabel(starred), starLabel(starred),
tint = if (starred == null) Color.Unspecified else MaterialTheme.colorScheme.primary, tint = if (starred == null) null else MaterialTheme.colorScheme.primary,
) { ) {
val previous = starred val previous = starred
val starring = previous == null val starring = previous == null
@@ -250,12 +251,12 @@ private fun StarItem(
private fun MenuItem( private fun MenuItem(
icon: ImageVector, icon: ImageVector,
label: String, label: String,
tint: Color = Color.Unspecified, tint: Color? = null,
onClick: () -> Unit, onClick: () -> Unit,
) { ) {
ListItem( ListItem(
headlineContent = { Text(label) }, headlineContent = { Text(label) },
leadingContent = { Icon(icon, contentDescription = null, tint = tint) }, leadingContent = { Icon(icon, contentDescription = null, tint = tint ?: LocalContentColor.current) },
colors = ListItemDefaults.colors(containerColor = Color.Transparent), colors = ListItemDefaults.colors(containerColor = Color.Transparent),
modifier = Modifier.clickable(onClick = onClick), modifier = Modifier.clickable(onClick = onClick),
) )