首页 > 其他 > 详细

flutter路由

时间:2019-09-02 01:01:23      阅读:139      评论:0      收藏:0      [点我收藏+]

1、最基本的路由跳转

//先引入需要跳转的组件
Navigator.of(context).push(
    MaterialPageRoute(
        build: (context)=>跳转到的组件;
    )
);

2,跳转传值

//formPage页
.
.
string title;
FormPage({this.title="表单页"});
Widget build(BuildContext context){
    return Scaffold(
        appBar:AppBar(
            title: Text(this.title),
        )
    )
}
//other页
.
.
 body:container(
            child:RaisedButton(
                child: text(‘mmm‘),
                onpressed:(){
                    Navigator.of(context).push(
                        MaterialPageRoute(
                            builder:(context) => FormPage(title: ‘我是表单页‘)
                        )
                    )
                }
        )
 )

 

flutter路由

原文:https://www.cnblogs.com/xhrr/p/11443755.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!