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.
MutableWindowInsetsfoundation-layout
How to get one
Create it
WindowInsets()WindowInsets(left: Int, top: Int, right: Int, bottom: Int)WindowInsets(left: Dp, top: Dp, right: Dp, bottom: Dp)
Ready-made values and functions that return it
BottomAppBarDefaults:windowInsetsBottomSheetDefaults:standardWindowInsets,modalWindowInsetsDrawerDefaults:windowInsetsNavigationBarDefaults:windowInsetsNavigationRailDefaults:windowInsetsScaffoldDefaults:contentWindowInsetsSearchBarDefaults:windowInsets,fullScreenWindowInsetsShortNavigationBarDefaults:windowInsetsTopAppBarDefaults:windowInsetsWideNavigationRailDefaults:windowInsetscaptionBardisplayCutoutimemandatorySystemGesturesnavigationBarsstatusBarssystemBarssystemGesturestappableElementwaterfallsafeDrawingsafeGesturessafeContent
Or create one of the kinds listed above.
Used by
Parameters that take a WindowInsets.
AppBarWithSearch(windowInsets)BottomAppBar(windowInsets)CenterAlignedTopAppBar(windowInsets)consumeWindowInsets(insets)DismissibleDrawerSheet(windowInsets)FlexibleBottomAppBar(windowInsets)LargeFlexibleTopAppBar(windowInsets)LargeTopAppBar(windowInsets)MediumFlexibleTopAppBar(windowInsets)MediumTopAppBar(windowInsets)ModalDrawerSheet(windowInsets)ModalWideNavigationRail(windowInsets)NavigationBar(windowInsets)NavigationRail(windowInsets)PermanentDrawerSheet(windowInsets)Scaffold(contentWindowInsets)SearchBar(windowInsets)ShortNavigationBar(windowInsets)TopAppBar(windowInsets)TwoRowsTopAppBar(windowInsets)WideNavigationRail(windowInsets)windowInsetsBottomHeight(insets)windowInsetsEndWidth(insets)windowInsetsPadding(insets)windowInsetsStartWidth(insets)windowInsetsTopHeight(insets)
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.