Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲解。
效果图:
实现代码:
//删除并退出对话框 void _deleteAndExistDialog(){ LoadingDialogUtils.showBaseDialog(context, msg: "确定要删除并退出吗?", clickConfirm: (){ _deleteAndExist(); }, clickCancel: (){ }); } //删除并退出 void _deleteAndExist() async { LoadingDialogUtils.showLoadingContentDialog(context); String account = SpUtils.getAccount(); Listmembers = [account]; GroupUserBean? groupUserBean = await GroupUserRepository.getInstance().findGroupUserByAccountAndGroupId(account, widget.groupId); //清空群聊信息 await GroupChatRepository.getInstance().deleteAllGroupChatByGroupId(widget.groupId); //删除群聊用户 await GroupUserRepository.getInstance().deleteGroupUserByGroupId(account, widget.groupId); await GroupUserRepository.getInstance().deleteGroupUserByGroupIdAndAccountServer(account, widget.groupId); LoadingDialogUtils.dimissLoadingDialog(context); Navigator.popUntil(context, (route) {return route.isFirst;}); }
//删除本地群聊数据 @override FuturedeleteAllGroupChatByGroupId(String groupId) async { String sql = "DELETE FROM wc_group_chat where group_id = '${groupId}'"; return _queryAdapter.queryNoReturn(sql); }
//删除本地群成员数据 @override FuturedeleteGroupUserByGroupId(String account, String groupId) async { String sql = "DELETE FROM ${tableName} where group_id = '${groupId}' and account = '${account}' "; return _queryAdapter.queryNoReturn(sql); }
//删除群成员-web服务器端删除 FuturedeleteGroupUserByGroupIdAndAccount(String account, String groupId) async { LogUtils.d("删除群成员:${account}, ${groupId}"); String url = BASE_URL + "groupUser?method=deleteGroupUserByGroupIdAndAccount"; Response response = await getInstance().postForm(url,{'account': account,'groupId':groupId}); final responseResult = jsonDecode(response.toString()); final baseResult = BaseResult.fromJson(responseResult); LogUtils.d("删除群成员baseResult:${baseResult.toJson()}"); return baseResult.isSuccess!; }