Add different routes/screens to Flutter app

别来无恙 提交于 2021-02-07 13:20:30

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!