Aaron Yoder
06/02/2022, 10:19 AMBox(
modifier = Modifier.height(48.dp)
.fillMaxWidth()
.background(color = backgroundColor, shape = RoundedCornerShape(4.dp))
.border(border = if(selected) BorderStroke(4.dp, Color.Black) else BorderStroke(0.dp, Color.Transparent), shape = RoundedCornerShape(4.dp))
.clip(RoundedCornerShape(4.dp))
.selectable(selected = selected, onClick = { onClick.invoke(index) }),
contentAlignment = Alignment.Center
)
Albert Chang
06/02/2022, 12:03 PMinnerCornerSize + borderWidth
. For example in your case if you want the background color to have a corner size of 4dp, you should set a corner size of 8dp.Aaron Yoder
06/02/2022, 12:12 PMAlbert Chang
06/02/2022, 12:19 PMAaron Yoder
06/02/2022, 12:23 PMDragos Rachieru
06/02/2022, 12:42 PMSurface
instead of Box
and pass the border and shape to the Surface
instead of the Modifier
Albert Chang
06/02/2022, 12:42 PMModifier.border().padding(1.dp).background()
to shrink the background a little bit.Surface
shouldn’t be different.Dragos Rachieru
06/02/2022, 12:43 PMclip
called before background
and border
Aaron Yoder
06/02/2022, 12:46 PMclip
appears to do nothing whether it's there or not, other than clip the indication. I moved it before as you said, no change. Not having clip
at all is also no change.Box(
modifier = Modifier.height(48.dp)
.fillMaxWidth()
.background(color = backgroundColor, shape = RoundedCornerShape(4.dp))
.border(border = BorderStroke(4.dp, Color.Black), shape = RoundedCornerShape(4.dp))
)
Box(
modifier = Modifier.height(48.dp)
.fillMaxWidth()
.background(color = backgroundColor, shape = if(selected) RoundedCornerShape(6.dp) else RoundedCornerShape(4.dp))
.border(border = borderStroke, shape = RoundedCornerShape(4.dp))
.clip(RoundedCornerShape(4.dp))
.selectable(selected = selected, onClick = { onClick.invoke(index) }),
contentAlignment = Alignment.Center
)
But definitely a bit silly.orangy
06/02/2022, 1:16 PMNader Jawad
06/30/2022, 12:42 AM