Page transitions issue [Flutter] - flutter

I have an app with bottom navbar. I can navigate between pages through the navbar. My problem is when i go to another page (not a button for this page on navbar) navbar disappears. I used that code below when click button and go to another page. But as i said navbar dissappears. I want navbar always stay.
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProgrammingScreen()));
I tried PageView widget but i could'nt navigate pages from buttons. How can i solve this problem?

One option is to all those screens be in the page view widget.
But another thing you can do is put the exact same bottom nav bar in the new pushed screen and if the user selects an option. You can use Navigator.pop() and then navigate to the pageView with the selected option

Related

how do I know if a page is pushed or not in navigation stack?

let say I have 2 pages, PageA and PageB.
if a user tap a button in PageA then it will move to PageB using the code below
Navigator.of(context).pushNamed("pageB");
so as a result, there is back button in the top left app bar in PageB
my question is .....
how do I know if a page is pushed or not? I want to do something only if there is a back button in the appbar in a page
You can use this:
final hasPagePushed = Navigator.of(context).canPop();
This is actually what the flutter's AppBar is using to know whether or not it should display the back button.

Implementing custom bottom tab navigator flutter

I am trying to implement a custom bottom tab navigator by doing step by step from this source: https://medium.com/coding-with-flutter/flutter-bottomappbar-navigation-with-fab-8b962bb55013. It uses the combination of floating action bottom and BottomAppBar. The problem is.. if I click the floating action button to navigate user to a screen the bottom tab navigator will be lost. Is there a way to keep bottom tab navigator is still exist when user click the floating action button (where the button will navigate to a screen) or is there a way to make custom bottom tab navigator like this without floting action button:
you have to use nested navigation. here is a tutorial.

How do I delete all of the pages stacked through push in bottom navigation?

I use the bottom navigation bar. Various pages remain stacks through push on A_Page, one of the bottom navigation items.
If you press the button on the top page, I want to clear all stacked pages, leaving only A_Page, the first page of the bottom navigation item. I think using Navigator.pop several times is a bad code.
How do I clear a pushed page except the first bottom navigation item page?
Navigator.popUntil(context, (route) => route.isFirst);
You can use named routes
Navigator.of(context).pushNamedAndRemoveUntil(
'/first_screen',
(Route<dynamic> route) => false,
);

Problem with Mapbox navigation in flutter

I'm trying to make a turn by turn navigation app with flutter but I have a problem. I am using the Mapbox navigation package and I want the navigation screen to remain in the screen where I called it, not to open another screen. How can this be achieved?
if you are trying to navigate based on markers, you can do that using the ontap method inside the marker function.
onTap: (){
Navigator.push(context, MaterialPageRoute(builder: (context)=>Page()),);
}
you can do the navigation replacing the Page to which ever widget you want.

How to load a new screen in the same Tab view?

I have a Screen which contains two tab bars. Out of which one Tab bar view has button inside it. I want to load a new screen in the same tab view on button click.
In the image attached you can see a button.
On clicking Go to Details button I want to load details Page in the the same tab bar view.
Full example on DartPad
TabBarView(children: [
Navigator(
onGenerateRoute: (settings) => MaterialPageRoute(
builder: (context) => YourContent(),
),
)
])
You can use setState((){}) to reveal data on screen but you cannot navigate to other screen only inside one tabbar view.
You can use Navigate.pushNamed() to navigate to other screen.