androidx.compose.foundation.layout

WindowInsets

Interface · from org.jetbrains.compose.foundation:foundation-layout:1.12.2

No hand-written docs yet.

A representation of window insets that tracks access to enable recomposition, relayout, and redrawing when values change. These values should not be read during composition to avoid doing composition for every frame of an animation. Use methods like Modifier.windowInsetsPadding, Modifier.systemBarsPadding, and Modifier.windowInsetsTopHeight for Modifiers that will not cause recomposition when values change.

interface WindowInsets

Kinds of WindowInsets

Anywhere a WindowInsets is expected, you can pass any of these.

How to get one

Create it

Ready-made values and functions that return it

Or create one of the kinds listed above.

Used by

Parameters that take a WindowInsets.

Functions

getLeft

fun getLeft(density: Density, layoutDirection: LayoutDirection): Int

The space, in pixels, at the left of the window that the inset represents.

getTop

fun getTop(density: Density): Int

The space, in pixels, at the top of the window that the inset represents.

getRight

fun getRight(density: Density, layoutDirection: LayoutDirection): Int

The space, in pixels, at the right of the window that the inset represents.

getBottom

fun getBottom(density: Density): Int

The space, in pixels, at the bottom of the window that the inset represents.

Library docs

A representation of window insets that tracks access to enable recomposition, relayout, and redrawing when values change. These values should not be read during composition to avoid doing composition for every frame of an animation. Use methods like Modifier.windowInsetsPadding, Modifier.systemBarsPadding, and Modifier.windowInsetsTopHeight for Modifiers that will not cause recomposition when values change.

Use the WindowInsets.Companion extensions to retrieve WindowInsets for the current window.