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.

370 questions
63
votes
9 answers

Passing data between screens in Flutter

As I'm learning Flutter I've come to navigation. I want to pass data between screens similarly to passing data between Activities in Android and passing data between View Controllers in iOS. How do I do it in Flutter? Related questions: The best…
Suragch
  • 364,799
  • 232
  • 1,155
  • 1,198
31
votes
2 answers

In a Nested Navigator Structure of Flutter, How do you get the a Specific Navigator?

I have this problem when I have Nested Navigators. So something like, class App extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( …
Archie G. Quiñones
  • 5,945
  • 5
  • 32
  • 71
14
votes
2 answers

How to do nested navigation in Flutter

Does anyone have any recommendations for figuring out nested navigation in Flutter? What I want is to keep a persistent BottomNavigationBar even when redirecting to new screens. Similar to YouTube, where the bottom bar is always there, even when…
Moshe G
  • 326
  • 1
  • 2
  • 9
11
votes
10 answers

How to fix black screen in flutter while Navigating?

I am creating a multi-paged app on flutter. When I am using the navigation in it, I am getting a black screen. import 'package:flutter/material.dart'; void main() => runApp(MyHomePage()); class MyHomePage extends…
Shahbaz
  • 363
  • 2
  • 12
9
votes
3 answers

Flutter navigation, reopen page instead of pushing it again

I'm new to flutter and I'm working on an App that have multiple screens. I would like to know to stop flutter from creating multiple screens of the same route, for example I have Page 1 and Page 2, if I click on the button to navigate to Page 2 and…
9
votes
4 answers

How to remove default navigation route animation

I am below code which given in flutter documentation for page routing // Within the `FirstRoute` widget onPressed: () { Navigator.push( context, MaterialPageRoute(builder: (context) => SecondRoute()), ); } But it provides some animation…
Jitesh Mohite
  • 15,430
  • 6
  • 71
  • 84
8
votes
1 answer

TabBarView or IndexedStack for BottomNavigationBar - Flutter

What is the best way to do the bottom navigation bar in flutter? According to Getting to the Bottom of Navigation in Flutter the flutter team used IndexedStack with Offstage to show the widget when the user changes the tab, but I see there's another…
Wail Hayaly
  • 579
  • 1
  • 5
  • 23
7
votes
1 answer

When does route.didPop(result) is equal to false in Flutter Navigator 2.0

One of the main mecanism of Flutter Navigator 2.0 it the function onPopPage inside RouterDelegate > build > Navigator. However, I do not understand when route.didPop(result) returns false. We can use the John Ryan's famous example to show my…
Dimitri Leurs
  • 169
  • 1
  • 6
7
votes
1 answer

Flutter WillPopScope for nested Navigation

I have Flutter App with nested Navigator and I want to override "onBackPressed" using WillPopScope in my nested screen. Let's say I have MainScreen, PrimaryScreen, and SecondaryScreen. PrimaryScreen is nested Navigator, it have several screen like…
fajar ainul
  • 260
  • 1
  • 5
  • 20
7
votes
1 answer

Use nested Navigator with WillPopScope in Flutter

In my application, I want to have a custom Navigation (only change part of the screen and keep an history of what I'm doing inside it). For that purpose, I am using a Navigator and it's working fine for simple navigation. However, I want to handle…
leb1755
  • 773
  • 7
  • 20
7
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 W
  • 11,902
  • 10
  • 61
  • 135
7
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
  • 165
  • 1
  • 12
6
votes
2 answers

flutter: how to handle back button press when using navigator with pages

I am trying to implement Navigator 2.0 method. The only thing I can't make to work is the back button presses. When I press the back button, the app just exits and not going to the previous page. I tried the WillPopPage widget but back button…
6
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
  • 705
  • 1
  • 6
  • 25
6
votes
1 answer

How to reload or call some function initState() in flutter while using pop

I am trying to run some method when user click back or I use Navigator.pop() in second screen. I have two screens. Setting screen Edit screen After editing I pop user to first second. Now in first screen I use SharedPreference. But I need to re…
Hkm Sadek
  • 2,348
  • 5
  • 26
  • 62
1
2 3
24 25