美文网首页
flutter笔记一

flutter笔记一

作者: 阿克兰 | 来源:发表于2019-09-23 14:51 被阅读0次

    路由跳转

     FlatButton(
             child: Text("open new route"),
             textColor: Colors.blue,
             onPressed: () {
              //导航到新路由   
              Navigator.push( context,
               MaterialPageRoute(builder: (context) {
                  return NewRoute();
               }));
              },
             ),
    

    创建新路由

    class NewRoute extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text("New route"),
          ),
          body: Center(
            child: Text("This is new route"),
          ),
        );
      }
    }
    

    相关文章

      网友评论

          本文标题:flutter笔记一

          本文链接:https://www.haomeiwen.com/subject/ylmpuctx.html