Practical Guide to Jetpack Compose Navigation - NavArgs + Top + Bottom App Bar

Sdílet
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

Komentáře • 15

  • @bhaveshchimnani4046
    @bhaveshchimnani4046 Před 7 měsíci +3

    Been watching you for a long time, bro. Grateful for your contributions to the community!!

  • @pavelcistjakov243
    @pavelcistjakov243 Před 6 měsíci +3

    Señor, thank you for this informative video. Hope to see more in depth topics example like this in the future!

    • @odayprogrammer
      @odayprogrammer  Před 6 měsíci

      Yea sure I usually post these in depth stuff when I face them in my own projects

  • @ARivanw
    @ARivanw Před 24 dny

    u amazing sir

  • @welovfree
    @welovfree Před 7 měsíci +4

    ​Do you recommend choosing a language other than Kotlin (like Golang) for the backend of an app?

    • @odayprogrammer
      @odayprogrammer  Před 7 měsíci +3

      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

  • @stevensilitonga
    @stevensilitonga Před 3 měsíci +1

    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?

    • @odayprogrammer
      @odayprogrammer  Před 3 měsíci

      No why would I, 1 Navhost and differentiate between routes as Master and Slave

  • @ch1pkavarenychenko84
    @ch1pkavarenychenko84 Před 7 měsíci

    hi, what about Preview using any of these solutions? it seems it won't be possible to get a Preview of screen content + TopBar

    • @ch1pkavarenychenko84
      @ch1pkavarenychenko84 Před 7 měsíci

      probably it can be resolved by creating a PreviewParameterProvider for each screen, but it looks like over engineering

    • @odayprogrammer
      @odayprogrammer  Před 7 měsíci

      @@ch1pkavarenychenko84 show how it can be done better if you can, i'm always looking for better

    • @ch1pkavarenychenko84
      @ch1pkavarenychenko84 Před 6 měsíci

      @@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

    • @odayprogrammer
      @odayprogrammer  Před 6 měsíci

      @@ch1pkavarenychenko84 amen