Skip to content

Commit

Permalink
fix: Bottom Navigation Width
Browse files Browse the repository at this point in the history
  • Loading branch information
8954sood committed Nov 6, 2024
1 parent e89604e commit ff4bc94
Showing 1 changed file with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -64,58 +65,69 @@ fun SeugiBottomNavigation(modifier: Modifier = Modifier, selected: BottomNavigat
.fillMaxHeight(),
verticalAlignment = Alignment.CenterVertically,
) {
Spacer(modifier = Modifier.width(32.dp))
Spacer(
modifier = Modifier.width(16.dp)
)
SeugiBottomNavigationItem(
modifier = Modifier.weight(1f),
type = BottomNavigationItemType.Home,
selected = selected is BottomNavigationItemType.Home,
isNew = false,
onClick = {
onClick(BottomNavigationItemType.Home)
},
)
Spacer(modifier = Modifier.weight(1f))
SeugiBottomNavigationItem(
modifier = Modifier.weight(1f),
type = BottomNavigationItemType.Chat,
selected = selected is BottomNavigationItemType.Chat,
isNew = false,
onClick = {
onClick(BottomNavigationItemType.Chat)
},
)
Spacer(modifier = Modifier.weight(1f))
SeugiBottomNavigationItem(
modifier = Modifier.weight(1f),
type = BottomNavigationItemType.Group,
selected = selected is BottomNavigationItemType.Group,
isNew = false,
onClick = {
onClick(BottomNavigationItemType.Group)
},
)
Spacer(modifier = Modifier.weight(1f))
SeugiBottomNavigationItem(
modifier = Modifier.weight(1f),
type = BottomNavigationItemType.Notification,
selected = selected is BottomNavigationItemType.Notification,
isNew = false,
onClick = {
onClick(BottomNavigationItemType.Notification)
},
)
Spacer(modifier = Modifier.weight(1f))
SeugiBottomNavigationItem(
modifier = Modifier.weight(1f),
type = BottomNavigationItemType.Profile,
selected = selected is BottomNavigationItemType.Profile,
isNew = false,
onClick = {
onClick(BottomNavigationItemType.Profile)
},
)
Spacer(modifier = Modifier.width(32.dp))
Spacer(
modifier = Modifier.width(16.dp)
)
}
}
}

@Composable
private fun SeugiBottomNavigationItem(type: BottomNavigationItemType, selected: Boolean, isNew: Boolean, onClick: () -> Unit) {
private fun SeugiBottomNavigationItem(
modifier: Modifier = Modifier,
type: BottomNavigationItemType,
selected: Boolean,
isNew: Boolean,
onClick: () -> Unit
) {
val animIconColor by animateColorAsState(
targetValue = if (selected) SeugiTheme.colors.primary500 else SeugiTheme.colors.gray300,
label = "",
Expand All @@ -126,8 +138,7 @@ private fun SeugiBottomNavigationItem(type: BottomNavigationItemType, selected:
)

Column(
modifier = Modifier
.width(32.dp)
modifier = modifier
.clickable(
onClick = onClick,
interactionSource = remember { MutableInteractionSource() },
Expand Down

0 comments on commit ff4bc94

Please sign in to comment.