So this is how i ended up giving my jetpack Compose box a rounded circle shape
Box(modifier = Modifier
.size(32.dp)
.clip(CircleShape)
.border(BorderStroke(2.dp, Color.Red), CircleShape)
){
}
As you can see , CircleShape is mentioned twice in the modifier chain . It feels as if there has got to be a better way to do this .
Any ideas?
Modifier.clip
is needed if you are supposed chain background,pointerInput
(clickable also a pointerInput),graphicsLayer
or anyModifier
that requires current layer of your Composable. Modifier.clip() isModifier.graphicsLayer{clip =true shape=shape}
and layer effects physical presence sort of, order of Modifier.graphics also define how your Composable behaves.On the other hand Modifier.border() is a DrawModifier which has no effect on physical presence of you Composable