New Compose Multiplatform components arrived on Composables UICheck it out →

Modifier in Compose Foundation Layout

windowInsetsEndWidth

Common

Sets the width to that of [insets] at the [end][androidx.compose.ui.Alignment.End] of the screen, using either [left][WindowInsets.getLeft] or [right][WindowInsets.getRight], depending on the [LayoutDirection].

When used, the [WindowInsets][android.view.WindowInsets] will respect the consumed insets from [windowInsetsPadding] and [consumeWindowInsets], but won't consume any insets.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.foundation:foundation-layout:1.7.0-beta04")
}

Overloads

@Stable
fun Modifier.windowInsetsEndWidth(insets: WindowInsets)

Code Example

insetsEndWidthSample

@Sampled
fun insetsEndWidthSample() {
    class SampleActivity : ComponentActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            WindowCompat.setDecorFitsSystemWindows(window, false)
            super.onCreate(savedInstanceState)
            setContent {
                Box(Modifier.fillMaxSize()) {
                    // Background for navigation bar at the end
                    Box(Modifier.windowInsetsEndWidth(WindowInsets.navigationBars)
                        .fillMaxHeight()
                        .align(Alignment.CenterEnd)
                        .background(Color.Red)
                    )
                    // app content
                }
            }
        }
    }
}