mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
shadow the starred badge with the icon shape, not a disc
Modifier.shadow only takes a Shape, so over artwork the star now draws with a dark copy of the same glyph offset behind it instead of a circular halo.
This commit is contained in:
@@ -13,10 +13,10 @@ import androidx.compose.foundation.layout.WindowInsets
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.offset
|
||||||
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.foundation.layout.statusBars
|
import androidx.compose.foundation.layout.statusBars
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.Star
|
import androidx.compose.material.icons.rounded.Star
|
||||||
@@ -313,15 +313,22 @@ fun StarredBadge(
|
|||||||
shadow: Boolean = false,
|
shadow: Boolean = false,
|
||||||
) {
|
) {
|
||||||
if (starred) {
|
if (starred) {
|
||||||
Icon(
|
Box(modifier.size(size)) {
|
||||||
imageVector = Icons.Rounded.Star,
|
if (shadow) {
|
||||||
contentDescription = "Starred",
|
Icon(
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
imageVector = Icons.Rounded.Star,
|
||||||
modifier =
|
contentDescription = null,
|
||||||
modifier
|
tint = Color.Black.copy(alpha = 0.5f),
|
||||||
.then(if (shadow) Modifier.shadow(2.dp, CircleShape, clip = false) else Modifier)
|
modifier = Modifier.matchParentSize().offset(x = 0.5.dp, y = 1.dp),
|
||||||
.size(size),
|
)
|
||||||
)
|
}
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Rounded.Star,
|
||||||
|
contentDescription = "Starred",
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
modifier = Modifier.matchParentSize(),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user