Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Theme: Set navigation bar color same as bottom navigation bar
Browse files Browse the repository at this point in the history
Signed-off-by: Aayush Gupta <[email protected]>
  • Loading branch information
theimpulson committed Aug 19, 2023
1 parent a50c1fb commit e37ff08
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/main/java/io/aayush/relabs/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ package io.aayush.relabs.ui.theme
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBarDefaults
import androidx.compose.material3.Typography
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.platform.LocalContext
Expand All @@ -33,6 +35,15 @@ fun ReLabsTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable
val systemUiController = rememberSystemUiController()
LaunchedEffect(key1 = Unit) {
systemUiController.setSystemBarsColor(colors.background, darkIcons = !darkTheme)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
val navigationBarElevation = NavigationBarDefaults.Elevation
systemUiController.setNavigationBarColor(
color = colors.surfaceColorAtElevation(
navigationBarElevation
), !darkTheme
)
}
}

MaterialTheme(colorScheme = colors, typography = Typography(), content = content)
Expand Down

0 comments on commit e37ff08

Please sign in to comment.