Sets the height to that of [insets] at the [top][WindowInsets.
insetsTopHeightSample
fun insetsTopHeightSample() {
class SampleActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
setContent {
Box(Modifier.fillMaxSize()) {
// Background for status bar at the top
Box(
Modifier.windowInsetsTopHeight(WindowInsets.statusBars)
.fillMaxWidth()
.align(Alignment.TopCenter)
.background(Color.Red)
)
// app content
}
}
}
}
}