Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add different routes/screens to Flutter app

Tags:

flutter

dart

I'm trying to add multiple screens to my flutter app but can't get it to work. And there are no tutorials/ guides to do this.

Does anyone have an example on how to accomplish this.

Thanks in advance.

like image 504
Theo Bouwman Avatar asked Dec 11 '16 22:12

Theo Bouwman


People also ask

How do you pop all routes in Flutter?

To remove all the routes below the pushed route, use a RoutePredicate that always returns false (e.g. (Route<dynamic> route) => false ). The removed routes are removed without being completed, so this method does not take a return value argument. The newly pushed route and its preceding route are notified for Route.


1 Answers

You can use the Navigator

It's use is demonstrated in the Stocks example in https://github.com/flutter/flutter/blob/c8447c91a93cdee28eddb01ee3ace27b9362220f/packages/flutter/test/widgets/navigator_test.dart

Navigator.pushNamed(context, '/second');
...
onTap: () => Navigator.pop(context),

Navigator can also be used without Scaffold.

I run into an exception when I tried which I haven't yet found out how to fix. I plan to prepare a reproduction and file a bug report.

like image 166
Günter Zöchbauer Avatar answered Oct 19 '22 04:10

Günter Zöchbauer