flutter路由

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: '我是表单页')
                        )
                    )
                }
        )
 )

 

posted @ 2019-09-01 21:32  番茄西红柿u  阅读(172)  评论(0)    收藏  举报