Created
August 29, 2024 23:52
-
-
Save alexvanyo/f450e38f6a4736c352069dd2af826703 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright 2024 Google LLC. | |
SPDX-License-Identifier: Apache-2.0 */ | |
@Composable | |
fun DebugVisibleWindowInsets( | |
modifier: Modifier = Modifier, | |
debugColor: Color = Color.Magenta.copy(alpha = 0.5f), | |
) { | |
Box(modifier = modifier.fillMaxSize()) { | |
Spacer( | |
modifier = Modifier | |
.align(Alignment.CenterStart) | |
.fillMaxHeight() | |
.windowInsetsStartWidth(WindowInsets.safeDrawing) | |
.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Vertical)) | |
.background(debugColor), | |
) | |
Spacer( | |
modifier = Modifier | |
.align(Alignment.CenterEnd) | |
.fillMaxHeight() | |
.windowInsetsEndWidth(WindowInsets.safeDrawing) | |
.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Vertical)) | |
.background(debugColor), | |
) | |
Spacer( | |
modifier = Modifier | |
.align(Alignment.TopCenter) | |
.fillMaxWidth() | |
.windowInsetsTopHeight(WindowInsets.safeDrawing) | |
.background(debugColor), | |
) | |
Spacer( | |
modifier = Modifier | |
.align(Alignment.BottomCenter) | |
.fillMaxWidth() | |
.windowInsetsBottomHeight(WindowInsets.safeDrawing) | |
.background(debugColor), | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment