nlindberg
11/01/2021, 10:20 AMAnimatedVisibility(
visible = viewModel.show,
enter = slideInVertically() + fadeIn(initialAlpha = 0f),
exit = slideOutVertically() + fadeOut()
) {
Box(
modifier = Modifier
.shadow(elevation = 5.dp, shape = TooltipShape(0.7f), clip = false)
.background(color = Color.White, shape = TooltipShape())
.padding(horizontal = 12.dp, vertical = 14.dp)
) {
content()
}
Doris Liu
11/01/2021, 5:52 PMfadeIn
and fadeOut
uses a Modifier.graphicsLayer
under the hood for animating alpha. When alpha is not 1f, there's an implicit clipping to bounds, as the layer is sized to the bounds of the composable. See a similar discussion:
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1633007272301100