@@ -4,10 +4,10 @@ import androidx.compose.animation.animateColorAsState
44import androidx.compose.animation.core.Spring
55import androidx.compose.animation.core.spring
66import androidx.compose.foundation.background
7- import androidx.compose.foundation.clickable
87import androidx.compose.foundation.interaction.MutableInteractionSource
98import androidx.compose.foundation.layout.*
109import androidx.compose.foundation.shape.CircleShape
10+ import androidx.compose.foundation.shape.RoundedCornerShape
1111import androidx.compose.material.icons.Icons
1212import androidx.compose.material.icons.filled.*
1313import androidx.compose.material3.*
@@ -24,9 +24,6 @@ import androidx.compose.ui.unit.dp
2424import androidx.compose.ui.unit.sp
2525import com.hackeros.app.data.model.AppScreen
2626import com.hackeros.app.ui.theme.LocalAppTheme
27- import com.hackeros.app.ui.theme.mutedColor
28- import com.hackeros.app.ui.theme.primaryColor
29- import com.hackeros.app.ui.theme.textColor
3027import com.hackeros.app.utils.Translations
3128
3229data class NavItem (
@@ -39,91 +36,93 @@ data class NavItem(
3936fun HackerOSNavBar (
4037 currentScreen : AppScreen ,
4138 onScreenChange : (AppScreen ) -> Unit ,
42- translations : Translations
39+ translations : Translations
4340) {
4441 val theme = LocalAppTheme .current
42+ val bgColor = Color (theme.background)
43+ val primaryColor = Color (theme.primary)
44+ val mutedColor = Color (0xFF94A3B8 )
4545
4646 val navItems = listOf (
4747 NavItem (AppScreen .RELEASES , Icons .Default .List , translations.nav_releases),
48- NavItem (AppScreen .WALLPAPERS , Icons .Default .Image , translations.nav_wallpapers),
49- NavItem (AppScreen .GALLERY , Icons .Default .CameraAlt , translations.nav_gallery),
50- NavItem (AppScreen .TEAM , Icons .Default .Group , translations.nav_team),
51- NavItem (AppScreen .SETTINGS , Icons .Default .Settings , translations.nav_config),
48+ NavItem (AppScreen .WALLPAPERS , Icons .Default .Image , translations.nav_wallpapers),
49+ NavItem (AppScreen .GALLERY , Icons .Default .CameraAlt , translations.nav_gallery),
50+ NavItem (AppScreen .TEAM , Icons .Default .Group , translations.nav_team),
51+ NavItem (AppScreen .SETTINGS , Icons .Default .Settings , translations.nav_config),
5252 )
5353
5454 Box (
5555 modifier = Modifier
56- .fillMaxWidth()
57- .background(theme.backgroundColor() .copy(alpha = 0.92f ))
56+ .fillMaxWidth()
57+ .background(bgColor .copy(alpha = 0.92f ))
5858 ) {
59- // Top border line
60- Divider (
59+ HorizontalDivider (
6160 color = Color .White .copy(alpha = 0.05f ),
62- thickness = 1 .dp,
63- modifier = Modifier .align(Alignment .TopCenter )
61+ thickness = 1 .dp,
62+ modifier = Modifier .align(Alignment .TopCenter )
6463 )
6564
6665 NavigationBar (
6766 containerColor = Color .Transparent ,
6867 tonalElevation = 0 .dp,
6968 modifier = Modifier
70- .fillMaxWidth()
71- .navigationBarsPadding()
69+ .fillMaxWidth()
70+ .navigationBarsPadding()
7271 ) {
7372 navItems.forEach { item ->
7473 val isActive = currentScreen == item.screen
7574 val iconColor by animateColorAsState(
76- targetValue = if (isActive) theme. primaryColor() else theme. mutedColor() ,
77- animationSpec = spring(stiffness = Spring .StiffnessMedium ),
78- label = " iconColor"
75+ targetValue = if (isActive) primaryColor else mutedColor,
76+ animationSpec = spring(stiffness = Spring .StiffnessMedium ),
77+ label = " iconColor"
7978 )
8079
8180 NavigationBarItem (
8281 selected = isActive,
8382 onClick = { onScreenChange(item.screen) },
84- icon = {
85- Column (horizontalAlignment = Alignment .CenterHorizontally ) {
86- Box (
87- modifier = Modifier
88- .clip(androidx.compose.foundation.shape. RoundedCornerShape (12 .dp))
89- .background(
90- if (isActive) theme. primaryColor() .copy(alpha = 0.15f )
91- else Color .Transparent
92- )
93- .padding(horizontal = 12 .dp, vertical = 4 .dp)
94- ) {
95- Icon (
96- imageVector = item.icon,
97- contentDescription = item.label,
98- tint = iconColor,
99- modifier = Modifier .size(20 .dp)
100- )
101- }
102- if (isActive) {
103- Spacer (modifier = Modifier .height(2 .dp))
104- Box (
105- modifier = Modifier
106- .size(4 .dp)
107- .clip(CircleShape )
108- .background(theme. primaryColor() )
109- )
110- }
111- }
112- },
113- label = {
114- Text (
115- text = item.label.uppercase(),
116- fontSize = 9 .sp,
117- fontWeight = FontWeight .Bold ,
118- color = if (isActive) theme. primaryColor() else theme. mutedColor() .copy(alpha = 0.6f ),
119- letterSpacing = 0.5 .sp,
120- maxLines = 1
121- )
122- },
123- colors = NavigationBarItemDefaults .colors(
124- indicatorColor = Color .Transparent
125- ),
126- interactionSource = remember { MutableInteractionSource () }
83+ icon = {
84+ Column (horizontalAlignment = Alignment .CenterHorizontally ) {
85+ Box (
86+ modifier = Modifier
87+ .clip(RoundedCornerShape (12 .dp))
88+ .background(
89+ if (isActive) primaryColor.copy(alpha = 0.15f )
90+ else Color .Transparent
91+ )
92+ .padding(horizontal = 12 .dp, vertical = 4 .dp)
93+ ) {
94+ Icon (
95+ imageVector = item.icon,
96+ contentDescription = item.label,
97+ tint = iconColor,
98+ modifier = Modifier .size(20 .dp)
99+ )
100+ }
101+ if (isActive) {
102+ Spacer (modifier = Modifier .height(2 .dp))
103+ Box (
104+ modifier = Modifier
105+ .size(4 .dp)
106+ .clip(CircleShape )
107+ .background(primaryColor)
108+ )
109+ }
110+ }
111+ },
112+ label = {
113+ Text (
114+ text = item.label.uppercase(),
115+ fontSize = 9 .sp,
116+ fontWeight = FontWeight .Bold ,
117+ color = if (isActive) primaryColor else mutedColor.copy(alpha = 0.6f ),
118+ letterSpacing = 0.5 .sp,
119+ maxLines = 1
120+ )
121+ },
122+ colors = NavigationBarItemDefaults .colors(
123+ indicatorColor = Color .Transparent
124+ ),
125+ interactionSource = remember { MutableInteractionSource () }
127126 )
128127 }
129128 }
0 commit comments