flutter 监控返回键

return new WillPopScope(
        child: Scaffold(
      body: new Center(
          child: new Column(
        children: <Widget>[
      ......  
        ],
      )),
      floatingActionButton: FloatingActionButton(
        onPressed: () => Navigator.pop(context),
//      tooltip: 'Update Text',
        child: Icon(Icons.reply),
      ),
    ),
    onWillPop: (){print("返回键点击了");Navigator.pop(context);});
  }

 

    原文作者:星辰之力
    原文地址: https://www.cnblogs.com/zhujiabin/p/10178311.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞