Assuming edge-to-edge, how do you correctly apply ...
# compose-android
a
Assuming edge-to-edge, how do you correctly apply
Modifier.navigationBarPadding()
so that it overlays over content, while still leaving space when you scroll to the end? More in thread.
Recording 1:
Copy code
Column {
  Content()
  … // more stuff
  Spacer(Modifier.navigationBarPadding()) // last
}
Recording 2:
Copy code
Column(Modifier.navigationBarPadding()) {
    Content()
    … // more stuff
}
(2) is obviously simpler, as you can just apply it to the parent composable (e.g. NavHost), but it doesn't give me what I want. (1) is what I want, but it's quite cumbersome to do this in every screen, especially when it needs to be applied conditionally. For example, if we're choosing to show a bottom bar instead of a side rail on small screens, we don't need to apply nav bar padding as it's not relevant anymore. With (1) I find myself needing to pass a few parameters to every single composable; from the parent all the way down to the last child that needs to use it. This just feels like a lot of unnecessary parameter drilling when maybe it can be handled in a better way?
s
Should be doing #1 always, and if the nav bar shows, the insets must've already been consumed by that NavBar so navigationBarPadding() would evaluate to 0.dp anyway
f
these are useful resources https://developer.android.com/jetpack/compose/layouts/insets

https://www.youtube.com/watch?v=rorofoIpo1A