Skip to content

Commit a10a690

Browse files
authored
Merge pull request #56 from Nexters/fix/status-bar-in-dark-mode
다크모드일 때 statusbar 보이도록 수정합니다.
2 parents c35418c + 041628c commit a10a690

File tree

1 file changed

+13
-0
lines changed
  • feature/main/src/main/java/com/plottwist/feature/main/ui/theme

1 file changed

+13
-0
lines changed

feature/main/src/main/java/com/plottwist/feature/main/ui/theme/Theme.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
package com.plottwist.feature.main.ui.theme
22

33
import android.os.Build
4+
import androidx.activity.ComponentActivity
45
import androidx.compose.foundation.isSystemInDarkTheme
56
import androidx.compose.material3.MaterialTheme
67
import androidx.compose.material3.darkColorScheme
78
import androidx.compose.material3.dynamicDarkColorScheme
89
import androidx.compose.material3.dynamicLightColorScheme
910
import androidx.compose.material3.lightColorScheme
1011
import androidx.compose.runtime.Composable
12+
import androidx.compose.runtime.SideEffect
13+
import androidx.compose.ui.input.nestedscroll.NestedScrollSource.Companion.SideEffect
1114
import androidx.compose.ui.platform.LocalContext
15+
import androidx.compose.ui.platform.LocalView
16+
import androidx.core.view.WindowCompat
1217

1318
private val DarkColorScheme = darkColorScheme(
1419
primary = Purple80,
@@ -39,6 +44,7 @@ fun TukTheme(
3944
dynamicColor: Boolean = true,
4045
content: @Composable () -> Unit
4146
) {
47+
val view = LocalView.current
4248
val colorScheme = when {
4349
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
4450
val context = LocalContext.current
@@ -49,6 +55,13 @@ fun TukTheme(
4955
else -> LightColorScheme
5056
}
5157

58+
SideEffect {
59+
val window = (view.context as ComponentActivity).window
60+
61+
WindowCompat.getInsetsController(window, window.decorView)
62+
.isAppearanceLightStatusBars = true
63+
}
64+
5265
MaterialTheme(
5366
colorScheme = colorScheme,
5467
content = content

0 commit comments

Comments
 (0)