M Saif Ullah
08/20/2024, 12:00 PMM Saif Ullah
08/20/2024, 12:01 PMval rootNavController = rememberNavController()
val currentNavBackStackEntry by rootNavController.currentBackStackEntryAsState()
val isHomeScreen = currentNavBackStackEntry?.destination?.hierarchy?.any {
it.hasRoute(NavGraphs.Home::class) ||
it.hasRoute(NavGraphs.Transactions::class) ||
it.hasRoute(NavGraphs.Category::class) ||
it.hasRoute(NavGraphs.Profile::class)
} == true
M Saif Ullah
08/20/2024, 12:01 PMfloatingActionButton = {
if (isHomeScreen) {
MainFab {
rootNavController.navigate(NavGraphs.AddExpense(it))
}
}
}
M Saif Ullah
08/20/2024, 12:06 PMAlexandru Caraus
08/21/2024, 5:48 PMAlexandru Caraus
08/21/2024, 5:49 PM