11package com.cornellappdev.score.nav
22
3- import androidx.compose.foundation.layout.fillMaxWidth
4- import androidx.compose.foundation.shape.RoundedCornerShape
53import androidx.compose.material3.Icon
64import androidx.compose.material3.NavigationBar
75import androidx.compose.material3.NavigationBarItem
86import androidx.compose.material3.NavigationBarItemDefaults
9- import androidx.compose.material3.Surface
107import androidx.compose.material3.Text
118import androidx.compose.runtime.Composable
129import androidx.compose.ui.Modifier
1310import androidx.compose.ui.graphics.Color
1411import androidx.compose.ui.res.painterResource
1512import androidx.compose.ui.tooling.preview.Preview
16- import androidx.compose.ui.unit.dp
1713import androidx.navigation.NavBackStackEntry
1814import com.cornellappdev.score.nav.root.ScoreScreens
1915import com.cornellappdev.score.nav.root.tabs
@@ -28,45 +24,38 @@ fun ScoreNavigationBar(
2824 navBackStackEntry : NavBackStackEntry ? ,
2925 modifier : Modifier = Modifier ,
3026) {
31- Surface (
32- modifier = Modifier
33- .fillMaxWidth(),
34- color = Color .White ,
35- shape = RoundedCornerShape (topStart = 12 .dp, topEnd = 12 .dp),
27+ NavigationBar (
28+ modifier = modifier,
29+ containerColor = Color .Transparent
3630 ) {
37- NavigationBar (
38- modifier = modifier,
39- containerColor = Color .Transparent
40- ) {
41- tabs.map { item ->
42- val isSelected = item.screen == navBackStackEntry?.toScreen()
31+ tabs.map { item ->
32+ val isSelected = item.screen == navBackStackEntry?.toScreen()
4333
44- NavigationBarItem (
45- selected = isSelected,
46- onClick = { navigateToScreen(item.screen) },
47- colors = NavigationBarItemDefaults .colors().copy(
48- selectedIndicatorColor = Color .Transparent
49- ),
50- icon = {
51- Icon (
52- painter = painterResource(id = if (isSelected) item.selectedIcon else item.unselectedIcon),
53- contentDescription = null ,
54- tint = Color .Unspecified
55- )
56- },
57- label = {
58- Text (
59- text = item.label,
60- style = bodyMedium,
61- color = if (isSelected) {
62- CrimsonPrimary
63- } else {
64- GrayPrimary
65- }
66- )
67- }
68- )
69- }
34+ NavigationBarItem (
35+ selected = isSelected,
36+ onClick = { navigateToScreen(item.screen) },
37+ colors = NavigationBarItemDefaults .colors().copy(
38+ selectedIndicatorColor = Color .Transparent
39+ ),
40+ icon = {
41+ Icon (
42+ painter = painterResource(id = if (isSelected) item.selectedIcon else item.unselectedIcon),
43+ contentDescription = null ,
44+ tint = Color .Unspecified
45+ )
46+ },
47+ label = {
48+ Text (
49+ text = item.label,
50+ style = bodyMedium,
51+ color = if (isSelected) {
52+ CrimsonPrimary
53+ } else {
54+ GrayPrimary
55+ }
56+ )
57+ }
58+ )
7059 }
7160 }
7261}
0 commit comments