I can add system bars padding via `systemBarsPaddi...
# compose
a
I can add system bars padding via
systemBarsPadding()
, is there a way to get the height of the system bars in
dp
instead of applying the padding directly?
m
WindowInsets.systemBars
?
Also, see https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/WindowInsets for the available methods & operators to get specific paddings (left, top....etc)
🙏 1
j
here:
Copy code
val NavigationBarHeightDp
    @Composable
    get() = with(LocalDensity.current) {
        WindowInsets.systemBars.getBottom(this).toDp()
    }

val StatusBarHeightDp
    @Composable
    get() = with(LocalDensity.current) {
        WindowInsets.systemBars.getTop(this).toDp()
    }
🙏 1
a
Man, thanks a lot. I couldn’t easily find this information. Great to hear there is an easy solution!
m
@Ji Sungbin Doesn't this assume the navigation bar is horizontal? It won't work in landscape mode if that's the case.
j
Oh right, I didn’t even think of that. thanks for pointing it out!