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);});
  }

 

posted @ 2018-12-26 11:48  星辰之力  阅读(2228)  评论(0编辑  收藏  举报