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

猜你喜欢

转载自www.cnblogs.com/zhujiabin/p/10178311.html
今日推荐