Share your composable. You must be applying modifiers in wrong order.
z
Zach Klippenstein (he/him) [MOD]
05/27/2021, 3:09 PM
Yea hard to say without seeing your code
m
Mehdi Haghgoo
05/27/2021, 7:47 PM
OK, here's my code:
Copy code
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colors.background) {
var clicked by remember{mutableStateOf(false)}
val offset = animateDpAsState(targetValue = if (clicked) 30.dp else 0.dp)
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxSize()
){
Box(
Modifier
.clip(RoundedCornerShape(topStart = offset.value))
.clickable {
clicked = !clicked
}
.size(200.dp)
.background(Color.Yellow)
.border(1.dp, Color.Red)
) {
Text(buildAnnotatedString {
AnnotatedString("Hello Compose", spanStyle = SpanStyle(color = Color.Black, fontSize = 50.sp))
})
}
AnimatedVisibility(clicked) {
Box(Modifier.background(Color.Green)){
Text("Welcome to Jetpack Compose")
}
}
}
}
}
}
z
Zach Klippenstein (he/him) [MOD]
05/27/2021, 8:50 PM
Just what I thought – you’re clipping the component by the shape, but not telling the border about the shape. You’ll want to pass your clip shape into the