@@ -2,7 +2,6 @@ package com.everymeal.presentation.ui.bottom
2
2
3
3
import androidx.compose.foundation.layout.fillMaxWidth
4
4
import androidx.compose.foundation.layout.height
5
- import androidx.compose.foundation.layout.padding
6
5
import androidx.compose.material3.Icon
7
6
import androidx.compose.material3.NavigationBar
8
7
import androidx.compose.material3.NavigationBarItem
@@ -14,6 +13,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
14
13
import androidx.compose.ui.res.stringResource
15
14
import androidx.compose.ui.res.vectorResource
16
15
import androidx.compose.ui.text.TextStyle
16
+ import androidx.compose.ui.tooling.preview.Preview
17
17
import androidx.compose.ui.unit.dp
18
18
import androidx.compose.ui.unit.sp
19
19
import androidx.navigation.NavDestination
@@ -23,19 +23,6 @@ import com.everymeal.presentation.ui.theme.Gray500
23
23
import com.everymeal.presentation.ui.theme.Main100
24
24
import com.everymeal.presentation.ui.theme.Paddings
25
25
26
- fun navigateBottomNavigationScreen (
27
- navController : NavHostController ,
28
- navigationItem : BottomNavigation ,
29
- ) {
30
- navController.navigate(navigationItem.route) {
31
- popUpTo(navController.graph.findStartDestination().id) {
32
- saveState = true
33
- }
34
- launchSingleTop = true
35
- restoreState = true
36
- }
37
- }
38
-
39
26
@Composable
40
27
fun EveryMealBottomNavigation (
41
28
currentDestination : NavDestination ? ,
@@ -50,10 +37,8 @@ fun EveryMealBottomNavigation(
50
37
) {
51
38
BottomNavigation .values().forEach { bottomItem ->
52
39
NavigationBarItem (
53
- modifier = Modifier .padding(8 .dp),
54
40
icon = {
55
41
Icon (
56
- modifier = Modifier .padding(4 .dp),
57
42
imageVector = ImageVector .vectorResource(bottomItem.icon),
58
43
contentDescription = bottomItem.route,
59
44
tint = if (currentDestination?.route == bottomItem.route) {
@@ -81,4 +66,26 @@ fun EveryMealBottomNavigation(
81
66
)
82
67
}
83
68
}
69
+ }
70
+
71
+ fun navigateBottomNavigationScreen (
72
+ navController : NavHostController ,
73
+ navigationItem : BottomNavigation ,
74
+ ) {
75
+ navController.navigate(navigationItem.route) {
76
+ popUpTo(navController.graph.findStartDestination().id) {
77
+ saveState = true
78
+ }
79
+ launchSingleTop = true
80
+ restoreState = true
81
+ }
82
+ }
83
+
84
+ @Preview
85
+ @Composable
86
+ fun PreviewEveryMealBottomNavigation () {
87
+ EveryMealBottomNavigation (
88
+ currentDestination = null ,
89
+ navigateToScreen = {}
90
+ )
84
91
}
0 commit comments