|
1 | 1 | package com.ninecraft.booket.feature.main.splash |
2 | 2 |
|
| 3 | +import androidx.compose.foundation.Image |
| 4 | +import androidx.compose.foundation.background |
3 | 5 | import androidx.compose.foundation.layout.Box |
| 6 | +import androidx.compose.foundation.layout.Column |
| 7 | +import androidx.compose.foundation.layout.Spacer |
4 | 8 | import androidx.compose.foundation.layout.fillMaxSize |
| 9 | +import androidx.compose.foundation.layout.fillMaxWidth |
| 10 | +import androidx.compose.foundation.layout.height |
| 11 | +import androidx.compose.foundation.layout.width |
| 12 | +import androidx.compose.material3.Text |
5 | 13 | import androidx.compose.runtime.Composable |
| 14 | +import androidx.compose.runtime.DisposableEffect |
| 15 | +import androidx.compose.ui.Alignment |
6 | 16 | import androidx.compose.ui.Modifier |
| 17 | +import androidx.compose.ui.res.painterResource |
| 18 | +import androidx.compose.ui.res.stringResource |
| 19 | +import androidx.compose.ui.unit.dp |
| 20 | +import com.ninecraft.booket.core.designsystem.DevicePreview |
| 21 | +import com.ninecraft.booket.core.designsystem.theme.Green500 |
| 22 | +import com.ninecraft.booket.core.designsystem.theme.ReedTheme |
| 23 | +import com.ninecraft.booket.feature.main.R |
7 | 24 | import com.ninecraft.booket.feature.screens.SplashScreen |
8 | 25 | import com.slack.circuit.codegen.annotations.CircuitInject |
9 | 26 | import dagger.hilt.android.components.ActivityRetainedComponent |
| 27 | +import tech.thdev.compose.exteions.system.ui.controller.rememberSystemUiController |
10 | 28 |
|
11 | 29 | @CircuitInject(SplashScreen::class, ActivityRetainedComponent::class) |
12 | 30 | @Composable |
13 | 31 | fun SplashUi( |
14 | 32 | modifier: Modifier = Modifier, |
15 | 33 | ) { |
16 | | - Box(modifier = modifier.fillMaxSize()) |
| 34 | + val systemUiController = rememberSystemUiController() |
| 35 | + |
| 36 | + DisposableEffect(systemUiController) { |
| 37 | + systemUiController.setSystemBarsColor( |
| 38 | + color = Green500, |
| 39 | + darkIcons = false, |
| 40 | + ) |
| 41 | + |
| 42 | + onDispose {} |
| 43 | + } |
| 44 | + |
| 45 | + Box( |
| 46 | + modifier = modifier |
| 47 | + .fillMaxSize() |
| 48 | + .background(ReedTheme.colors.bgPrimary), |
| 49 | + contentAlignment = Alignment.Center, |
| 50 | + ) { |
| 51 | + Column( |
| 52 | + modifier = Modifier.fillMaxWidth(), |
| 53 | + horizontalAlignment = Alignment.CenterHorizontally, |
| 54 | + ) { |
| 55 | + Image( |
| 56 | + painter = painterResource(R.drawable.ic_reed_logo), |
| 57 | + contentDescription = "Reed Logo", |
| 58 | + modifier = Modifier.width(182.dp), |
| 59 | + ) |
| 60 | + Spacer(modifier.height(ReedTheme.spacing.spacing5)) |
| 61 | + Text( |
| 62 | + text = stringResource(R.string.splash_title), |
| 63 | + color = ReedTheme.colors.contentInverse, |
| 64 | + style = ReedTheme.typography.heading2SemiBold, |
| 65 | + ) |
| 66 | + } |
| 67 | + } |
| 68 | +} |
| 69 | + |
| 70 | +@DevicePreview |
| 71 | +@Composable |
| 72 | +private fun SplashPreview() { |
| 73 | + ReedTheme { |
| 74 | + SplashUi() |
| 75 | + } |
17 | 76 | } |
0 commit comments