我想用 iconButton 验证我的 flutter 表单并转到主页。但是我无法 link 我想要显示页面的按钮
I want to validate my flutter form with iconButton and go to the homepage. But i couldn't link the button with the page i want to display
我写了一些显示表单的代码。提交按钮是 IconButton 类型。我想通过单击它转到我的应用程序的主页,但这 return 我出错了。
这是一个 flutter 形式
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
IconButton(
iconSize: 80.0,
icon: Image.asset("images/send.png"),
onPressed: () {}
我希望通过单击或按
来 link 提交按钮
要从一个页面路由到另一个页面,您需要在下面给出的 materialapp widget.Example 中添加路由:
MaterialApp(
home: Firstpage(),
routes: <String,WidgetBuilder>{
"/SecondPage": (BuildContext context) => new SecondScreen()
}
)
然后在您的代码中简单地输入:
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
IconButton(
iconSize: 80.0,
icon: Image.asset("images/send.png"),
onPressed: () {
Navigator.of(context).pushNamed("/SecondPage")
}
)
)
希望对您有所帮助。
我写了一些显示表单的代码。提交按钮是 IconButton 类型。我想通过单击它转到我的应用程序的主页,但这 return 我出错了。
这是一个 flutter 形式
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
IconButton(
iconSize: 80.0,
icon: Image.asset("images/send.png"),
onPressed: () {}
我希望通过单击或按
来 link 提交按钮要从一个页面路由到另一个页面,您需要在下面给出的 materialapp widget.Example 中添加路由:
MaterialApp(
home: Firstpage(),
routes: <String,WidgetBuilder>{
"/SecondPage": (BuildContext context) => new SecondScreen()
}
)
然后在您的代码中简单地输入:
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
IconButton(
iconSize: 80.0,
icon: Image.asset("images/send.png"),
onPressed: () {
Navigator.of(context).pushNamed("/SecondPage")
}
)
)
希望对您有所帮助。