Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲解。
效果图:
实现代码:
//删除对话框 Future<void> _showDeleteDialog(ChatBean chatBean) async { return showDialog<Null>( context: context, barrierDismissible: false, builder: (BuildContext context) { return AlertDialog( title: Text('确定要删除该消息吗?', style: new TextStyle(fontSize: 17.0)), actions: <Widget>[ MaterialButton( child: Text('取消'), onPressed: (){ Navigator.of(context).pop(); }, ), MaterialButton( child: Text('确定'), onPressed: (){ Navigator.pop(context); _deleteChatBean(chatBean); }, ) ], ); } ); }
//删除本地记录后返回刷新页面 _deleteChatBean(ChatBean chatBean) async{ int id = chatBean.id??0; await ChatRepository.getInstance().deleteChatById(id); widget.deleteCallback(true); }