Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANDROID-14416 Allow tint for RowItem icons #334

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand All @@ -29,13 +31,15 @@ sealed class ListRowIcon(val contentDescription: String?) {
val painter: Painter? = null,
private val description: String? = null,
val modifier: Modifier = Modifier,
val tint: Color? = null,
) : ListRowIcon(description)

data class CircleIcon(
val painter: Painter? = null,
val backgroundColor: Color = Color.Transparent,
private val description: String? = null,
val modifier: Modifier = Modifier,
val tint: Color? = null,
) : ListRowIcon(description)

data class SmallAsset(
Expand Down Expand Up @@ -88,7 +92,8 @@ sealed class ListRowIcon(val contentDescription: String?) {
Icon(
painter = painter,
modifier = Modifier.size(24.dp),
contentDescription = contentDescription
contentDescription = contentDescription,
tint = tint ?: LocalContentColor.current.copy(alpha = LocalContentAlpha.current)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)
}
}
Expand All @@ -104,7 +109,8 @@ sealed class ListRowIcon(val contentDescription: String?) {
painter?.let {
Icon(
painter = painter,
contentDescription = contentDescription
contentDescription = contentDescription,
tint = tint ?: LocalContentColor.current.copy(alpha = LocalContentAlpha.current)
jeprubio marked this conversation as resolved.
Show resolved Hide resolved
)
}
}
Expand Down
Loading