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
123
votes
13 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
  • 484,302
  • 314
  • 1,365
  • 1,393
52
votes
4 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
  • 11,638
  • 18
  • 65
  • 107
51
votes
4 answers

Waiting asynchronously for Navigator.push() - linter warning appears: use_build_context_synchronously

In Flutter, all Navigator functions that push a new element onto the navigation stack return a Future as it's possible for the caller to wait for the execution and handle the result. I make heavy use of it e. g. when redirecting the user (via…
Schnodderbalken
  • 3,257
  • 4
  • 34
  • 60
33
votes
12 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
  • 805
  • 2
  • 8
  • 20
20
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
  • 516
  • 1
  • 4
  • 13
17
votes
7 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
  • 31,138
  • 12
  • 157
  • 147
16
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
  • 1,386
  • 2
  • 14
  • 29
15
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…
Mohammed Bouali
  • 151
  • 1
  • 1
  • 6
14
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…
Midhunraj R Pillai
  • 484
  • 1
  • 3
  • 16
10
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
  • 590
  • 5
  • 19
10
votes
2 answers

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 has several screens like…
fajar ainul
  • 480
  • 2
  • 8
  • 27
10
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
  • 1,057
  • 1
  • 15
  • 31
10
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,987
  • 9
  • 43
  • 95
10
votes
7 answers

How named routes in Flutter eliminate duplication?

I cannot understand the reason why someone should use named routes, with Navigator.pushNamed(), instead of the normal way with Navigator.push(). The tutorial page states that: if we need to navigate to the same screen in many parts of our apps, …
Themelis
  • 4,048
  • 2
  • 21
  • 45
9
votes
8 answers

how to use flutter_bloc with go_router

I have built an app where I use flutter_bloc. i want to use go_router for navigation.but for dynamic routing how can i use GoRouter refreshListener parameter with flutter_bloc GoRouter( routes: [ GoRoute( path: '/', name: 'home', …
ismailfarisi
  • 249
  • 1
  • 2
  • 8
1
2 3
47 48