Problem with Mapbox navigation in flutter - 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.

Related

is this the right method instead using bottom bar navigation

I am new to Flutter. As I understand Bottom Bar Navigation is used for quick navigation between the top-level views of an app. but in my situation, I want to use like this which only button PAY can be clicked.
so is it okay if Im not using BottomBar instead i use as container and place it at bottom?
ya ,The best way is that you can create a container and the button and place it child of bottomNavigationBar so the flutter is automaticaly align it in bottom side
bottomNavigationBar: Container(child: yourcodeHere),

is it posible to not to show all poped screens when using popUntil?

when I use
Navigator.popUntil(context, ModalRoute.withName('/myPage))
all screens that are being poped appears until I get the "myPage" screen
is there any way to only show myPage screen without the poped screens
Check this out pushAndRemoveUntil
It will allow you to push the route you want and remove all routes stacked till the predicate returns true.

Page transitions issue [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

How do you reuse Flutter views created with MaterialPageRoute builder?

How do you reuse Flutter views created with MaterialPageRoute builder? Currently new views are created in the widget tree whenever Navigator.pushReplacementNamed is called. e.g. The following code will create 4 views in the widget tree:
Navigator.pushNamed(context, 'page1');
Navigator.pushNamed(context, 'page2');
Navigator.pushNamed(context, 'page1');
Navigator.pushNamed(context, 'page2');
I would prefer only two views in the widget tree - a single instance of both page1 and page2.
Is this possible?
push() and pushNamed() method recreate page over the current page you should use pushReplacement() and pushReplacementNamed() methods. However in this way you cannot use automatic back feature you should use pop() method or you should again some of push methods because when you you use pushReplacement() and pushReplacementNamed() methods previous page destroy and you should re-create manually.

Swipe back gesture on iOS is overwritten by WillPopScope

If I am using WillPopScope to overwrite the BackButton behavior with a new route, it works fine. But on iOS, the automatic 'SwipeBack' gesture is not working any more. How can I set the SwipeBack gesture on iOS to push the current screen to the page with the class 'StartScreen'?
WillPopScope(onWillPop: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => StartScreen(),
),
);
}
This may be a very late answer, but at the moment there is no clear opportunity to listen to this gesture
You can achieve the call to onWillPop when you press the back button, and at the same time do not block the gesture if you make a descendant class of the ModalRoute class (or its descendants, such as MaterialPageRoute) and override the hasScopedWillPopCallback method (however, the gesture will not call onWillPop)
WillPopScope is not meant to affect navigation (I.e.: push a route on the navigator). It is meant for vetoing (preventing) navigation away from the current route when you don't want the user to navigate away. (For example, when it might result in data loss.)
Try CupertinoWillPopScope, as it allows you to conditionally veto the back navigation. So you can only block it when there's an actual need.