@@ -14,20 +14,14 @@ import androidx.compose.material3.Scaffold
1414import androidx.compose.runtime.Composable
1515import androidx.compose.runtime.DisposableEffect
1616import androidx.compose.runtime.Stable
17- import androidx.compose.runtime.getValue
18- import androidx.compose.runtime.mutableStateOf
19- import androidx.compose.runtime.remember
20- import androidx.compose.runtime.setValue
2117import androidx.compose.ui.Modifier
2218import androidx.compose.ui.graphics.Color
2319import androidx.compose.ui.unit.dp
2420import com.google.accompanist.systemuicontroller.rememberSystemUiController
25- import st.slex.csplashscreen.core.core.Logger
2621import st.slex.csplashscreen.core.navigation.Screen
2722import st.slex.csplashscreen.ui.components.NavHostControllerHolder
2823import st.slex.csplashscreen.ui.components.NavigationHost
29- import st.slex.csplashscreen.ui.components.bottom_appbar.BottomAppBarResource
30- import st.slex.csplashscreen.ui.components.bottom_appbar.BottomAppBarResource.Companion.getByRoute
24+ import st.slex.csplashscreen.ui.components.bottom_appbar.BottomAppBarResource.Companion.isAppbar
3125import st.slex.csplashscreen.ui.components.bottom_appbar.MainBottomAppBar
3226
3327@SuppressLint(" UnusedMaterial3ScaffoldPaddingParameter" )
@@ -41,16 +35,6 @@ fun InitialApp(
4135 val systemUiController = rememberSystemUiController()
4236 val isDarkTheme = isSystemInDarkTheme()
4337
44- var currentDestination by remember {
45- mutableStateOf<Screen ?>(Screen .Home )
46- }
47-
48- navControllerHolder.navController.addOnDestinationChangedListener { _, destination, _ ->
49- Logger .d(" current route: ${destination.route} " )
50- currentDestination = destination.route?.let (::getByRoute)
51- Logger .d(" currentDestination: ${currentDestination} " )
52- }
53-
5438 DisposableEffect (systemUiController, isDarkTheme) {
5539 systemUiController.setSystemBarsColor(
5640 color = Color .Transparent ,
@@ -65,13 +49,13 @@ fun InitialApp(
6549 containerColor = MaterialTheme .colorScheme.background,
6650 bottomBar = {
6751 AnimatedVisibility (
68- visible = BottomAppBarResource . isAppbar(currentDestination ),
52+ visible = navControllerHolder.bottomBarDestination.value. isAppbar(),
6953 enter = slideInVertically(tween(300 )) { it },
7054 exit = slideOutVertically(tween(300 )) { it }
7155 ) {
7256 MainBottomAppBar (
7357 onBottomAppBarClick = onBottomAppBarClick,
74- currentDestination = currentDestination
58+ currentDestination = navControllerHolder.bottomBarDestination
7559 )
7660 }
7761 },
0 commit comments