0

I have a surface in Jetpack Compose which expands on click.

var expanded by remember { mutableStateOf(false) }
Column(modifier = Modifier.fillMaxSize()) {
  Surface(color = Color.Gray, onClick = { expanded = !expanded }) {
    Column {
      Box(Modifier.fillMaxWidth().height(50.dp))
      AnimatedVisibility(visible = expanded) { Box(Modifier.fillMaxWidth().height(200.dp)) }
    }
  }
}

My problem is, that I want the ripple to fill the whole expanded container, as can be seen here (rightmost video, expansion of the searchbar). In reality, the ripple is too small and suddenly stops:

Ripple not fully covering expanded surface

I supose this might be because the size is determined at the start of the animation, and does not adapt to the changed surface size. Is there any way to fix this?

Robin
  • 333
  • 1
  • 12

0 Answers0