45 lines
1.5 KiB
Kotlin
45 lines
1.5 KiB
Kotlin
|
|
package com.aiosman.riderpro
|
||
|
|
|
||
|
|
import androidx.compose.foundation.layout.Column
|
||
|
|
import androidx.compose.foundation.layout.ColumnScope
|
||
|
|
import androidx.compose.foundation.layout.Spacer
|
||
|
|
import androidx.compose.foundation.layout.WindowInsets
|
||
|
|
import androidx.compose.foundation.layout.asPaddingValues
|
||
|
|
import androidx.compose.foundation.layout.height
|
||
|
|
import androidx.compose.foundation.layout.systemBars
|
||
|
|
import androidx.compose.runtime.Composable
|
||
|
|
import androidx.compose.runtime.LaunchedEffect
|
||
|
|
import androidx.compose.ui.Modifier
|
||
|
|
import androidx.compose.ui.graphics.Color
|
||
|
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||
|
|
|
||
|
|
@Composable
|
||
|
|
fun StatusBarMask(darkIcons: Boolean = true) {
|
||
|
|
val paddingValues = WindowInsets.systemBars.asPaddingValues()
|
||
|
|
val systemUiController = rememberSystemUiController()
|
||
|
|
LaunchedEffect(Unit) {
|
||
|
|
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = darkIcons)
|
||
|
|
|
||
|
|
}
|
||
|
|
Spacer(modifier = Modifier.height(paddingValues.calculateTopPadding()))
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
@Composable
|
||
|
|
fun StatusBarMaskLayout(
|
||
|
|
modifier: Modifier = Modifier,
|
||
|
|
darkIcons: Boolean = true,
|
||
|
|
content: @Composable ColumnScope.() -> Unit
|
||
|
|
) {
|
||
|
|
val paddingValues = WindowInsets.systemBars.asPaddingValues()
|
||
|
|
val systemUiController = rememberSystemUiController()
|
||
|
|
LaunchedEffect(Unit) {
|
||
|
|
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = darkIcons)
|
||
|
|
}
|
||
|
|
Column(
|
||
|
|
modifier = modifier
|
||
|
|
) {
|
||
|
|
Spacer(modifier = Modifier.height(paddingValues.calculateTopPadding()))
|
||
|
|
content()
|
||
|
|
}
|
||
|
|
}
|