Is it possible to have a screen that is floating o...
# compose
l
Is it possible to have a screen that is floating over other screens, kinda like a Full Screen Dialog? I'm not looking for a modification of a
Dialog
but something more low level, simply a screen that overlays another screen
m
You don’t need a route to have a dialog. You can simply take a normal approach of defining some remembered state:
Copy code
val (showDialog, onShowDialogChanged) = remember { mutableStateOf(false) }
Then just create the dialog:
Copy code
if (showDialog) {
   Dialog(....)
}
and just turn the flag on and off to show it. It can live entirely within your existing route.
l
Thanks but I'm not asking for how to create a dialog. I want a screen that overlays like a dialog does but dont want a dialog. I'm looking for a lower level component
a
How about adding a new Window just like how Dialog does it?
👍 1
z
There are two ways to do this, depending on what you need: 1. At the root of your composition use a
Box
to overlay your modal content over the other content . 1. Use the
Popup
composable . It uses a different window, like
Dialog
, but without all the styling implications of
Dialog
.
👍 1
Eg the text selection handles use
Popup
. I think
DropdownMenu
does as well.
l
@Allan @Zach Klippenstein (he/him) [MOD] Thanks guys. I'm interested in adding a new
Window
so
Dialog
or
Popup
would be suitable...but. I have a problem with the misleading intention (a
Popup
is a
Popup
, not a screen). So if I don't want to go with
Popup
or
Dialog
I would have to compose my own "FullScreen" component by leveraging the underlying
Dialog/Popup
logic (i.e. adding a new Window), right?
z
You should be able to make a
Popup
take up the whole screen if you want. If you want to wrap that in your own composable to enforce styling or api requirements, go ahead.