各位大佬求教个问题,怎么实现点手机的实体的返回键不会退出程序只是回到桌面,我现在用WillPopScope监听到了返回键操作然后设置返回无效,但是不知道怎么实现回到桌面。感谢。
Future<bool> _onWillPop() {
return Future.value(false);
}
Widget _buildTextComposer() {
return new WillPopScope(
onWillPop: _onWillPop,
child: new IconTheme(
data: new IconThemeData(color: Theme.of(context).accentColor),
child: new Container(
margin: const EdgeInsets.symmetric(horizontal: 8.0),
child: new Row(children: <Widget>[
new Flexible(
child: new TextField(
controller: _textController,
onSubmitted: _handleSubmitted,
decoration: new InputDecoration.collapsed(hintText: '发送消息'),
)),
new Container(
margin: new EdgeInsets.symmetric(horizontal: 4.0),
child: new IconButton(
icon: new Icon(Icons.send),
onPressed: () => _handleSubmitted(_textController.text)),
)
]))));
}