Compose Modifier

windowInsetsStartWidth

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

insetsStartWidthSample

@Sampled
fun insetsStartWidthSample() {
    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 start
                    Box(
                        Modifier.windowInsetsStartWidth(WindowInsets.navigationBars)
                            .fillMaxHeight()
                            .align(Alignment.CenterStart)
                            .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: