In Flutter is there a way to have different navigation stacks - flutter

I come from react-native and I am used to using react navigation, which allows you to make different stacks each with different routes in them.
Flutter appears to work where you have to put all your routes in one file, is there no way to split them up?
My app has 3 main sections and each screen in a section would ideally share blocs, but I cant find a way to make each section independent of the other sections which means either all the screens must share all the blocs or none of them.

Maybe you want every screen in section possible have a Navigator of itself ?
Default Flutter using a Navigator in app and navigate with Navigator.of(...). An app can use more than one Navigator with Navigator Widget.
Nesting Navigators
Code sample

Related

How to implement figma's smart animate option in flutter?

I designed three onboarding pages in figma which contains information about my app, while wireframing the app, I added smart animate to the three pagesThis is the first onboarding page
The second one
The third one
The smart animate enables smooth transition from each page to each page
While using flutter, I created 3 different pages for each onboarding pages and added a navigation widget to each button
But the navigation from each page to each page was stacked
I also tried using gesturedetection() onhorizontalswipe still same result
The pages navigate in a stacked way totally different from figma's smart animate option.
Is there anyway I can do this?
I'll appreciate any help
Thanks in advance.
From what I understood,
You want to build an onboarding screen with some animation. But the pages are being stacked.
It is happening because you are navigating to different pages with each button press. That is very bad practice for building an onboarding screen.
You should be using a PageView widget that allows you to transit between pages without navigating to them.
If you want to use a plugin that suits you, I would recommend introduction_screen

Same bloc functions in different screens

I'm having a serious issue with code duplication because I have created 2 different instances from a Bloc that holds the color change of a button and provided them to 2 screens. I wanted them to act independently, but unfortunately, both buttons work the same. Can anyone give me a clue to achieve this without creating another bloc for the next screen?. I have provided the bloc to the main screen and on the 2nd screen, I have bottom navigation and it has 2 screens.
You can define a class yourBlock with your functions ecc then in your pages you can include that custom block and use it as you want.. so if you need to add, modify or to do anything on your code you have to do only once in your custom class

Can I have two MaterialApp widgets in an app in Flutter

I have two questions with and "if" regarding the first question. As the title says I know it's better to have one MaterialApp in an App in Flutter and making Scaffold widgets for screens. But in a situation like this App which I followed for learning purposes and it's really written well and very clean. but it uses "TabBarView" as a default home for the entire app. So if I want to add another screen like "LoginSreen" that's not part of the "TabBarView" it's not inheriting the "MaterialApp" widget features. So I have to add a "MaterialApp" widget independently for that screen.
So the question is, is it ok to have two "MaterialApp" widgets in a situation like this?
if yes does it affect any variables that's shared among the screens like "SharedPreference"? or what does it affect?
If it's a bad behavior to have two "MaterialApp" widgets to in an App, Then how can you get rid of the "NavScreen()" and implement the TabBarView in the screens, Because I have tried many ways and looked at many of open source projects like this they have "TabBarView" widget as the body and start of the project.
yes you can definitely have two mat apps. but its not recommended.

Flutter: Using Hero without Navigation

I have an app that uses a BottomNavigationBar to switch between two screens with their own navigation stack. I would like to use the Hero tag to create a custom transition between the two, but since I don't use navigation, but rather change the state to switch between screens, I'm not sure if this is possible at all.
Is there any way to recreate the transitions provided by Hero without using Navigator?
The Hero widget is not what you are looking for. Try the animations package made by the flutter team. Here the link to this package.
Is not easy to use, but get a try, or you can use the default Navigation built in.

How to distribute state of BottomNavigationBar across the app in Flutter?

In my app, the navigation bar works fine between the tabs, but when I go inside of each item in my list, I want the navigation bar to be there too.
What I did is that I made it a separate widget, and called in the bottomNavigationBar inside the Scaffold of the pages, but the problem is that I am changing the state of the navigation bar in my main page only, so the state doesn't get distributed across all pages in my app.
How do I make the body of the page change in an app where there is not only one body, but many?
Thanks!
Since there is not code over here in your post and I don't know what you have done so far so I can only advise you to go through this post.
I know you might have already seen this, but still, try to follow and this will really help.
Thanks....!!!!!!
https://medium.com/#lucassaltoncardinali/keeping-state-with-the-bottom-navigation-bar-in-flutter-69e4168878e1