HI, I want to know how to use seperate View models for seperate Graphs , for this function i want to create instance of view model which is only known to composables inside this function but not able to do so because appGraph is a non composable function . fun NavGraphBuilder.appGraph(navController: NavController){ Question : how to create instance of viewmodel in nested graph of compose navigation
I like the way you chose to explane it all. Only essential things but in xml-ed layout navigation view as i remember there was like a tray and were tabs with color shaded on related screen. Your navigation doesnt look similar to that tray . Im looking for that tray with tabs. Because its handy while handling the app by a thumb only. Without reaching out to inconvinient parts of screen. For better user expirience and such things
Thanks for your feedback! I appreciate your focus on user experience. 😊 In Jetpack Compose, if you’re looking for a navigation style that resembles a tray with tabs at the bottom, you can achieve that using a BottomNavigation component. This allows users to easily navigate through different sections of your app without reaching for the top of the screen, which is especially handy for one-handed use. Here’s a simple example of how you can implement a bottom navigation tray with tabs: kotlin Copy code BottomNavigation { BottomNavigationItem( icon = { Icon(Icons.Filled.Home, contentDescription = "Home") }, label = { Text("Home") }, selected = false, // Manage selected state here onClick = { /* Navigate to Home */ } ) BottomNavigationItem( icon = { Icon(Icons.Filled.Favorite, contentDescription = "Favorites") }, label = { Text("Favorites") }, selected = false, // Manage selected state here onClick = { /* Navigate to Favorites */ } ) // Add more items as needed } You can customize the colors and appearance to match your app's theme, ensuring a consistent look and feel. This approach is designed for better accessibility and a more convenient user experience.
That's a good approach. Perhaps do you know how to restore the screen from 1-nested navigation graph, if we navigate in 2-navigation graph and roll back?
how do i do it if i have 2 set of UI screeens for different users ? i have a radio button that lets users choose their user types how can i connect it to the nav?
Mohsen Hocam ben uygulamayı yaptım,sorun görünmüyor ama emulatörde göremiyorum.Emulatörde boş sayfa var.Program hata da vermiyor.Emulatorü kaldırıp yeniden yükledim,programı kapatıp açtım olmadı.Ne yapmam gerekiyor. Teacher Mohsen, I made the application, the problem does not appear, but I cannot see it in the emulator. There is a blank page in the emulator. The program does not give any errors. I uninstalled the emulator and reinstalled it, closed and opened the program, but it did not work. What should I do?
If you have any requests about the tutorials that you want to see, just leave a comment below! Thanks for watching :)
HI, I want to know how to use seperate View models for seperate Graphs , for this function i want to create instance of view model which is only known to composables inside this function but not able to do so because appGraph is a non composable function . fun NavGraphBuilder.appGraph(navController: NavController){
Question : how to create instance of viewmodel in nested graph of compose navigation
This was much more helpful than the docs
Super Thank you, i was searching this video from 2 week, thanks a lot, You are a valuable content creator on RUclips.
Thanls you man! Your vidoes are pretty entertatining and informative at the same time! Please continue!
Nice to hear that. Please subscribe for more and share the content with your friends.
You explain very clearly what you are doing thanks and keep it up
Sub for more
Really nice content and quite simple to understand. Thanks!!
Welcome. Sub for more
I love you, I almost died on this one, you're the GOAT,
thank you
I like the way you chose to explane it all. Only essential things but in xml-ed layout navigation view as i remember there was like a tray and were tabs with color shaded on related screen. Your navigation doesnt look similar to that tray . Im looking for that tray with tabs. Because its handy while handling the app by a thumb only. Without reaching out to inconvinient parts of screen. For better user expirience and such things
Thanks for your feedback! I appreciate your focus on user experience. 😊
In Jetpack Compose, if you’re looking for a navigation style that resembles a tray with tabs at the bottom, you can achieve that using a BottomNavigation component. This allows users to easily navigate through different sections of your app without reaching for the top of the screen, which is especially handy for one-handed use.
Here’s a simple example of how you can implement a bottom navigation tray with tabs:
kotlin
Copy code
BottomNavigation {
BottomNavigationItem(
icon = { Icon(Icons.Filled.Home, contentDescription = "Home") },
label = { Text("Home") },
selected = false, // Manage selected state here
onClick = { /* Navigate to Home */ }
)
BottomNavigationItem(
icon = { Icon(Icons.Filled.Favorite, contentDescription = "Favorites") },
label = { Text("Favorites") },
selected = false, // Manage selected state here
onClick = { /* Navigate to Favorites */ }
)
// Add more items as needed
}
You can customize the colors and appearance to match your app's theme, ensuring a consistent look and feel. This approach is designed for better accessibility and a more convenient user experience.
Thanks a lot. I get every thing now. You sometimes forget to zoom your code editor for us.
Sorry I will consider it.
Çok güzel,çok şey öğrendim.
Very nice, I learned a lot.
nice, thank you so much
Thank you for video
It's really helpful
That's a good approach. Perhaps do you know how to restore the screen from 1-nested navigation graph, if we navigate in 2-navigation graph and roll back?
You can simply call any screen you want and after finishing the process pop the screen out of the backstack.
amazing video
How we can share viewmodel instance between different screens in this nested navigation?
I will make a video about it very soon
Why your video quality options was not there in your video ?
can we add fragment and composables inside single navigation graph
Yes you can
@@MohsenMashkour small suggestion or hint how to implement.. please!
sir where is the source code of this video, in the link you put the source code of previous video
sorry the link was wrong but now the correct one is in the description.
how do i do it if i have 2 set of UI screeens for different users ? i have a radio button that lets users choose their user types how can i connect it to the nav?
Just use conditional statements
can u give me a explain why u have create this ?
sealed class Screens(val route: String){
object ScreenLoginRoute : Screens(route = "Login")
object ScreenForgetPassRoute : Screens(route = "ForgetPass")
object ScreenRegisterRoute : Screens(route = "Register")
object ScreenHomeRoute : Screens(route = "Home")
object ScreenBRoute : Screens(route = "B")
object ScreenARoute : Screens(route = "A")
object AuthRoute : Screens(route = "Auth")
object AppRoute : Screens(route = "App")
}
what's its purpose or advantage , or use cases ??
its like a repository to keep the routes. in order to prevent writing hardcode.
How can we go back to LoginSreen from Either HomeScreen or ScreenA [suppose we want to implement logout]
Use the same code that you used tocome from log in to home
Hello how to hide bottom app bar while navigating inside screens
Use the navigation outside of the Scaffold.
@@MohsenMashkour thank you so much .. I will try it once
Mohsen Hocam ben uygulamayı yaptım,sorun görünmüyor ama emulatörde göremiyorum.Emulatörde boş sayfa var.Program hata da vermiyor.Emulatorü kaldırıp yeniden yükledim,programı kapatıp açtım olmadı.Ne yapmam gerekiyor.
Teacher Mohsen, I made the application, the problem does not appear, but I cannot see it in the emulator. There is a blank page in the emulator. The program does not give any errors. I uninstalled the emulator and reinstalled it, closed and opened the program, but it did not work. What should I do?
Probably you did not call the main screen. Check your graph again and set the first destination.
Teşekkürler.Yaptım.
Thanks. I did it.