我发现自己经常处于这种情况。我有一些值,如plates下面的示例所示,我想根据其是否为空来显示/隐藏它。但隐藏它总是会失败,因为只要它为空,就不会渲染任何内容,并且动画只是捕捉到空的虚无。
我怎样才能做到这一点?我想一直呆plates到动画结束。
AnimatedVisibility(
visible = plates != null,
content = {
if (plates != null) {
// Render plates
} else {
// The animation snaps to nothingness, as opposed to animating out
}
})
Run Code Online (Sandbox Code Playgroud)