When using a LazyColumn we got access to `contentP...
# compose
s
When using a LazyColumn we got access to
contentPadding
which is super convenient to do smth like this
LazyColumn(contentPadding = WindowInsets.safeDrawing.asPaddingValues())
. However when working with something that does not provide this convenient
contentPadding
parameter, one has to do something like this instead
Copy code
Column(Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)).verticalScroll(rememberScrollState())) {
  Spacer(Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(<http://WindowInsetsSides.Top|WindowInsetsSides.Top>)))
  Stuff()
  Spacer(Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom)))
}
Is this simply the way to go or am I missing some API?
a
Modifier order matters so you can just use
Column(Modifier.verticalScroll().safeDrawingPadding())
.
s
Modifier ordering is still something that trips me up sometimes 😅 Thanks a lot, this is exactly what I was trying to go for! Had to change
safeDrawingPadding
with
.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom))
since I had a TopAppBar above which was handling the top insets and it now looks exactly how I wanted it to 👌 Thanks a lot!
c
Am I missing something? I'm still using accompanist insets, but I just use modifier.statusBarPadding on top and navigationBarPadding for the bottom.
s
How does that work for you when you rotate the screen and the status bars are navigation bar is now on the left/right?
c
status bars on the left/right? I don't think I've ever seen that.
s
I meant navigation bar 🙈
c
Oh. Hm. I guess I've never taken that into account. TIL!
s
Try you app in landscape and specifically the 3 button navigation (because it's much thicker than the gesture navigation) if you're not handling this at all, you'll probably figure out some things are not clickable at all, some text may be ineligible and/or in general the UI might look super ugly.