Practical Guide to Jetpack Compose Navigation - NavArgs + Top + Bottom App Bar
Vložit
- čas přidán 1. 08. 2024
- 0:00 Scaffold
7:04 Scaffold state
11:18 Scaffold with when
18:14 Scaffold state with when
In this video I go over 4 proposed solutions to the problem of building a flexible navigation mechanism for 6 screens, 2 main ones in a bottom bar and 4 side screens accessible from the main screens.
The first solution gives each screen its own Scaffold.
The second solution gives each screen a state variable that the primary Scaffold reads from.
The third solution keeps 1 Scaffold and tries to predict what all the screens will want before they are created.
The final solution is the one I went for in my project and it's a combination of both 2 and 3, some screens mutate a scaffold state object and other screens are supplied with what they need before they are created.
GitHub repository: github.com/Odaym/EachScaffold - Věda a technologie
Been watching you for a long time, bro. Grateful for your contributions to the community!!
Well thank you for watching
Señor, thank you for this informative video. Hope to see more in depth topics example like this in the future!
Yea sure I usually post these in depth stuff when I face them in my own projects
u amazing sir
No, u amazing
Do you recommend choosing a language other than Kotlin (like Golang) for the backend of an app?
well i haven't really done any real backend work to say, but I don't see any problem with running Kotlin on the backend with Spring or something like that
What do you do if you have a login screen and a main screen with a bottom nav bar, then what do you do? Do you use multiple NavHosts?
No why would I, 1 Navhost and differentiate between routes as Master and Slave
hi, what about Preview using any of these solutions? it seems it won't be possible to get a Preview of screen content + TopBar
probably it can be resolved by creating a PreviewParameterProvider for each screen, but it looks like over engineering
@@ch1pkavarenychenko84 show how it can be done better if you can, i'm always looking for better
@@odayprogrammer I haven't found any good solution at the moment, I decided to use single top-level Scaffold in the MainActivity to display Toast or Snackbar properly by using lambda callbacks from screens; in the composable screens I'm using Column as parent where I manage all aligments "manually" (TopBar only in most cases). I like Compose very much but if compare with Flutter it's weird how many things should be done just to achieve a basic things
@@ch1pkavarenychenko84 amen