Last active
May 5, 2022 07:33
-
-
Save alexstyl/2245e6138b531fe061d00b92dd6162cb to your computer and use it in GitHub Desktop.
A Composable that will keep push its content so that they are not drawn behind the system bars. This is useful for when you want to work on a layout without having to worry about insets.
This file contains hidden or 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
@Composable | |
fun SafeContent( | |
systemBarsColor: Color = Color(0xFF082A3A), | |
content: @Composable () -> Unit | |
) { | |
Box( | |
modifier = Modifier | |
.background(systemBarsColor) | |
.systemBarsPadding() | |
.background(MaterialTheme.colors.background) | |
.fillMaxSize() | |
) { | |
content() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment