Skip to content

๐Ÿ”€ :: (#71) bottom nav compose#72

Open
100Seung-Min wants to merge 4 commits intodevelopfrom
feature/71_bottom_nav_compose
Open

๐Ÿ”€ :: (#71) bottom nav compose#72
100Seung-Min wants to merge 4 commits intodevelopfrom
feature/71_bottom_nav_compose

Conversation

@100Seung-Min
Copy link
Copy Markdown
Member

์ž‘์—…๋‚ด์šฉ

  • ๋ฐ”ํ…€ ๋„ค๋น„๊ฒŒ์ด์…˜์„ ์ปดํฌ์ฆˆUI๋กœ ๋ฐ”๊ฟ”์„œ ์ ์šฉ

์ฃผ์š” ํŒŒ์ผ

MainActivity

  • Navigation
    @Composable
    fun Navigation(navController: NavHostController) {
    NavHost(navController = navController, startDestination = NavDestination.BottomNav.HOME) {
    composable(route = NavDestination.BottomNav.HOME) {
    HomeScreen()
    }
    composable(route = NavDestination.BottomNav.BOARD) {
    BoardScreen()
    }
    composable(route = NavDestination.BottomNav.NOTIFICATION) {
    NotificationScreen()
    }
    composable(route = NavDestination.BottomNav.PROFILE) {
    ProfileScreen()
    }
    }
    }
  • BottomNavigationBar
    @OptIn(ExperimentalMaterialApi::class)
    @Composable
    fun BottomNavigationBar(
    itemList: List<BottomNavItem>,
    navController: NavHostController,
    modifier: Modifier,
    onItemClick: (BottomNavItem) -> Unit
    ) {
    val backStackEntry = navController.currentBackStackEntryAsState()
    BottomNavigation(
    modifier = modifier,
    backgroundColor = Color.White
    ) {
    itemList.forEach{ item ->
    val selected = item.route == backStackEntry.value?.destination?.route
    BottomNavigationItem(
    selected = selected,
    onClick = { onItemClick(item) },
    selectedContentColor = Blue,
    unselectedContentColor = Gray500,
    icon = {
    Icon(
    painter = painterResource(id = item.icon),
    contentDescription = item.route,
    modifier = Modifier.height(20.dp)
    )
    }
    )
    }
    }

ํ™”๋ฉด

image

@100Seung-Min 100Seung-Min added the ๊ธฐ๋Šฅ ์ถ”๊ฐ€ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ์š”์ฒญ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. label Aug 12, 2022
@100Seung-Min 100Seung-Min self-assigned this Aug 12, 2022
Copy link
Copy Markdown
Contributor

@leehyeonbin leehyeonbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

๊ธฐ๋Šฅ ์ถ”๊ฐ€ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ์š”์ฒญ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

๋ฐ”ํ…€ ๋„ค๋น„๊ฒŒ์ด์…˜ ์ปดํฌ์ฆˆ UI

2 participants