Hello everybody and a Happy New Year! Let’s say I...
# compose
s
Hello everybody and a Happy New Year! Let’s say I have a multi-module / multi-feature Android application in Compose. In one of the features I want to place a composable above all other composables (full screen), but of course this composable is not the top most composable in the hierarchy. I could put this composable at the very beginning in my
main
module, but then I would have a tight coupling of main and the feature. Is this even possible, a composable some layers down in the hierarchy rendering above all other composables?
a
Nothing is stopping you from injecting via di an interface that provides a composable method. Then you can inject it using di and have the implementation accept a child content slot composable
s
I don’t understand how this helps in my case. Do you have some (pseudo) code please?
Nevermind, I found a solution. I created a
Fullscreen
composable which adds a new
ComposeView
to Android’s root content view. Here’s the source code if you’re interested.
z
Sounds like you maybe just want a popup/dialog?
s
@Zach Klippenstein (he/him) [MOD] But the content should not look like a popup/dialog. It’s just an arbitrary composable that should be displayed on top of all other composables regardless of the position in the hierarchy.
z
What does “look like a popup” mean?
s
Doesn’t have a popup/dialog a frame around it?
z
Compose popups don’t have any chrome or decoration. Cursor and selection handles are popups, for example. Dropdown menus use popups.
s
Thanks, I will have a look at this 👍🏼