问题
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.
回答1:
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.
回答2:
You may also have a lot at https://github.com/goposse/fluro for a more advanced router.
回答3:
You have an article here http://sergiandreplace.com/2017/12/planets-flutter-routing-and-navigation/ (disclaimer, I'm the author)
来源:https://stackoverflow.com/questions/41091772/add-different-routes-screens-to-flutter-app