Compose Modifier

windowInsetsEndWidth

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

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
                }
            }
        }
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: