Adds padding to accommodate the [safe content][WindowInsets.
safeContentPaddingSample
fun safeContentPaddingSample() {
class SampleActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
Box(Modifier.background(Color.Black).systemBarsPadding()) {
// The app content will only be drawn where there is no possible
// gesture confusion and content will not be drawn over.
// The rest will be plain white
Box(Modifier.background(Color.White).safeContentPadding()) {
// app content
}
}
}
}
}
}