Roberto Fernandez Montero
06/04/2025, 4:15 PMRoberto Fernandez Montero
06/04/2025, 4:17 PMJonathan
06/04/2025, 4:40 PMmodifier
after the shape modifier
otherwise you’ll loose the “fan out” bits towards the top and bottom left edges of the shape.
b. Animating this would be trickier. You won’t be able to easily animate the “selection” shape animating behind the intermediate items… You could possibly do a funky shrinking/growing animating though.Chrimaeon
06/04/2025, 5:55 PMChrimaeon
06/04/2025, 6:13 PM@Composable
@Preview
fun BoxScreen() {
Box(
Modifier
.fillMaxSize()
.background(Color.White),
) {
Box(
Modifier
.width(200.dp)
.fillMaxHeight()
.background(Color.White),
) {
Column {
Box(
Modifier
.fillMaxWidth()
.height(20.dp)
.clip(
RoundedCornerShape(bottomEnd = 20.dp),
)
.background(Color.Green),
)
Box(
Modifier
.fillMaxWidth()
.height(20.dp)
.background(Color.White),
)
Box(
Modifier
.fillMaxWidth()
.height(20.dp)
.clip(
RoundedCornerShape(topEnd = 20.dp),
)
.background(Color.Green),
)
}
}
}
}
Chrimaeon
06/04/2025, 6:20 PM@Composable
@Preview
fun BoxScreen() {
var enabled by remember { mutableStateOf(false) }
val radius by animateDpAsState(if (enabled) 20.dp else 0.dp)
Box(
Modifier
.fillMaxSize()
.background(Color.White),
) {
Box(
Modifier
.width(200.dp)
.fillMaxHeight()
.background(Color.White),
) {
Column {
Box(
Modifier
.fillMaxWidth()
.height(20.dp)
.clip(
RoundedCornerShape(bottomEnd = radius),
)
.background(Color.Green),
)
Box(
Modifier
.fillMaxWidth()
.height(20.dp)
.background(if (enabled) Color.White else Color.Green)
.clickable {
enabled = !enabled
},
)
Box(
Modifier
.fillMaxWidth()
.height(20.dp)
.clip(
RoundedCornerShape(topEnd = radius),
)
.background(Color.Green),
)
}
}
}
}
Jonathan
06/04/2025, 6:23 PMChrimaeon
06/04/2025, 6:26 PMChrimaeon
06/04/2025, 6:27 PMJonathan
06/04/2025, 6:28 PMJonathan
06/04/2025, 6:33 PMRoberto Fernandez Montero
06/05/2025, 8:52 AMSanlorng
06/05/2025, 2:16 PMSanlorng
06/05/2025, 2:16 PM