https://kotlinlang.org logo
#compose
Title
# compose
c

Colton Idle

06/14/2022, 4:17 PM
I've been stuck on this for entirely way too long. How do you get the height of the status bar using accompanist? I know there's
Modifier.statusBarsHeight()
, but I don't need the Modifier, I just need to add a few values together (including the status bar height).
🙏 1
a

Alex Vanyo

06/14/2022, 5:07 PM
There’s
WindowInsets.statusBars.getTop
! Although I’m curious if you could share your use case a bit for adding some together?
a

Albert Chang

06/15/2022, 12:46 AM
In accompanist, it’s
<http://LocalWindowInsets.current.statusBars.top|LocalWindowInsets.current.statusBars.top>
.
☝️ 2
a

Alex Vanyo

06/15/2022, 12:47 AM
Whoops, I entirely missed “using accompanist”, sorry 😅
c

Colton Idle

06/15/2022, 1:13 AM
Thank you both. Haven't migrated yet. @Alex Vanyo My use case right now generally is the fact that I need to download a hero image from my back end and I need it to be the size of one of my list items but the size kept looking off and I finally figured that it's because my app is laid out edge to edge. So I need to have the status bar height to give to my back end along with the item cell height so that combined it knows the exact height image to give me.
That worked great though. My app looks awesome with a correctly sized hero image now. Thank you both again
👍 2
👍🏽 2
7 Views