将不同的路线/屏幕添加到Flutter应用 [英] Add different routes/screens to Flutter app

查看:46
本文介绍了将不同的路线/屏幕添加到Flutter应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将多个屏幕添加到我的flutter应用程序中,但无法使其正常工作.而且没有教程/指南可以做到这一点.

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.

谢谢.

推荐答案

您可以使用 https://github.com/flutter/flutter/blob/c8447c91a93cdee28eddb01ee3ace27b9362220f/packages/flutter/test/widgets/navigator_test.dart

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

Navigator 也可以在没有 Scaffold 的情况下使用.

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.

这篇关于将不同的路线/屏幕添加到Flutter应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆