sharif saleh
02/23/2025, 9:03 AMscale
modifier, but the issue is that the border doesn’t appear as expected. I also tried using drawBehind
, but it didn’t work as intended.
i need to make the border more flexible with the icon size
any help?
More in 🧵sharif saleh
02/23/2025, 9:03 AM@Composable
@GoogleMapComposable
private fun MarkerItemContent(
wrapper: MarkerStateWrapper
) {
val scale = remember { Animatable(1f) }
LaunchedEffect(wrapper.isSelected) {
scale.animateTo(
targetValue = if (wrapper.isSelected) 1.5f else 1f,
animationSpec = tween()
)
}
Box(
modifier = Modifier
.scale(scale.value)
.size(32.dp)
.border(
border = BorderStroke(
2.dp,
MyTheme.colors.border.primary,
),
shape = CircleShape
)
.clip(CircleShape)
.background(MyTheme.colors.buttons.marker.background),
contentAlignment = Alignment.Center
) {
MarkerIcon()
}
}
@Composable
private fun MarkerIcon() {
val drawCircleColor by animateColorAsState(
targetValue = MyTheme.colors.buttons.marker.icon, label = “icon color”
)
Icon(
painterResource(id = R.drawable.vector_icon_logo),
tint = MyTheme.colors.buttons.marker.icon,
contentDescription = “”,
modifier = Modifier
.size(MyTheme.spacing.mediumLarge)
.padding(MyTheme.spacing.one)
.drawBehind {
drawCircle(color = Color.White, style = Fill)
drawCircle(color = drawCircleColor, style = Stroke(width = 3f))
}
.padding(MyTheme.spacing.extraTiny)
)
}sharif saleh
02/23/2025, 9:04 AMChrimaeon
02/23/2025, 4:31 PMscale
modifier below/after the size
and border
. Would that help?sharif saleh
02/24/2025, 7:53 PMsize/border/scale/clip
in the second image, i tried a different order: size/clip/border/scale