The problem is simple : We usually wrap our entire app with a scaffold at topmost parent like this :
MyTheme {
Scaffold { paddingWithInsets ->
MyApp(modifier = Modifier.padding(paddingWithInsets))
}
}
but this applies a default WindowInset from Scaffold to all screens, which is equal to :
WindowInsets.Companion.systemBars
My question is: Let's say I have 50 screens in my app and one of them requires to show a full screen (status and navigation bars included) video. Do I really have to go and add systemBarsPadding() to other 49 screen and ignore scaffold padding ? Isn't there a better way and elegant way to do this ?
Thanks in advance.
You can move the Scaffold inside your screens and apply the padding only where it is needed.
I would prefer another option, though: Don't apply the padding from the Scaffold directly as a modifier Modifier.padding(paddingWithInsets), instead, just pass the PaddingValues to MyApp. Then you can decide in each screen where (and how) to apply them, like for a LazyColumn's contentPadding.