13

I disabled fitSystemWindows via WindowCompat.setDecorFitsSystemWindows(window, false) to draw behind the status bar and I am using the insets accompanist library to get the respective insets for adding padding to specific composables.

However, if I show a fullscreen dialog, the dialog still has padding to the system- and navigation bar and refuses to draw behind the status bar.

The Dialog looks like the following snippet:

Dialog(
    onDimissRequest = {},
    properties = DialogProperties(usePlatformDefaultWidth = false)
) {
    // ...
}

Is there any additional setting required in order to also let the dialog draw behind the system's status bar?

Tatsuya Fujisaki
  • 1,434
  • 15
  • 18
J. Hegg
  • 1,365
  • 11
  • 31
  • What are you looking for exactly? You are displaying dialog and the status bar and navigation bars should appear on the top of the dialog? – SemicolonSpace Aug 08 '22 at 06:50
  • Yes, or to be more specific: The dialog should be drawn below the status bar and the status bar itself should be transparent. That means the dialog takes the space of the whole screen and the Status bar is just on top of it. – J. Hegg Aug 08 '22 at 10:52
  • I don't think it is possible because the dialog is supposed to be on the top all the components. – SemicolonSpace Aug 08 '22 at 11:06
  • It's indeed possible with a legacy `DialogFragment`. I was hoping that Jetpack Compose would also offer a way to achieve that behavior. – J. Hegg Aug 08 '22 at 13:42
  • Then why do you specifically want dialog? why not a full screen navigation screen or a new activity with the transparent status bar? – SemicolonSpace Aug 08 '22 at 14:08
  • Because the screen is just used as an overlay and shows some information. It's just a single screen and totally fine to be a Dialog. Both of your mentioned solutions are too much overhead in my specific usecase. – J. Hegg Aug 09 '22 at 09:28
  • We have the same use case. Dialog is also broken in previews, not showing as full screen with `usePlatformDefaultWidth = false` so there seems to be some bugs with this. – Joakim Tall Feb 03 '23 at 08:10
  • Here is the material design info on full screen dialogs, maybe that can give more validity to the use case: https://m3.material.io/components/dialogs/guidelines#63783a40-cb25-46d4-9cd6-6f6ed43e4650 (see the section on full screen dialogs) – Joakim Tall Mar 05 '23 at 08:47
  • And here is a google issue tracker link: https://issuetracker.google.com/issues/211144843 Not much activity it seems – Joakim Tall Mar 05 '23 at 08:48

1 Answers1

0

Maybe ModalDrawerLayout can help ?

ModalDrawerLayout(
    drawerContent = {
        // smth, idk
    },
    bodyContent = {
        Dialog(
            onDismissRequest = {},
            properties = DialogProperties(usePlatformDefaultWidth = false)
        ) {
            // Dialog content here
        }
    }
)
Dumitru
  • 50
  • 1
  • 7