Questions tagged [flutter-navigation]

For questions relating to navigation methods in Flutter, like the Navigator class. Use this tag in combination with the general [flutter] tag. If your question applies to Flutter more generally, use the [flutter] tag only.

Flutter allows cross-platform development targeting both iOS and Android from a single code base. Flutter contains modules to implement navigation for mobile applications.

710 questions
9
votes
1 answer

How to scope providers on several widgets without putting the provider on a root widget in flutter

I'm working on a simple demo where the user logs in, sees a list of items, clicks on an item, and then sees its details. These are 3 screens but let's say two flows where one deals with login and the other with items. I'm managing my state using…
Spidey
  • 894
  • 1
  • 13
  • 29
9
votes
0 answers

Flutter: How to implement named routes navigation for popup dialogs?

How best to implement the following: I need to show a regular window on a smartphone, and show the same window on a tablet as a popup dialog. There are several such windows in different places. Which would be more correct: use…
proninyaroslav
  • 720
  • 2
  • 7
  • 19
9
votes
5 answers

How can i do Navigator.push in a modal bottom sheet only (not the parent page)

In my app, i am trying to create a comments section. In this section, i want a user to be able to reply to another user's comment in a fashion akin to the YouTube app. I have managed to create a modal bottom sheet showing the top level comments and…
Simeon
  • 692
  • 1
  • 6
  • 12
9
votes
3 answers

What is onUnknownRoute in flutter

I'm new to flutter, In MaterailApp Widget have an attribute called onUnknownRoute. What is the main use of onUnknownRoute? Thanks for your help!
Magesh Pandian
  • 8,789
  • 12
  • 45
  • 60
8
votes
1 answer

How to display alert dialog box on back button of browser or onReload the page using Go Router in flutter web?

I am working on the Flutter web and using go_router for navigation. Expectation: From the initial route, When the user tries to navigate back using the browser back button or reload the page, an alert box should be displayed and ask, "Are You sure…
8
votes
1 answer

How to get name of the current route?

I need to get my current route name. I use GlobalKey to create navigatorSevice instead Navigator.of(context) in every page. So I create navKey: class Keys { static final GlobalKey navKey = GlobalKey(); } And when…
Andrew Kovalchuk
  • 897
  • 1
  • 10
  • 29
8
votes
1 answer

Flutter error "Could not navigate to initial route"

I'm getting the following error when starting my Flutter app: ══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════ The following message was thrown: Could not navigate to initial route. The requested…
Magnus
  • 17,157
  • 19
  • 104
  • 189
8
votes
2 answers

Flutter search delegate doesn't work when navigate back from a route

I'm using Flutter SearchDelegate in my app and here's the code: class NameSearch extends SearchDelegate { @override List buildActions(BuildContext context) { return [ IconButton( icon: Icon(Icons.clear), …
artick
  • 175
  • 1
  • 13
7
votes
1 answer

go_router - Is there a way to push twice the same page?

I'm using go_router to build an application that does "dummy" pushes of routes (a bit like Twitter). It is possible to start with a page /a ,push /b, then /c, ... and then push again /a. When a page is pushed twice, an assert fails:…
Valentin Vignal
  • 6,151
  • 2
  • 33
  • 73
7
votes
1 answer

Updating URL from TabBar selection

I'm currently working on updating a Flutter Web app to support sharing pages via URLs. I currently have a screen that uses a TabBar, and shows different views based on the selected tab. I want to be able to do two things: Update the URL when a tab…
Lucas
  • 329
  • 2
  • 8
7
votes
1 answer

Flutter Navigator 2.0 - Router does not receive deep link when app is launched from URL?

I'm using Flutter Navigator 2.0 with Nested Routers - there's a main router created by calling MaterialApp.router() and child routers created as Router() widgets with proper RouterDelegates (child routers are used as pages for bottom navigation). In…
ikurek
  • 604
  • 11
  • 27
7
votes
4 answers

Flutter 2.0 pushAndRemoveUntil not working

Not sure how to clear the stack and route to a new page after implementing the Flutter 2.0 routing. The following isn't working: Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) => SignInPage()), (route) =>…
mtical
  • 299
  • 4
  • 15
7
votes
2 answers

Flutter Navigator 2.0 page transition

I'm using a declarative approach of Navigator: Navigator( pages: [ MaterialPage(child: _screen), ], onPopPage: (route, result) { return route.didPop(result); }, ); How can I add a transition between the…
Fei Whang
  • 209
  • 4
  • 11
7
votes
1 answer

Flutter Navigator 2.0 Routing via the Navigator()

I am currently trying to build a web app with the new Flutter web beta. The thing is to be able to have a history, handle the forward and back buttons in the browser and be able to handle user inputs into the URL the new Navigator 2.0 API is…
7
votes
0 answers

Flutter Navigation: Bringing previous route on top of stack

In flutter, I've a use case where I want to bring back the same route on top of the screen if its already present, otherwise push a new route. As an example, Current stack : A -> B -> C -> D (top most) If I push B, I just want A -> C -> D -> B. I…
Avi Yadav
  • 103
  • 1
  • 5
1
2
3
47 48