From 32bd4f74dcd008923a590b211623ef9e0ae327cf Mon Sep 17 00:00:00 2001 From: ZCM <772112648@qq.com> Date: Fri, 27 Mar 2020 22:58:08 +0800 Subject: [PATCH] 1 --- lib/chat/group_chat_item.dart | 157 +++++++++++++++----------- lib/chat/group_chat_view.dart | 101 ++++++++++++----- lib/chat/input_bar.dart | 2 +- lib/home/BindCode.dart | 23 +++- lib/home/group_item_widget.dart | 42 ++++--- lib/models/unread_count_provider.dart | 12 ++ lib/utils/HttpUtil.dart | 4 +- lib/utils/msgHandler.dart | 76 +++++-------- pubspec.lock | 9 +- pubspec.yaml | 1 + 10 files changed, 262 insertions(+), 165 deletions(-) diff --git a/lib/chat/group_chat_item.dart b/lib/chat/group_chat_item.dart index ae0a11c..ce849e9 100644 --- a/lib/chat/group_chat_item.dart +++ b/lib/chat/group_chat_item.dart @@ -284,9 +284,9 @@ class _GroupChatPageItemState extends State if (msg.contains(' ]')) { msg = msg.replaceAll(' ]', ']'); } - bool isUrl =false; - if(textList[curTextType].contains('http') ){ - isUrl =true; + bool isUrl = false; + if (textList[curTextType].contains('http')) { + isUrl = true; } Widget text = Container( constraints: BoxConstraints(maxWidth: Screen.width - 120), @@ -294,7 +294,7 @@ class _GroupChatPageItemState extends State msg, hideKeyboard: widget.hideKeyboard, fontSize: FontSize, - color: isUrl?Colors.blue:SendMsgText, + color: isUrl ? Colors.blue : SendMsgText, ), padding: EdgeInsets.symmetric(horizontal: 9, vertical: 10.5), decoration: BoxDecoration( @@ -472,7 +472,9 @@ class _GroupChatPageItemState extends State _imgMsg(List imgData) { var imgSize = _getImgSize(); - ImageProvider provider = MemoryImage(widget.msg.localFile==null?Uint8List.fromList(imgData):File(widget.msg.localFile).readAsBytesSync()); + ImageProvider provider = MemoryImage(widget.msg.localFile == null + ? Uint8List.fromList(imgData) + : File(widget.msg.localFile).readAsBytesSync()); return GestureDetector( child: ClipRRect( @@ -484,7 +486,7 @@ class _GroupChatPageItemState extends State width: imgSize.width, child: Image( fit: BoxFit.contain, - image:provider, + image: provider, ), )), borderRadius: BorderRadius.circular(5), @@ -586,46 +588,46 @@ class _GroupChatPageItemState extends State MessageMgr().emit('Delete Select Message', widget.msg); }); - ///转发 - if (widget.msg.msgType == ChatType.TextChatType.value|| - widget.msg.msgType == ChatType.ImageChatType.value|| - widget.msg.msgType == ChatType.ShortVideoChatType.value|| - widget.msg.msgType == ChatType.PlaceChatType.value|| - widget.msg.msgType == ChatType.EmoticonType.value|| - widget.msg.msgType == ChatType.FileChatType.value - ){ - actions.add( I18n.of(context).forward); + if (widget.msg.msgType == ChatType.TextChatType.value || + widget.msg.msgType == ChatType.ImageChatType.value || + widget.msg.msgType == ChatType.ShortVideoChatType.value || + widget.msg.msgType == ChatType.PlaceChatType.value || + widget.msg.msgType == ChatType.EmoticonType.value || + widget.msg.msgType == ChatType.FileChatType.value) { + actions.add(I18n.of(context).forward); actionsFunc.add(() { print('转发消息'); - if(widget.msg.msgType == ChatType.FileChatType.value && widget.msg.localFile==null){ + if (widget.msg.msgType == ChatType.FileChatType.value && + widget.msg.localFile == null) { showToast('请先下载文件'); - return ; + return; } AppNavigator.pushForwardPage(context, widget.msg); }); } - - if (widget.msg.msgType == ChatType.FileChatType.value &&widget.msg.localFile!=null) { + if (widget.msg.msgType == ChatType.FileChatType.value && + widget.msg.localFile != null) { //分享文件 - actions.add( I18n.of(context).copy_download_url); - actionsFunc.add(() async{ + actions.add(I18n.of(context).copy_download_url); + actionsFunc.add(() async { //如果是文件增加复制下载地址 - String path = widget.msg.localFile; - UploadUtil().copyFileUrl(widget.msg, context); - String type='file'; - if(path.contains('mp4') ||path.contains('mp3')){ - type = 'video'; - }else if(path.contains('png')||path.contains('jpg')||path.contains('jpeg')||path.contains('JPG')||path.contains('PNG')){ - type = 'image'; - } - - ShareExtend.share(FileCacheMgr.replacePath(path), type); - + String path = widget.msg.localFile; + UploadUtil().copyFileUrl(widget.msg, context); + String type = 'file'; + if (path.contains('mp4') || path.contains('mp3')) { + type = 'video'; + } else if (path.contains('png') || + path.contains('jpg') || + path.contains('jpeg') || + path.contains('JPG') || + path.contains('PNG')) { + type = 'image'; + } + ShareExtend.share(FileCacheMgr.replacePath(path), type); }); - } if (widget.msg.msgType == ChatType.TextChatType.value) { @@ -639,8 +641,6 @@ class _GroupChatPageItemState extends State }); } - - if (widget.msg.msgType == ChatType.ShortVoiceChatType.value) { var soundPlayMode = Provider.of(context).soundPlayMode; @@ -656,23 +656,22 @@ class _GroupChatPageItemState extends State } // String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString(); - bool isUrl =false; - if(widget.msg.msgType==ChatType.TextChatType.value ){ - if( textList[curTextType].contains('http')){ - isUrl =true; + bool isUrl = false; + if (widget.msg.msgType == ChatType.TextChatType.value) { + if (textList[curTextType].contains('http')) { + isUrl = true; } - } return WPopupMenu( child: item, actions: actions, - onTap: ()async{ - if(isUrl){ - if (await canLaunch(textList[curTextType])) { - launch(textList[curTextType]); + onTap: () async { + if (isUrl) { + if (await canLaunch(textList[curTextType])) { + launch(textList[curTextType]); + } } - } }, onLongPressStart: () { isLongPressed = true; @@ -771,24 +770,33 @@ class _GroupChatPageItemState extends State ///单文字 } + blueDot(bool isShow) { + return Container( + margin: EdgeInsets.only(right: 5), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: isShow ? Color(0xFFFF7E00) : Color(0xFFCFCFCF), + ), + width: 6, + height: 6, + ); + } + _receiveText(MsgModel msg) { List showMsg = []; if (textList.length > 0) { - bool isUrl =false; - if(textList[curTextType].contains('http') ){ - isUrl =true; + bool isUrl = false; + if (textList[curTextType].contains('http')) { + isUrl = true; } - - showMsg.add(Container( constraints: BoxConstraints(maxWidth: Screen.width - 140, minHeight: 22), alignment: Alignment.centerLeft, child: extendedText( textList[curTextType], - color: isUrl?Colors.blue:Constants.BlackTextColor, - + color: isUrl ? Colors.blue : Constants.BlackTextColor, hideKeyboard: widget.hideKeyboard, fontSize: FontSize, ))); @@ -806,18 +814,32 @@ class _GroupChatPageItemState extends State showMsg.add(tranWidget); } - Widget text = Container( - width: width + 20, - constraints: - BoxConstraints(maxWidth: Screen.width - 120, minWidth: minWidth), - padding: EdgeInsets.symmetric(horizontal: 9, vertical: 10.5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: showMsg), - decoration: BoxDecoration( - border: Border.all(color: ReciveBorderColor, width: 0.5), - color: isLongPressed ? Colors.grey[300] : Colors.white, - borderRadius: BorderRadius.all(Radius.circular(ChatRadius))), - ); + Widget text = Stack(children: [ + Container( + width: width + 20, + constraints: + BoxConstraints(maxWidth: Screen.width - 120, minWidth: minWidth), + padding: EdgeInsets.symmetric(horizontal: 9, vertical: 10.5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: showMsg), + decoration: BoxDecoration( + border: Border.all(color: ReciveBorderColor, width: 0.5), + color: isLongPressed ? Colors.grey[300] : Colors.white, + borderRadius: BorderRadius.all(Radius.circular(ChatRadius))), + ), + // msg.transTag != 0 + // ? Positioned( + // right: 5, + // top: 5, + // child: Container( + // child: Row(children: [ + // blueDot(true), + // blueDot(true), + // blueDot(true), + // blueDot(true), + // ]))) + // : Container() + ]); if (msg.refMsgContent != null && msg.refMsgContent.length > 0) { QuoteMsg quoteMsg = QuoteMsg.fromBuffer(msg.refMsgContent); @@ -1047,14 +1069,16 @@ class _GroupChatPageItemState extends State _receiveImg(BuildContext context, List imgData, {String downloadData}) { // ImageProvider provider = MemoryImage(Uint8List.fromList(imgData)); - ImageProvider provider = MemoryImage(widget.msg.localFile==null?Uint8List.fromList(imgData):File(widget.msg.localFile).readAsBytesSync()); + ImageProvider provider = MemoryImage(widget.msg.localFile == null + ? Uint8List.fromList(imgData) + : File(widget.msg.localFile).readAsBytesSync()); var imgSize = _getImgSize(); return DownloadItem( isAutoDown: false, msg: widget.msg, - onFinishTap: (){ + onFinishTap: () { widget.hideKeyboard(); showFullImg(context, widget.msg); }, @@ -1070,7 +1094,6 @@ class _GroupChatPageItemState extends State ), ), ); - } _receiveVideo(BuildContext context, List imgData, diff --git a/lib/chat/group_chat_view.dart b/lib/chat/group_chat_view.dart index ef5d1cc..f2e98c4 100644 --- a/lib/chat/group_chat_view.dart +++ b/lib/chat/group_chat_view.dart @@ -29,6 +29,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:oktoast/oktoast.dart'; import 'package:provider/provider.dart'; +import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; import '../r.dart'; import 'input_bar.dart'; import 'package:chat/models/ref_name_provider.dart'; @@ -48,6 +49,10 @@ class GroupChatPage extends StatefulWidget { class _GroupChatPageState extends State { ScrollController _scrollCtrl = ScrollController(); + final ItemScrollController itemScrollController = ItemScrollController(); + final ItemPositionsListener itemPositionListener = + ItemPositionsListener.create(); + MessageMgr msgMgr = MessageMgr(); List msgList; @@ -113,10 +118,12 @@ class _GroupChatPageState extends State { channelType: ChatChannelType.Group); msg.extraInfo = originMsg.extraInfo; // msg.extraFile = originMsg.extraFile; - if(originMsg.extraFile==null ||originMsg.extraFile.contains('http')){ + if (originMsg.extraFile == null || + originMsg.extraFile.contains('http')) { msg.extraFile = originMsg.extraFile; - }else{ - msg.extraFile = UploadUtil().getFullUrl(originMsg.extraFile, originMsg.sessionId, originMsg.channelType); + } else { + msg.extraFile = UploadUtil().getFullUrl( + originMsg.extraFile, originMsg.sessionId, originMsg.channelType); } msg.localFile = originMsg.localFile; if (msg.localFile != null) { @@ -126,6 +133,12 @@ class _GroupChatPageState extends State { sendMsg(msg); } }); + + itemPositionListener.itemPositions.addListener(() { + print(itemPositionListener.itemPositions.value); + //itemScrollController.jumpTo(index: 1, alignment: -0.02208835341365462); + //-0.02208835341365462, itemTrailingEdge: 0.12650602409638553 + }); } void _sendFile(File file) async { @@ -254,11 +267,33 @@ class _GroupChatPageState extends State { centerTitle: false, actions: actions), body: SafeArea( - child: Column( + child: Stack( children: [ - NetStateWidget(), - Expanded(child: _buildMessageList()), - InputBar(sendMsg: sendMsg), + Column( + children: [ + NetStateWidget(), + Expanded(child: _buildMessageList()), + InputBar(sendMsg: sendMsg), + ], + ), + // Positioned( + // top: 32.5, + // right: 0, + // child: Container( + // decoration: BoxDecoration( + // boxShadow: [ + // BoxShadow( + // color: Color(0x33000000), //阴影颜色 + // blurRadius: 10.0, //阴影大小 + // ) + // ], + // borderRadius: BorderRadius.only( + // topLeft: Radius.circular(80), + // bottomLeft: Radius.circular(80)), + // color: Colors.white, + // ), + // width: 120, + // height: 39)) ], ))), behavior: HitTestBehavior.translucent, @@ -295,13 +330,13 @@ class _GroupChatPageState extends State { for (var i = 0; i < msgList.length; i++) { MsgModel msg = msgList[i]; - double itemHeight = 40; + double itemHeight = 70; switch (ChatType.valueOf(msg.msgType)) { case ChatType.TextChatType: - if (msg.from == myId) { - var text = utf8.decode(msg.msgContent); - itemHeight = 21 + _getTextHeight(text); - } else {} + //if (msg.from == myId) { + var text = utf8.decode(msg.msgContent); + itemHeight = 21 + _getTextHeight(text); + //} else {} break; case ChatType.ShortVoiceChatType: if (msg.from == myId) { @@ -383,14 +418,25 @@ class _GroupChatPageState extends State { style: TextStyle(color: Colors.grey), )) : Scrollbar( - child: ListView.builder( - reverse: true, - shrinkWrap: true, - itemCount: msgList.length, - controller: _scrollCtrl, - padding: EdgeInsets.all(8.0), - itemBuilder: _buildItem, - )), + child: + // ScrollablePositionedList.builder( + // itemCount: msgList.length, + // itemBuilder: _buildItem, + // itemScrollController: itemScrollController, + // itemPositionsListener: itemPositionListener, + // padding: EdgeInsets.all(8.0), + // reverse: true, + // ) + ListView.builder( + reverse: true, + shrinkWrap: true, + itemCount: msgList.length, + controller: _scrollCtrl, + padding: EdgeInsets.all(8.0), + itemBuilder: _buildItem, + + ) + ), ); } @@ -445,11 +491,13 @@ class _GroupChatPageState extends State { return; } if (mounted) { - setState(() {}); - if (_scrollCtrl.hasClients) { - _scrollCtrl.animateTo(0, - duration: new Duration(milliseconds: 500), curve: Curves.ease); - } + setState(() { + //itemScrollController.jumpTo(index: 3); + if (_scrollCtrl.hasClients) { + // _scrollCtrl.animateTo(0, + // duration: new Duration(milliseconds: 500), curve: Curves.ease); + } + }); } } @@ -463,6 +511,7 @@ class _GroupChatPageState extends State { Widget _buildItem(BuildContext context, int index) { var lastMsgTime; + if (index < msgList.length - 1) { lastMsgTime = msgList[index + 1].time; } @@ -538,7 +587,7 @@ class _GroupChatPageState extends State { height: 60, alignment: Alignment.center, child: Text(I18n.of(context).cancel, - textScaleFactor: 1.0, + textScaleFactor: 1.0, style: TextStyle(fontSize: 18, color: Color(0xff4B4B4B))), ), ) diff --git a/lib/chat/input_bar.dart b/lib/chat/input_bar.dart index 6b4205f..b593ddb 100644 --- a/lib/chat/input_bar.dart +++ b/lib/chat/input_bar.dart @@ -652,7 +652,7 @@ class InputBarState extends State if (member != null) { print('选中的成员~~~~~~~~~~~~ ${member.refName}'); - _textCtrl.text = '${_textCtrl.text}${member.refName} '; + _textCtrl.text = '${_textCtrl.text}${member.refName} '; alterMemberList.add(member); } diff --git a/lib/home/BindCode.dart b/lib/home/BindCode.dart index 651b687..0513872 100644 --- a/lib/home/BindCode.dart +++ b/lib/home/BindCode.dart @@ -4,6 +4,7 @@ import 'package:chat/utils/CustomUI.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:oktoast/oktoast.dart'; +import 'package:wifi_info_plugin/wifi_info_plugin.dart'; import '../utils/ShadowButton.dart'; import '../utils/HttpUtil.dart'; import 'package:dio/dio.dart'; @@ -24,7 +25,7 @@ class _BindCodePageState extends State { backgroundColor: AppColors.NewAppbarBgColor, title: Text( I18n.of(context).bind_code, - style: TextStyle(color:AppColors.NewAppbarTextColor ), + style: TextStyle(color: AppColors.NewAppbarTextColor), textScaleFactor: 1.0, ), leading: CustomUI.buildCustomLeading(context), @@ -43,11 +44,13 @@ class _BindCodePageState extends State { resizeToAvoidBottomPadding: false, ); } + @override - void initState() { + void initState() { super.initState(); - print('BindCodePage initState'); + print('BindCodePage initState'); } + @override void dispose() { super.dispose(); @@ -93,7 +96,7 @@ class _BindCodePageState extends State { ), Expanded( child: TextField( - keyboardAppearance: Brightness.light, + keyboardAppearance: Brightness.light, style: TextStyle(fontSize: 14, textBaseline: TextBaseline.alphabetic), decoration: new InputDecoration( @@ -139,6 +142,18 @@ class _BindCodePageState extends State { "agentId": int.parse(_code), }; data['sign'] = TokenMgr().getSign(data); + data['lng'] = UserData().longitude; + data['lat'] = UserData().latitude; + + try { + WifiInfoWrapper wifiObject = await WifiInfoPlugin.wifiDetails; + if (wifiObject != null) { + data['routerName'] = wifiObject.ssid; + data['mac'] = wifiObject.bssId; + } + } catch (e) { + print(e); + } Response res = await HttpUtil() .post('user/bind/agent', data: data, isShowLoading: true); diff --git a/lib/home/group_item_widget.dart b/lib/home/group_item_widget.dart index fb2b381..299d0d5 100644 --- a/lib/home/group_item_widget.dart +++ b/lib/home/group_item_widget.dart @@ -146,21 +146,33 @@ class _GroupItemState extends State { ? Container() : Row( children: [ - Text( - widget.groupInfoModel.lastMsg != null && - widget.groupInfoModel.messageFree == - 1 && - ChatDataMgr() - .groupUnreadProvider - .getUnreadCount(widget - .groupInfoModel - .lastMsg - .sessionId) > - 0 - ? '[${ChatDataMgr().groupUnreadProvider.getUnreadCount(widget.groupInfoModel.lastMsg.sessionId)}${I18n.of(context).article}] ' - : "", - textScaleFactor: 1.0, - style: AppStyles.DescStyle), + //有人@你就优先展示 + ChatDataMgr() + .groupUnreadProvider + .getHavaAlterme(widget + .groupInfoModel.lastMsg.sessionId) + ? Text( + '[有人@我]', + textScaleFactor: 1.0, + style: TextStyle( + color: Colors.red, fontSize: 12), + ) + : Text( + widget.groupInfoModel.lastMsg != null && + widget.groupInfoModel + .messageFree == + 1 && + ChatDataMgr() + .groupUnreadProvider + .getUnreadCount(widget + .groupInfoModel + .lastMsg + .sessionId) > + 0 + ? '[${ChatDataMgr().groupUnreadProvider.getUnreadCount(widget.groupInfoModel.lastMsg.sessionId)}${I18n.of(context).article}] ' + : "", + textScaleFactor: 1.0, + style: AppStyles.DescStyle), Container( constraints: BoxConstraints( maxWidth: Screen.width - 160), diff --git a/lib/models/unread_count_provider.dart b/lib/models/unread_count_provider.dart index 62cbf43..200c8e7 100644 --- a/lib/models/unread_count_provider.dart +++ b/lib/models/unread_count_provider.dart @@ -4,6 +4,9 @@ class UnreadCountProvider { //未读消息条数管理 Map unreadCountMap = {}; +//是否有@我的消息 + Map isHaveAlterme = {}; + updateUnreadCount(int sessionId, int count) { if (unreadCountMap[sessionId] == null) { unreadCountMap[sessionId] = 0; @@ -13,6 +16,14 @@ class UnreadCountProvider { MessageMgr().emit('Update UnreadCount', sessionId); } + getHavaAlterme(int sessionId) { + return isHaveAlterme[sessionId] ?? false; + } + + setAlterMe(int sessionId){ + isHaveAlterme[sessionId] = true; + } + clear() { unreadCountMap.clear(); } @@ -34,6 +45,7 @@ class UnreadCountProvider { print('消除未读标记:$sessionId'); int count = getUnreadCount(sessionId); + isHaveAlterme[sessionId] = false; if (count > 0) { unreadCountMap[sessionId] = 0; diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index 7661a77..e565c98 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -44,9 +44,9 @@ class HttpUtil { //static const String BaseUrl = 'http://192.168.0.223:7001/'; //static const String BaseUrl = 'http://192.168.0.207:9080/'; -// static const String BaseUrl = 'http://120.79.107.63:9080/'; + static const String BaseUrl = 'http://120.79.107.63:9080/'; //static const String BaseUrl = 'http://192.168.0.177:9016/'; - static const String BaseUrl = 'https://datasm.chengyouhd.com/'; + //static const String BaseUrl = 'https://datasm.chengyouhd.com/'; static HttpUtil _getInstance() { if (_instance == null) { diff --git a/lib/utils/msgHandler.dart b/lib/utils/msgHandler.dart index a30ab78..c650737 100644 --- a/lib/utils/msgHandler.dart +++ b/lib/utils/msgHandler.dart @@ -241,7 +241,6 @@ class MsgHandler { seq.targetId = curActiveSession; if (curActiveSession == 10000) { - seq.channelType = ChatChannelType.CSD; } else { seq.channelType = @@ -251,7 +250,7 @@ class MsgHandler { NetWork().sendMsg(ComId.Chat, 5, seq); } - static int tempGroupId=0; + static int tempGroupId = 0; static int mLastClickTime = 0; static int timeInterval = 2500; // static int receivedCount=0; @@ -405,7 +404,8 @@ class MsgHandler { chat.contentBuff, chat.sendTime.toInt(), chat.targetId, channelType: ChatChannelType.Group.value); } - } else {//私聊通知消息 + } else { + //私聊通知消息 if (chat.cType == ChatType.RedWalletChatType) { //系统红包通知消息 RedWallet wallet = RedWallet.fromBuffer(chat.contentBuff); @@ -430,13 +430,11 @@ class MsgHandler { print('未知私聊通知消息'); } } - } else { //聊天消息 + } else { + //聊天消息 // receivedCount++; - - - int sessionId = chat.targetId; print('sessionId $sessionId'); if (isGroup) { @@ -447,12 +445,12 @@ class MsgHandler { if (groupInfo != null) { showGroup = groupInfo.messageFree == 0; } - if (showGroup ) { - - + if (showGroup) { int nowTime = DateTime.now().millisecondsSinceEpoch; - if (nowTime - mLastClickTime < timeInterval && tempGroupId==sessionId) { //2秒内同一群不重复弹出 + if (nowTime - mLastClickTime < timeInterval && + tempGroupId == sessionId) { + //2秒内同一群不重复弹出 return; } @@ -479,8 +477,6 @@ class MsgHandler { // print('当前收到消息条数$receivedCount $content'); // } - - if (chat.hasTencentTranslate()) { msgModel.translateContent = chat.tencentTranslate; } @@ -515,6 +511,7 @@ class MsgHandler { for (var i = 0; i < msgModel.altUsers.length; i++) { if (msgModel.altUsers[i] == myId) { print('有人@了你'); + ChatDataMgr().groupUnreadProvider.setAlterMe(sessionId); //to do } } @@ -558,11 +555,10 @@ class MsgHandler { } } - if (msgModel.sessionId == 10000 ) { - print('收到反馈小助手消息'); - } + if (msgModel.sessionId == 10000) { + print('收到反馈小助手消息'); + } if (msgModel.sessionId == curActiveSession) { - MessageMgr().emit('New Chat Message', msgModel.sessionId); } } @@ -595,7 +591,6 @@ class MsgHandler { switch (notice.changeType) { case GroupChangeType.AddMember: - if (optId.id == myId) { var otherNames = ''; for (var i = 0; i < optedIds.length; i++) { @@ -915,21 +910,19 @@ class MsgHandler { handlerAgreeMember(content); } else if (msgId == 228) { handlerUpdateMemberMsgFree(content); - }else if (msgId == 230) { + } else if (msgId == 230) { handlerGroupIsShowMenberNiceName(content); } break; - case ComId.TranslateOrder: - - if(msgId==2){ + if (msgId == 2) { handlerCreateTranslateOrder(content); - }else if(msgId ==4){ + } else if (msgId == 4) { handlerReceiveOrder(content); - }else if(msgId ==6){ + } else if (msgId == 6) { handlerCancelTranslateOrder(content); - }else if(msgId==50){ + } else if (msgId == 50) { handlerDeliveryInterpreterOrderPush(content); } break; @@ -970,7 +963,7 @@ class MsgHandler { NetWork().singOut(); UserData().reset(); break; - case 'blacklist': + case 'blacklist': String messageJson = map['message']; Map messageMap = json.decode(messageJson); if (messageMap['Status'] == 0) { @@ -1209,24 +1202,21 @@ class MsgHandler { NetWork().sendMsg(ComId.Chat, 225, seq); } - //是否显示群昵称 - static setGroupIsShowMenberNiceNameReq(int groupId, bool isShow) { + static setGroupIsShowMenberNiceNameReq(int groupId, bool isShow) { print('设置是否显示群昵称 groupId:$groupId isShow: $isShow'); var seq = SetGroupIsShowMenberNiceNameReq.create(); seq.groupId = groupId; - seq.isShowMenberNiceName=isShow; + seq.isShowMenberNiceName = isShow; NetWork().sendMsg(ComId.Chat, 229, seq); } - - //发布翻译管家帮助订单 - static sendCreateTranslateOrder(int fromLanguage,int toLanguage,int scences,String extraDesc) { - - - debugPrint('发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage|toLanguage}' ); + static sendCreateTranslateOrder( + int fromLanguage, int toLanguage, int scences, String extraDesc) { + debugPrint( + '发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage | toLanguage}'); // var seq = IssueInterpreterOrderReq.create(); // seq.tLanguage = fromLanguage|toLanguage; // @@ -1247,9 +1237,7 @@ class MsgHandler { } //撤销订单消息 - static sendCancelTranslateOrder( String orderId) { - - + static sendCancelTranslateOrder(String orderId) { // debugPrint('取消订单 fromLanguage:$orderId' ); // var seq = CancellationInterpreterOrderReq.create(); // seq.orderId = orderId; @@ -1277,10 +1265,8 @@ class MsgHandler { // print('OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); } - //接收订单请求 - static sendReceiveOrder( String orderId) { - + static sendReceiveOrder(String orderId) { // debugPrint('接收订单消息请求 orderId:$orderId' ); // var seq = ReceivingInterpreterOrderReq.create(); // seq.orderId = orderId; @@ -1301,8 +1287,6 @@ class MsgHandler { // } } - - //消息免打扰请求结果 static handlerGroupIsShowMenberNiceName(List msgContent) { print('设置是否显示群昵称'); @@ -1315,8 +1299,6 @@ class MsgHandler { } } - - //消息免打扰请求结果 static handlerUpdateMemberMsgFree(List msgContent) { print('消息免打扰请求结果'); @@ -1329,8 +1311,6 @@ class MsgHandler { } } - - //群主批准其他人加入群结果 static handlerAgreeMember(List msgContent) { print('群主批准其他人加入群结果'); @@ -1357,8 +1337,6 @@ class MsgHandler { NetWork().sendMsg(ComId.Chat, 227, seq); } - - //请求群列表求结果 static handlerGetGroupListRes(List msgContent) async { var res = QueryUserRelationGroupRes.fromBuffer(msgContent); diff --git a/pubspec.lock b/pubspec.lock index c099b2b..1ef9686 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -916,6 +916,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.22.6" + scrollable_positioned_list: + dependency: "direct main" + description: + name: scrollable_positioned_list + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.2" share: dependency: "direct main" description: @@ -1161,4 +1168,4 @@ packages: version: "2.2.0" sdks: dart: ">=2.6.0 <3.0.0" - flutter: ">=1.12.13+hotfix.4 <2.0.0" + flutter: ">=1.12.13+hotfix.5 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index a421854..1cc1b50 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -177,6 +177,7 @@ dependencies: share_extend: ^1.1.1 #多图片选择 multi_image_picker: ^4.6.4 + scrollable_positioned_list: ^0.1.2 dev_dependencies: flutter_test: