Flutter Bottom Navigation with Nested Routing (Auto Route)

Поделиться
HTML-код
  • Опубликовано: 9 сен 2024
  • 📗 Learn from the written tutorial & get the code 👇👇
    resocoder.com/...
    📧 Get Flutter news 📰 and resources:
    👉 flutter.education
    👨‍💻 Do you write good code? Find out now!
    resocoder.com/...
    Routing in Flutter is a vast topic as it can be executed in many different ways. Having a logical and simple to navigate routing setup will directly translate into a better user experience. It will also make the code a lot more maintainable for the developers.
    Configuring routing in Flutter, specifically with Navigator 2.0 can be very tedious and time consuming. This is where AutoRoute comes in with its intuitive API and handy code generation that will save you lots of time and effort.
    In this lesson you’ll learn how to leverage the simplicity of the AutoRoute and Salomon Bottom Bar packages to create an elegant bottom navigation bar configured with nested routing.
    Go to my website for more information, code examples, and articles:
    ● resocoder.com
    Follow me on social media:
    ● / resocoder
    ● / resocoder
    ● / resocoder

Комментарии • 94

  • @aridwiprayogo
    @aridwiprayogo 3 года назад +24

    Hello welcome to reso coder we're going to prepare for real app development 😌

  • @VictorKun
    @VictorKun 3 года назад +41

    The nested navigation had always been a serious problem with conflicts arising between Flutter Devs and designers until now.
    A correction at 24:28 :
    final _appRouter = AppRouter(); should be outside the build method, else it'll reset the app's router by creating a new instance of router on each hot reload and devs will have no clue as to why the app's route is getting reset to the initial route.

    • @alizevia5247
      @alizevia5247 2 года назад +3

      final _appRouter = AppRouter(); should be outside the build method

    • @rajatkhoware2364
      @rajatkhoware2364 Год назад

      Can Someone help me !! My doubt is that when we click on post the post page pop up with bottom navigation bar that's perfectly okzy but i want that when we click on user1 i want to display user1 page only without bottom bar how can we do that anyone want to test there knowledge please drop a solution ..

    • @franciscojavier8968
      @franciscojavier8968 Год назад

      @@rajatkhoware2364 open that one in a new page using simple navigation and that is it

  • @h3w45
    @h3w45 4 месяца назад +1

    Flutter community needs you please come back

  • @marcosfons
    @marcosfons 3 года назад +18

    At 24:10 it is said that the router must be created inside the build method. But in the docs, in "Finalize the setup" section, they specifically indicate that the router must be placed outside the build method

    • @4RickB
      @4RickB 2 года назад +2

      Very good catch! This issue also was preventing hot-reload from working.

    • @rajatkhoware2364
      @rajatkhoware2364 Год назад

      Can Someone help me !! My doubt is that when we click on post the post page pop up with bottom navigation bar that's perfectly okzy but i want that when we click on user1 i want to display user1 page only without bottom bar how can we do that anyone want to test there knowledge please drop a solution ..

  • @AlamgirTamboli
    @AlamgirTamboli 3 года назад +12

    Good tutorial. there's an error though:
    final _appRouter = AppRouter();
    That code should be OUTSIDE the build method. If it's inside I think hot reload gets screwy

    • @albanr8028
      @albanr8028 2 года назад

      Thank you very much !

    • @kimiyazargari6216
      @kimiyazargari6216 2 года назад

      Thanks

    • @rajatkhoware2364
      @rajatkhoware2364 Год назад

      Can Someone help me !! My doubt is that when we click on post the post page pop up with bottom navigation bar that's perfectly okzy but i want that when we click on user1 i want to display user1 page only without bottom bar how can we do that anyone want to test there knowledge please drop a solution ..

  • @AbdolHussain
    @AbdolHussain 2 года назад

    This is the video I wanted to learn from the days.

  • @amandacleto8396
    @amandacleto8396 2 года назад +2

    Is there a way to not 'blink' the screen while I change the routes?? (In the video example, the 'blink' color is indigo, I tried to change it into 'transparent', but the 'blink' turns into black) 😢

  • @oguzhantopal8167
    @oguzhantopal8167 2 года назад

    One of the best flutter channel

  • @gergelygorcs8345
    @gergelygorcs8345 2 года назад +7

    To be able to use it with the most recent flutter versions, you have to update auto_router v3.2.0 and auto_router_generate v3.2.0. Older versions has some conflicts with new flutter SDK. And then you will get some errors while running build_runner. The solution is to delete the pubspec.yaml.lock file and run pub get again.

    • @mic1976
      @mic1976 2 года назад +1

      Thank yo so much for this comment. Saved me some googling :)

    • @rajatkhoware2364
      @rajatkhoware2364 Год назад

      Can Someone help me !! My doubt is that when we click on post the post page pop up with bottom navigation bar that's perfectly okzy but i want that when we click on user1 i want to display user1 page only without bottom bar how can we do that anyone want to test there knowledge please drop a solution ..

  • @ta11p00
    @ta11p00 3 года назад +6

    Might have been better giving an overview diagram of autoroute structures rather than diving straight into code, you could then refer back to it to make it clear. Some people can work with a detail up approach but some prefer an overview and the demo app intro needs a link between that, the structure you're going to implement to achieve it and the code. Just a suggestion 👍

    • @rajatkhoware2364
      @rajatkhoware2364 Год назад

      Can Someone help me !! My doubt is that when we click on post the post page pop up with bottom navigation bar that's perfectly okzy but i want that when we click on user1 i want to display user1 page only without bottom bar how can we do that anyone want to test there knowledge please drop a solution ..

  • @wiaamkareem6186
    @wiaamkareem6186 2 года назад

    exatly at the time when i needed it ,thanks alot

  • @KameleonKraft
    @KameleonKraft 2 года назад

    Thank you so much for this tutorial, I took advantage of the infos a lot :-)

  • @billmellis7796
    @billmellis7796 3 года назад

    Been needing this for a long time. Thank you !

  • @wilyantoliang2273
    @wilyantoliang2273 2 года назад +1

    Nice tutorial, but how to navigate to a literally new page? (I don't want my bottom navbar still showed when I navigated to other screen). Following the current tutorial made the navigation bar stay still at the bottom with its current page state :(

  • @numancalik9370
    @numancalik9370 Год назад

    Thanks :) I wonder where i need to put "BlocProvider" widget and can i access global bloc from nested route child to write "context.read()"

  • @ThEGeEeK
    @ThEGeEeK 3 года назад +1

    Gold content as always.

  • @oleksii_shtanko
    @oleksii_shtanko 3 года назад

    Thank you! Very Helpful tutorial

  • @DavidHust
    @DavidHust 2 года назад

    Beautifully done! Thank you.

  • @unalkoseoglu2859
    @unalkoseoglu2859 Год назад

    Thanks so much!..

  • @bugracakirr
    @bugracakirr 2 года назад

    Perfect and clear explanation with supported scenarios. Thank you.

  • @mindblower113
    @mindblower113 Год назад

    Can I make this with native flutter? I don't want to use auto route

  • @funnnul5529
    @funnnul5529 3 года назад +1

    Bro how to make transparent and blur bottom navigation bar ??
    I think, backdrop filter Is it right

  • @MajesticNut
    @MajesticNut 2 года назад

    And what about performance issues? Switching from tab to tab and keeping all the pages alive will affect the performance of the app. Am I wrong?

  • @haroldpepete
    @haroldpepete 3 года назад

    good job, i really appreciate it all your effort to make videos so details

  • @yakupbaser6423
    @yakupbaser6423 2 года назад

    There are some nested bottom tab route. Some tabs needs authenticate and some tabs dont need. So how can i add adguard to nested bottom tabs? (I can add adguard to main routes, thats ok but i couldnt navigate to nested bottom tab route which needs auth.)

  • @koolam5158
    @koolam5158 2 года назад

    Big Thanks to you🙏🙏

  • @ashishmulani4371
    @ashishmulani4371 2 года назад

    I need a help on this
    can I do the screen init again when I tap on the bottom bar again like another bottom bar?

  • @MattFacer
    @MattFacer Год назад

    This has really helped - thank you. I'm trying to change the title of the appbar, based on the route you're currently looking at. Is there a way to access and change the title from within one of the pushed pages? for example, when viewing the post or a user profile?

  • @ahmedelshafeymohamedelshaf3607

    How to add some screen like login screen in routes before bottom bar screen ?

  • @user-yb6tz2vl6f
    @user-yb6tz2vl6f 7 месяцев назад

    what are the prerequisites for learning this?

  • @enafor99
    @enafor99 3 года назад

    Great Tutorial , thanks so much

  • @mohamdjamal6266
    @mohamdjamal6266 2 года назад

    Hi when we need nested navigation, so i case i develop Ecommerce for web and bobile?

  • @markdioneeb8997
    @markdioneeb8997 2 года назад

    I'm using Provider and wraps it on my routes but since I'm gonna need to restructure it for AutoRoute, will it affect the entire thing?

  • @medsed1133
    @medsed1133 3 года назад

    How would you go about replicating the youtubr bottom nav behavior whereby you go back to the previous tab when you click on android back button .. like a navigation history is being saved somehow..

  • @senpai3274
    @senpai3274 3 года назад

    thanks for this video tutorial

  • @RidzCreations
    @RidzCreations 2 года назад

    😍Nice Tutorial Keep it Up...

  • @tieule363
    @tieule363 Год назад

    EmptyRoute now is no a part of Auto route. How can I handle nested route like your ?

    • @rejie
      @rejie Год назад

      restarting the IDE should fix EmptyRoutePage missing issue

  • @mqhamdam
    @mqhamdam 2 года назад

    So its only 2 level nested pages. What about dynamic? from post to user and then from user to post then to comment section

  • @rajatkhoware2364
    @rajatkhoware2364 Год назад

    Can Someone help me !! My doubt is that when we click on post the post page pop up with bottom navigation bar that's perfectly okzy but i want that when we click on user1 i want to display user1 page only without bottom bar how can we do that anyone want to test there knowledge please drop a solution ..

  • @brokercl
    @brokercl 2 года назад

    grrreaaattt tutorial, thanks

  • @coderlama2841
    @coderlama2841 2 года назад

    Amazing!!! Thank you

  • @wawrzyn3059
    @wawrzyn3059 2 года назад

    you saved me :)

  • @NouraddinKhalil
    @NouraddinKhalil 2 года назад

    Great video
    But I have a question when having nested routes the RouteGuard does not work?
    Can you please make a video about RouteGuard it'll be great

  • @althafaralijaffarali1803
    @althafaralijaffarali1803 3 года назад

    Could you please make a video on how to cache images and manage it in order to reduce the read count from the database. Thank you!

  • @karljosh16
    @karljosh16 2 года назад

    how would i do it if i want to pass constructor that is not a string

  • @AnthonyCuervoR
    @AnthonyCuervoR 2 года назад

    what happen if my first screens are login and onboarding and then home screen with the bottom nav bar? .. btw amazing tutorial thanks1

  • @h3w45
    @h3w45 3 года назад

    Thank you

  • @samueladeosun6763
    @samueladeosun6763 2 года назад

    great video i must say. please how do how i build the widget if i click the bottom navigation icon. everytime i click an icon, it always return a static page.

  • @KamranKhan-jg1md
    @KamranKhan-jg1md 3 года назад

    Nice Video please make a video on GetX Flutter

  • @tananga1523
    @tananga1523 2 года назад +1

    Great video. Can you also show it on flutter web? Or better... on both

    • @andreisas1621
      @andreisas1621 Год назад

      Most probably already works on web, u just have to run it on the web emulator/chrome

  • @medsed1133
    @medsed1133 3 года назад +2

    HI and thank you for the tutorial , I have two questions , how can we customize the appBar for the nested routes to be completely different and independent from the main one ?
    Can the auto route hold the navigation stack history so we can add a feature that enables going back to the previous tab on device back button press ?
    Keep up the quality content :)

    • @RunAman
      @RunAman 3 года назад

      You can make any appBar widget, make sure the parent is PPreferredSize widget. You can make any child widget of PreferredSize

    • @medsed1133
      @medsed1133 3 года назад

      @@RunAman you would have to do some state management to show a custom appBar according to the new nested route arguments for example page1/page2.

    • @RunAman
      @RunAman 3 года назад

      You can use state management that widget, like you can customise it like you want it. Though it's not necessary.

    • @rajatkhoware2364
      @rajatkhoware2364 Год назад

      Can Someone help me !! My doubt is that when we click on post the post page pop up with bottom navigation bar that's perfectly okzy but i want that when we click on user1 i want to display user1 page only without bottom bar how can we do that anyone want to test there knowledge please drop a solution ..

  • @vinithalingareddy6346
    @vinithalingareddy6346 2 года назад

    Great tutorial, but how to navigate from one tab router to another tab nested router using push method

  • @user-bm2qd7ph3q
    @user-bm2qd7ph3q 2 года назад

    How can AutoRoute handle multiple path parameters?

  • @rhuanbarros
    @rhuanbarros 2 года назад

    THANK YOUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

  • @DemsDema
    @DemsDema 3 года назад

    Great stuff!! How do we go about combining this with a navigation rail for example?

  • @KamranKhan-jg1md
    @KamranKhan-jg1md 3 года назад

    ❤️ from Pakistan

  • @noblenetdk
    @noblenetdk Год назад

    Migration to version 6 ?

  • @ntfnd4044
    @ntfnd4044 2 года назад

    How to restart the build method on TabPage or not save the stack state when switching tabs. I should have an animation run in the build method on TabPage every time I switch a tab in the navigation bar

    • @RobKawaevChannel
      @RobKawaevChannel 2 года назад

      Found answer?

    • @G-lost109
      @G-lost109 2 года назад

      Its never late. I dont know why that is not described in docs. Spent hours for realize.
      You need to pass dynamic key to your route:
      UserDetailRoute(
      key: ValueKey('user-${author.id}'),
      id: author.id,
      )

  • @sauravgupta6166
    @sauravgupta6166 3 года назад

    When I clone or download zip starter project, why always final project gets downloaded? Can anyone please help me out!

    • @ResoCoder
      @ResoCoder  3 года назад +1

      The links point to the same repository, just different commits. If you clone the repo, you need to run *git checkout *. The commit id is *66e1a2e* in this case.

    • @sauravgupta6166
      @sauravgupta6166 3 года назад

      @@ResoCoder Thanks for your reply, I did the same and achieved what I wanted. Thanks for this awesome video.

  • @mahmoodali1871
    @mahmoodali1871 3 года назад +1

    Getx package make nested router much better

    • @medsed1133
      @medsed1133 3 года назад

      How so ? Any article or link to share ? Thx

  • @phucthanh869
    @phucthanh869 2 года назад

    Do you have link github?

  • @Muller19
    @Muller19 Год назад

    There is little complex to understand for me!

  • @ankitmalaviya1516
    @ankitmalaviya1516 2 года назад

    Hello
    can I have a code?

  • @alexadugna5330
    @alexadugna5330 2 года назад

    try to use simple example

  • @user-tv4kh4pc7s
    @user-tv4kh4pc7s 2 года назад

    where source noob?

  • @toblamabor7072
    @toblamabor7072 Год назад

    99 dependencies for a basic feature...

  • @forntoh
    @forntoh 3 года назад

    This sounds kinda weird to me.

  • @oneebkhan4453
    @oneebkhan4453 2 года назад

    If I was a girl I'd sound like you

  • @isaiamudhan5585
    @isaiamudhan5585 2 года назад

    Hello
    I have the AutoTabRouter in bottom navigation
    And also have inner AutoTabsRouter from this section I have to set active index for main AutoTabsRouter
    I have made like this but it is not working
    AutoTabsRouter.of(scaffoldKey.currentContext!)
    .setActiveIndex(2, notify: true);

  • @albanr8028
    @albanr8028 2 года назад

    Excellent tutorial ! Thank you