rob42
06/01/2024, 9:43 AMDialog
- scrim can't be animated or customized
2. Popup
with a Box(Modifier.fillMaxSize().background(...))
inside - easy to fade in when added to the composition, e.g. using AnimatedVisibility, but hard to fade out when removed. AnimatedVisibility does not keep the Popup around, so it disappears instantly.
3. A custom-built rememberScrimController()
that adds another JPanel at the window level. Works fine but I don't like touching Swing unless absolutely necessary.Tobias Suchalla
06/03/2024, 5:24 AMAnimatedContent
. This allows content to be animated in and out, so option 2 would work.rob42
06/03/2024, 9:06 AMAnimatedVisibility
nor AnimatedContent
work with Popups -- at least in my experience. The Popup gets immediately removed from the composition. You can use AnimatedVisibility for the content inside the popup, but then you have to leave the popup around.
I ended up doing a variant of (3) but in compose. I used a Scrim {}
composable at the root which exposes a LocalScrimState
for descendants to use to change the scrim. Not ideal, but it works.