https://kotlinlang.org logo
Title
m

Marcin Wisniowski

07/01/2022, 11:44 PM
What is the intended way to have the system navigation bar be the same color as the Material 3 navigation bar? I can set the system navigation bar color, but I don't know the Material 3 navigation bar color as it changes automatically with tonal color.
1
a

Adam Powell

07/02/2022, 12:10 AM
Set it to fully transparent and use insets within your content
r

RE

07/02/2022, 3:42 AM
agree with adam, this is my solution:
@Composable
fun Md3BottomNavigation(
    content: @Composable RowScope.() -> Unit
) {
    Surface(
        tonalElevation = 3.dp
    ) {
        CompositionLocalProvider(
            LocalAbsoluteTonalElevation provides LocalAbsoluteTonalElevation.current - 3.dp
        ) {
            NavigationBar(
                modifier = Modifier.navigationBarsPadding()
            ) {
                content()
            }
        }
    }
}
m

Marcin Wisniowski

07/03/2022, 4:37 PM
Thanks both, this worked nicely.
👍 1