insetsx
insetsx copied to clipboard
SystemBarsBehavior.Immersive not working on IOS
@OptIn(ExperimentalResourceApi::class)
@Composable
fun App() {
AppTheme {
var showContent by remember { mutableStateOf(false) }
val greeting = remember { Greeting().greet() }
SplashScreen()
}
}
@OptIn(ExperimentalResourceApi::class)
@Composable
fun SplashScreen(modifier: Modifier = Modifier) {
val windowInsetsController = rememberWindowInsetsController()
LaunchedEffect(Unit) {
// Hide the status bars
windowInsetsController?.setIsStatusBarsVisible(false)
// Hide the navigation bars
windowInsetsController?.setIsNavigationBarsVisible(false)
// Change an options for behavior when system bars are hidden
windowInsetsController?.setSystemBarsBehavior(SystemBarsBehavior.Immersive)
}
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Transparent)
) {
Image(
painterResource("images/splash.jpg"),
contentDescription = "image description",
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.FillBounds
)
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(0x8CFE6927)) // Add the color overlay
)
Scaffold(
modifier = modifier.fillMaxSize(),
backgroundColor = Color.Transparent,
) {
Box(
modifier = modifier.fillMaxSize(),
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = modifier.fillMaxSize()
) {
Row(
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
Image(
painterResource("images/logo.png"),
contentDescription = "logo",
modifier = modifier.width(44.dp).height(40.dp),
contentScale = ContentScale.Fit
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = "House of ROU",
style = TextStyle(
fontSize = 26.sp,
fontWeight = FontWeight(900),
color = Color(0xFFFFFFFF)
)
)
}
Spacer(modifier = Modifier.height(24.dp))
Text(
text = "Peace and Trust",
style = TextStyle(
fontSize = 31.sp,
lineHeight = 40.sp,
// fontFamily = FontFamily(Font(R.font.satoshi)),
fontWeight = FontWeight(700),
color = Color(0xFFFFFFFF),
textAlign = TextAlign.Center,
)
)
Spacer(modifier = Modifier.height(8.dp))
Text(
modifier = modifier.width(343.dp),
text = "It’s easier to manage your home with an account",
style = TextStyle(
fontSize = 16.sp,
lineHeight = 24.sp,
// fontFamily = FontFamily(Font(R.font.satoshi)),
fontWeight = FontWeight(500),
color = Color(0xFFFFFFFF),
textAlign = TextAlign.Center,
letterSpacing = 0.5.sp,
)
)
}
}
}
}
}
import com.moriatsushi.insetsx.WindowInsetsUIViewController
fun MainViewController() = WindowInsetsUIViewController { App() }
result
android
ios