@@ -1 +1 @@ | |||||
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"agora_rtc_engine","dependencies":[]},{"name":"amap_location","dependencies":[]},{"name":"android_intent","dependencies":[]},{"name":"app_installer","dependencies":[]},{"name":"apple_sign_in","dependencies":[]},{"name":"audioplayer","dependencies":[]},{"name":"auto_orientation","dependencies":[]},{"name":"city_pickers","dependencies":[]},{"name":"connectivity","dependencies":[]},{"name":"device_info","dependencies":[]},{"name":"easy_contact_picker","dependencies":[]},{"name":"file_picker","dependencies":[]},{"name":"flutter_app_badger","dependencies":[]},{"name":"flutter_audio_recorder","dependencies":[]},{"name":"flutter_bugly","dependencies":[]},{"name":"flutter_facebook_login","dependencies":[]},{"name":"flutter_ijkplayer","dependencies":[]},{"name":"flutter_inapp_purchase","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_native_image","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_qr_reader","dependencies":["image_picker"]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"fluwx_no_pay","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":[]},{"name":"image_cropper","dependencies":[]},{"name":"image_gallery_saver","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"jpush_flutter","dependencies":[]},{"name":"keyboard_utils","dependencies":[]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"multi_image_picker","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"photo_manager","dependencies":[]},{"name":"receive_sharing_intent","dependencies":[]},{"name":"share","dependencies":[]},{"name":"share_extend","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":[]},{"name":"video_player","dependencies":[]},{"name":"video_thumbnail","dependencies":[]},{"name":"wifi_info_plugin","dependencies":[]}]} | |||||
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"agora_rtc_engine","dependencies":[]},{"name":"amap_location","dependencies":[]},{"name":"android_intent","dependencies":[]},{"name":"app_installer","dependencies":[]},{"name":"apple_sign_in","dependencies":[]},{"name":"audioplayer","dependencies":[]},{"name":"auto_orientation","dependencies":[]},{"name":"city_pickers","dependencies":[]},{"name":"connectivity","dependencies":[]},{"name":"device_info","dependencies":[]},{"name":"easy_contact_picker","dependencies":[]},{"name":"file_picker","dependencies":[]},{"name":"flutter_app_badger","dependencies":[]},{"name":"flutter_audio_recorder","dependencies":[]},{"name":"flutter_bugly","dependencies":[]},{"name":"flutter_facebook_login","dependencies":[]},{"name":"flutter_ijkplayer","dependencies":[]},{"name":"flutter_inapp_purchase","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_native_image","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_qr_reader","dependencies":["image_picker"]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"fluwx_no_pay","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":[]},{"name":"image_cropper","dependencies":[]},{"name":"image_gallery_saver","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"jpush_flutter","dependencies":[]},{"name":"keyboard_utils","dependencies":[]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"multi_image_picker","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"photo_manager","dependencies":[]},{"name":"receive_sharing_intent","dependencies":[]},{"name":"share","dependencies":[]},{"name":"share_extend","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":[]},{"name":"vibration","dependencies":[]},{"name":"video_player","dependencies":[]},{"name":"video_thumbnail","dependencies":[]},{"name":"wifi_info_plugin","dependencies":[]}]} |
@@ -21,6 +21,9 @@ | |||||
<uses-feature android:name="android.hardware.location.network" android:required="false" /> | <uses-feature android:name="android.hardware.location.network" android:required="false" /> | ||||
<uses-feature android:name="android.hardware.location.gps" android:required="false" /> | <uses-feature android:name="android.hardware.location.gps" android:required="false" /> | ||||
<!-- 震动 --> | |||||
<uses-permission android:name="android.permission.VIBRATE"/> | |||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that | <!-- io.flutter.app.FlutterApplication is an android.app.Application that | ||||
calls FlutterMain.startInitialization(this); in its onCreate method. | calls FlutterMain.startInitialization(this); in its onCreate method. | ||||
@@ -1219,14 +1219,14 @@ | |||||
"translation_input_limit": "/s1 words can also be input", | "translation_input_limit": "/s1 words can also be input", | ||||
"translation_more_desc": "More descriptions", | "translation_more_desc": "More descriptions", | ||||
"feedback_assistant": "Feedback helper", | "feedback_assistant": "Feedback helper", | ||||
"feedback_tips":"You can give me feedback in case of any questions", | |||||
"man_retranslate":"人工重译", | |||||
"robot_retranslate":"机器重译", | |||||
"see_original":"查看原文", | |||||
"forward":"Forward", | |||||
"copy_download_url":"复制下载地址", | |||||
"total_friends_nus":"共/s1位朋友", | |||||
"hava_error_photo":"有图片违规", | |||||
"feedback_tips": "You can give me feedback in case of any questions", | |||||
"man_retranslate": "人工重译", | |||||
"robot_retranslate": "机器重译", | |||||
"see_original": "查看原文", | |||||
"forward": "Forward", | |||||
"copy_download_url": "复制下载地址", | |||||
"total_friends_nus": "共/s1位朋友", | |||||
"hava_error_photo": "有图片违规", | |||||
"translation_butler_evaluation_tips2": "翻译服务已结束,辛苦你了。请保持在线,留意新订单通知", | "translation_butler_evaluation_tips2": "翻译服务已结束,辛苦你了。请保持在线,留意新订单通知", | ||||
"translation_butler_push_order_time": "时间:今天/s1 时长:", | "translation_butler_push_order_time": "时间:今天/s1 时长:", | ||||
"translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | "translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | ||||
@@ -1239,6 +1239,6 @@ | |||||
"translation_butler_last_item_end": "[翻译管家服务结束]", | "translation_butler_last_item_end": "[翻译管家服务结束]", | ||||
"travel_start": "起点", | "travel_start": "起点", | ||||
"travel_end": "终点", | "travel_end": "终点", | ||||
"translation_butler_order_time_out": "翻译订单超时已被取消" | |||||
"translation_butler_order_time_out": "翻译订单超时已被取消", | |||||
"shock_notice": "震动通知" | |||||
} | } |
@@ -1219,14 +1219,14 @@ | |||||
"translation_input_limit": " /s1と入力することができます", | "translation_input_limit": " /s1と入力することができます", | ||||
"translation_more_desc": "詳細説明", | "translation_more_desc": "詳細説明", | ||||
"feedback_assistant": "フィードバックアシスタント", | "feedback_assistant": "フィードバックアシスタント", | ||||
"feedback_tips":"どんな問題があってもフィードバックしてください", | |||||
"man_retranslate":"人工重译", | |||||
"robot_retranslate":"机器重译", | |||||
"see_original":"查看原文", | |||||
"forward":"转发", | |||||
"copy_download_url":"复制下载地址", | |||||
"total_friends_nus":"共/s1位朋友", | |||||
"hava_error_photo":"有图片违规", | |||||
"feedback_tips": "どんな問題があってもフィードバックしてください", | |||||
"man_retranslate": "人工重译", | |||||
"robot_retranslate": "机器重译", | |||||
"see_original": "查看原文", | |||||
"forward": "转发", | |||||
"copy_download_url": "复制下载地址", | |||||
"total_friends_nus": "共/s1位朋友", | |||||
"hava_error_photo": "有图片违规", | |||||
"translation_butler_push_order_time": "时间:今天/s1 时长:", | "translation_butler_push_order_time": "时间:今天/s1 时长:", | ||||
"translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | "translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | ||||
"translation_butler_title3": "大神专属", | "translation_butler_title3": "大神专属", | ||||
@@ -1238,6 +1238,6 @@ | |||||
"translation_butler_last_item_end": "[翻译管家服务结束]", | "translation_butler_last_item_end": "[翻译管家服务结束]", | ||||
"travel_start": "起点", | "travel_start": "起点", | ||||
"travel_end": "终点", | "travel_end": "终点", | ||||
"translation_butler_order_time_out": "翻译订单超时已被取消" | |||||
"translation_butler_order_time_out": "翻译订单超时已被取消", | |||||
"shock_notice": "震动通知" | |||||
} | } |
@@ -1219,14 +1219,14 @@ | |||||
"translation_input_limit": "/s1자도 입력할 수 있다.", | "translation_input_limit": "/s1자도 입력할 수 있다.", | ||||
"translation_more_desc": "더 많은 묘사", | "translation_more_desc": "더 많은 묘사", | ||||
"feedback_assistant": " 피드백 팁", | "feedback_assistant": " 피드백 팁", | ||||
"feedback_tips":"어떤 문제라도 피드백해 주세요.", | |||||
"man_retranslate":"人工重译", | |||||
"robot_retranslate":"机器重译", | |||||
"see_original":"查看原文", | |||||
"forward":"转发", | |||||
"copy_download_url":"复制下载地址", | |||||
"total_friends_nus":"共/s1位朋友", | |||||
"hava_error_photo":"有图片违规", | |||||
"feedback_tips": "어떤 문제라도 피드백해 주세요.", | |||||
"man_retranslate": "人工重译", | |||||
"robot_retranslate": "机器重译", | |||||
"see_original": "查看原文", | |||||
"forward": "转发", | |||||
"copy_download_url": "复制下载地址", | |||||
"total_friends_nus": "共/s1位朋友", | |||||
"hava_error_photo": "有图片违规", | |||||
"translation_butler_evaluation_tips2": "翻译服务已结束,辛苦你了。请保持在线,留意新订单通知", | "translation_butler_evaluation_tips2": "翻译服务已结束,辛苦你了。请保持在线,留意新订单通知", | ||||
"translation_butler_push_order_time": "时间:今天/s1 时长:", | "translation_butler_push_order_time": "时间:今天/s1 时长:", | ||||
"translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | "translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | ||||
@@ -1239,6 +1239,6 @@ | |||||
"translation_butler_last_item_end": "[翻译管家服务结束]", | "translation_butler_last_item_end": "[翻译管家服务结束]", | ||||
"travel_start": "起点", | "travel_start": "起点", | ||||
"travel_end": "终点", | "travel_end": "终点", | ||||
"translation_butler_order_time_out": "翻译订单超时已被取消" | |||||
"translation_butler_order_time_out": "翻译订单超时已被取消", | |||||
"shock_notice": "震动通知" | |||||
} | } |
@@ -1225,8 +1225,8 @@ | |||||
"see_original": "查看原文", | "see_original": "查看原文", | ||||
"forward": "转发", | "forward": "转发", | ||||
"copy_download_url": "复制下载地址", | "copy_download_url": "复制下载地址", | ||||
"total_friends_nus":"共/s1位朋友", | |||||
"hava_error_photo":"有图片违规", | |||||
"total_friends_nus": "共/s1位朋友", | |||||
"hava_error_photo": "有图片违规", | |||||
"translation_butler_push_order_time": "时间:今天/s1 时长:", | "translation_butler_push_order_time": "时间:今天/s1 时长:", | ||||
"translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | "translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | ||||
"translation_butler_title3": "大神专属", | "translation_butler_title3": "大神专属", | ||||
@@ -1238,6 +1238,6 @@ | |||||
"translation_butler_last_item_end": "[翻译管家服务结束]", | "translation_butler_last_item_end": "[翻译管家服务结束]", | ||||
"travel_start": "起点", | "travel_start": "起点", | ||||
"travel_end": "终点", | "travel_end": "终点", | ||||
"translation_butler_order_time_out": "翻译订单超时已被取消" | |||||
"translation_butler_order_time_out": "翻译订单超时已被取消", | |||||
"shock_notice": "震动通知" | |||||
} | } |
@@ -1239,6 +1239,6 @@ | |||||
"translation_butler_last_item_end": "[翻译管家服务结束]", | "translation_butler_last_item_end": "[翻译管家服务结束]", | ||||
"travel_start": "起点", | "travel_start": "起点", | ||||
"travel_end": "终点", | "travel_end": "终点", | ||||
"translation_butler_order_time_out": "翻译订单超时已被取消" | |||||
"translation_butler_order_time_out": "翻译订单超时已被取消", | |||||
"shock_notice":"震动通知" | |||||
} | } |
@@ -1219,14 +1219,14 @@ | |||||
"translation_input_limit": "还可以输入/s1字", | "translation_input_limit": "还可以输入/s1字", | ||||
"translation_more_desc": "更多描述", | "translation_more_desc": "更多描述", | ||||
"feedback_assistant": "反饋小助手", | "feedback_assistant": "反饋小助手", | ||||
"feedback_tips":"有什麼問題都可以反饋給我哦", | |||||
"man_retranslate":"人工重譯", | |||||
"robot_retranslate":"機器重譯", | |||||
"see_original":"查看原文", | |||||
"forward":"转发", | |||||
"copy_download_url":"複製下載地址", | |||||
"total_friends_nus":"共/s1位朋友", | |||||
"hava_error_photo":"有圖片違規", | |||||
"feedback_tips": "有什麼問題都可以反饋給我哦", | |||||
"man_retranslate": "人工重譯", | |||||
"robot_retranslate": "機器重譯", | |||||
"see_original": "查看原文", | |||||
"forward": "转发", | |||||
"copy_download_url": "複製下載地址", | |||||
"total_friends_nus": "共/s1位朋友", | |||||
"hava_error_photo": "有圖片違規", | |||||
"translation_butler_push_order_time": "时间:今天/s1 时长:", | "translation_butler_push_order_time": "时间:今天/s1 时长:", | ||||
"translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | "translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", | ||||
"translation_butler_title3": "大神专属", | "translation_butler_title3": "大神专属", | ||||
@@ -1238,6 +1238,6 @@ | |||||
"translation_butler_last_item_end": "[翻译管家服务结束]", | "translation_butler_last_item_end": "[翻译管家服务结束]", | ||||
"travel_start": "起点", | "travel_start": "起点", | ||||
"travel_end": "终点", | "travel_end": "终点", | ||||
"translation_butler_order_time_out": "翻译订单超时已被取消" | |||||
"translation_butler_order_time_out": "翻译订单超时已被取消", | |||||
"shock_notice": "震動通知" | |||||
} | } |
@@ -121,7 +121,7 @@ class _ChatPageState extends State<ChatPage> { | |||||
jumIndex = msgList.length - 1; | jumIndex = msgList.length - 1; | ||||
} | } | ||||
await controller.scrollToIndex(jumIndex, | await controller.scrollToIndex(jumIndex, | ||||
preferPosition: AutoScrollPosition.begin); | |||||
preferPosition: AutoScrollPosition.middle); | |||||
controller.highlight(jumIndex, | controller.highlight(jumIndex, | ||||
highlightDuration: new Duration(milliseconds: 100)); | highlightDuration: new Duration(milliseconds: 100)); | ||||
} | } | ||||
@@ -160,8 +160,8 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
showTimeStr = | showTimeStr = | ||||
DateUtils().getFormartData(timeSamp: sendTime, format: 'HH:mm'); | DateUtils().getFormartData(timeSamp: sendTime, format: 'HH:mm'); | ||||
} else { | } else { | ||||
showTimeStr = DateUtils() | |||||
.getFormartData(timeSamp: sendTime, format: 'yyyy/MM/dd HH:mm'); | |||||
showTimeStr = | |||||
DateUtils().getFormartData(timeSamp: sendTime, format: 'MM/dd HH:mm'); | |||||
} | } | ||||
return showTimeStr; | return showTimeStr; | ||||
@@ -190,7 +190,7 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
return Container( | return Container( | ||||
width: Screen.width, | width: Screen.width, | ||||
margin: const EdgeInsets.symmetric(vertical: 10.0,horizontal: 8), | |||||
margin: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 8), | |||||
child: Column( | child: Column( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
showTime == null | showTime == null | ||||
@@ -261,16 +261,18 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
///todo 翻译管家系统通知消息 | ///todo 翻译管家系统通知消息 | ||||
print('这里应该要有翻译管家'); | print('这里应该要有翻译管家'); | ||||
if (type == ChatType.GroupChatNoticeType.value && widget.msg.channelType ==ChatChannelType.Session.value) { | |||||
TransHKChatNotice res = TransHKChatNotice.fromBuffer(widget.msg.msgContent); | |||||
if (type == ChatType.GroupChatNoticeType.value && | |||||
widget.msg.channelType == ChatChannelType.Session.value) { | |||||
TransHKChatNotice res = | |||||
TransHKChatNotice.fromBuffer(widget.msg.msgContent); | |||||
if(res.noticeType==TransHKChatNoticeType.StartChat){ | |||||
if (res.noticeType == TransHKChatNoticeType.StartChat) { | |||||
///开始翻译服务 | ///开始翻译服务 | ||||
return _buildServiceCard(true, () {}); | return _buildServiceCard(true, () {}); | ||||
}else if(res.noticeType==TransHKChatNoticeType.EndChat){ | |||||
} else if (res.noticeType == TransHKChatNoticeType.EndChat) { | |||||
///翻译服务结束 | ///翻译服务结束 | ||||
return _buildServiceCard(false, () {}); | return _buildServiceCard(false, () {}); | ||||
}else{ | |||||
} else { | |||||
return Container(); | return Container(); | ||||
} | } | ||||
// return Container(); | // return Container(); | ||||
@@ -295,8 +297,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
// } | // } | ||||
// } | // } | ||||
} | } | ||||
return Container(); | return Container(); | ||||
} | } | ||||
@@ -314,6 +314,101 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
); | ); | ||||
} | } | ||||
double getQuoteContentWidth(QuoteMsg quoteMsg, String refName, | |||||
String showTimeStr, String quoteContent) { | |||||
double width; | |||||
var timetWidth = CustomUI.getRealTextWidht(showTimeStr, 13); | |||||
var nameWidhth = CustomUI.getRealTextWidht(refName, 13); | |||||
width = timetWidth + (nameWidhth > 70 ? 70 : nameWidhth) + 59; | |||||
var contentWidht = _getTextWidth(quoteContent, fontSize: 13); | |||||
return min(max(width, contentWidht), maxWidth); | |||||
} | |||||
Widget getQuoteContent(QuoteMsg quoteMsg, String refName, String showTimeStr, | |||||
String quoteContent, bool isSend) { | |||||
var strColor; | |||||
var bgColor; | |||||
if (isSend) { | |||||
strColor = const Color(0xFF24343C); | |||||
bgColor = const Color(0xFFC4E0F5); | |||||
} else { | |||||
strColor = const Color(0xFF515151); | |||||
bgColor = const Color(0xFFEBEBEC); | |||||
} | |||||
return Container( | |||||
padding: EdgeInsets.only(left: 8, bottom: 8), | |||||
margin: EdgeInsets.only(bottom: 5, top: 2), | |||||
decoration: | |||||
BoxDecoration(color: bgColor, borderRadius: BorderRadius.circular(7)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Row(children: <Widget>[ | |||||
Container( | |||||
constraints: BoxConstraints(maxWidth: 70), | |||||
child: Text( | |||||
refName, | |||||
style: TextStyle(fontSize: 13, color: strColor), | |||||
overflow: TextOverflow.ellipsis, | |||||
)), | |||||
SizedBox(width: 10), | |||||
Text( | |||||
showTimeStr, | |||||
style: TextStyle(fontSize: 13, color: strColor), | |||||
), | |||||
Expanded(child: SizedBox()), | |||||
InkWell( | |||||
onTap: () { | |||||
MessageMgr().emit('Jump to Msg', quoteMsg.sendTime.toInt()); | |||||
}, | |||||
child: Container( | |||||
alignment: Alignment.center, | |||||
height: 27, | |||||
padding: EdgeInsets.only( | |||||
left: 10, | |||||
right: 10, | |||||
), | |||||
child: Icon( | |||||
IconData(0xe67e, fontFamily: Constants.IconFontFamily), | |||||
size: 13, | |||||
color: strColor, | |||||
))) | |||||
]), | |||||
Padding( | |||||
padding: EdgeInsets.only(right: 8), | |||||
child: Text( | |||||
quoteContent, | |||||
style: TextStyle(fontSize: 13, color: strColor), | |||||
), | |||||
), | |||||
], | |||||
), | |||||
); | |||||
} | |||||
Map getQuoteItem() { | |||||
QuoteMsg quoteMsg = QuoteMsg.fromBuffer(widget.msg.refMsgContent); | |||||
var refName = Provider.of<RefNameProvider>(context) | |||||
.getRefName(friendInfo.userId, friendInfo.nickName); | |||||
var msgDate = | |||||
DateTime.fromMillisecondsSinceEpoch(quoteMsg.sendTime.toInt()); | |||||
var showTimeStr = | |||||
getTodayTime(msgDate, sendTime: quoteMsg.sendTime.toInt()); | |||||
var tempIndex = quoteMsg.content.indexOf(':'); | |||||
var quoteContent = tempIndex == -1 | |||||
? quoteMsg.content | |||||
: quoteMsg.content.substring(quoteMsg.content.indexOf(':') + 2); | |||||
return { | |||||
"quoteMsg": quoteMsg, | |||||
"refName": refName, | |||||
"showTimeStr": showTimeStr, | |||||
"quoteContent": quoteContent, | |||||
}; | |||||
} | |||||
_textMsg(List<int> msgContent) { | _textMsg(List<int> msgContent) { | ||||
List<Widget> showMsg = []; | List<Widget> showMsg = []; | ||||
var width = 0.0; | var width = 0.0; | ||||
@@ -331,57 +426,12 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
if (widget.msg.refMsgContent != null && | if (widget.msg.refMsgContent != null && | ||||
widget.msg.refMsgContent.length > 0) { | widget.msg.refMsgContent.length > 0) { | ||||
QuoteMsg quoteMsg = QuoteMsg.fromBuffer(widget.msg.refMsgContent); | |||||
var refName = Provider.of<RefNameProvider>(context) | |||||
.getRefName(friendInfo.userId, friendInfo.nickName); | |||||
var msgDate = | |||||
DateTime.fromMillisecondsSinceEpoch(quoteMsg.sendTime.toInt()); | |||||
var showTimeStr = getTodayTime(msgDate, sendTime: quoteMsg.sendTime.toInt()); | |||||
var timetWidth = CustomUI.getRealTextWidht(showTimeStr, 13); | |||||
var nameWidhth = CustomUI.getRealTextWidht(refName, 13); | |||||
width = timetWidth + (nameWidhth > 70 ? 70 : nameWidhth) + 36; | |||||
var tempIndex = quoteMsg.content.indexOf(':'); | |||||
var quoteContent = tempIndex == -1 | |||||
? quoteMsg.content | |||||
: quoteMsg.content.substring(quoteMsg.content.indexOf(':') + 2); | |||||
var contentWidht = _getTextWidth(quoteContent, fontSize: 13); | |||||
width = min(max(width, contentWidht), maxWidth); | |||||
showMsg.add(InkWell( | |||||
onTap: () { | |||||
MessageMgr().emit('Jump to Msg', quoteMsg.sendTime.toInt()); | |||||
}, | |||||
child: Container( | |||||
padding: EdgeInsets.all(8), | |||||
margin: EdgeInsets.only(bottom: 5), | |||||
decoration: BoxDecoration( | |||||
color: Color(0xFFC4E0F5), | |||||
borderRadius: BorderRadius.circular(5.5)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Row(children: <Widget>[ | |||||
Container( | |||||
constraints: BoxConstraints(maxWidth: 70), | |||||
child: Text( | |||||
refName, | |||||
style: TextStyle(fontSize: 13), | |||||
overflow: TextOverflow.ellipsis, | |||||
)), | |||||
SizedBox(width: 20), | |||||
Text( | |||||
showTimeStr, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
]), | |||||
SizedBox(height: 7.5), | |||||
Text( | |||||
quoteContent, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
], | |||||
), | |||||
))); | |||||
var quoteItem = getQuoteItem(); | |||||
width = getQuoteContentWidth(quoteItem['quoteMsg'], quoteItem['refName'], | |||||
quoteItem['showTimeStr'], quoteItem['quoteContent']); | |||||
showMsg.add(getQuoteContent(quoteItem['quoteMsg'], quoteItem['refName'], | |||||
quoteItem['showTimeStr'], quoteItem['quoteContent'], true)); | |||||
} | } | ||||
var contentWidth = _getTextWidth(textList[curTextType]); | var contentWidth = _getTextWidth(textList[curTextType]); | ||||
if (contentWidth > width && contentWidth <= maxWidth) { | if (contentWidth > width && contentWidth <= maxWidth) { | ||||
@@ -700,7 +750,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
List<String> actions = [ | List<String> actions = [ | ||||
I18n.of(context).delete, | I18n.of(context).delete, | ||||
I18n.of(context).reply, | I18n.of(context).reply, | ||||
]; | ]; | ||||
actionsFunc.add(() { | actionsFunc.add(() { | ||||
@@ -711,7 +760,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
MessageMgr().emit('Reply Select Message', widget.msg); | MessageMgr().emit('Reply Select Message', widget.msg); | ||||
}); | }); | ||||
///转发 | ///转发 | ||||
if (widget.msg.msgType == ChatType.TextChatType.value || | if (widget.msg.msgType == ChatType.TextChatType.value || | ||||
widget.msg.msgType == ChatType.ImageChatType.value || | widget.msg.msgType == ChatType.ImageChatType.value || | ||||
@@ -753,10 +801,7 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
} | } | ||||
ShareExtend.share(FileCacheMgr.replacePath(path), type); | ShareExtend.share(FileCacheMgr.replacePath(path), type); | ||||
}); | }); | ||||
} | } | ||||
if (widget.msg.msgType == ChatType.TextChatType.value) { | if (widget.msg.msgType == ChatType.TextChatType.value) { | ||||
@@ -868,58 +913,17 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
isUrl = true; | isUrl = true; | ||||
} | } | ||||
if (msg.refMsgContent != null && msg.refMsgContent.length > 0) { | |||||
QuoteMsg quoteMsg = QuoteMsg.fromBuffer(msg.refMsgContent); | |||||
var refName = Provider.of<RefNameProvider>(context) | |||||
.getGroupRefName(msg.sessionId, quoteMsg.sendUserId); | |||||
var msgDate = | |||||
DateTime.fromMillisecondsSinceEpoch(quoteMsg.sendTime.toInt()); | |||||
var showTimeStr = getTodayTime(msgDate, sendTime: quoteMsg.sendTime.toInt()); | |||||
var timetWidth = CustomUI.getRealTextWidht(showTimeStr, 13); | |||||
var nameWidhth = CustomUI.getRealTextWidht(refName, 13); | |||||
width = timetWidth + (nameWidhth > 70 ? 70 : nameWidhth) + 36; | |||||
var quoteContent = | |||||
quoteMsg.content.substring(quoteMsg.content.indexOf(':') + 2); | |||||
var contentWidht = _getTextWidth(quoteContent, fontSize: 13); | |||||
width = min(max(width, contentWidht), maxWidth); | |||||
showMsg.add(InkWell( | |||||
onTap: () { | |||||
MessageMgr().emit('Jump to Msg', quoteMsg.sendTime.toInt()); | |||||
}, | |||||
child: Container( | |||||
padding: EdgeInsets.all(8), | |||||
margin: EdgeInsets.only(bottom: 5), | |||||
decoration: BoxDecoration( | |||||
color: Color(0xFFC4E0F5), | |||||
borderRadius: BorderRadius.circular(5.5)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Row(children: <Widget>[ | |||||
Container( | |||||
constraints: BoxConstraints(maxWidth: 70), | |||||
child: Text( | |||||
refName, | |||||
style: TextStyle(fontSize: 13), | |||||
overflow: TextOverflow.ellipsis, | |||||
)), | |||||
SizedBox(width: 20), | |||||
Text( | |||||
showTimeStr, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
]), | |||||
SizedBox(height: 7.5), | |||||
Text( | |||||
quoteContent, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
], | |||||
), | |||||
))); | |||||
if (widget.msg.refMsgContent != null && | |||||
widget.msg.refMsgContent.length > 0) { | |||||
var quoteItem = getQuoteItem(); | |||||
width = getQuoteContentWidth( | |||||
quoteItem['quoteMsg'], | |||||
quoteItem['refName'], | |||||
quoteItem['showTimeStr'], | |||||
quoteItem['quoteContent']); | |||||
showMsg.add(getQuoteContent(quoteItem['quoteMsg'], quoteItem['refName'], | |||||
quoteItem['showTimeStr'], quoteItem['quoteContent'], false)); | |||||
} | } | ||||
var contentWidth = _getTextWidth(textList[curTextType]); | var contentWidth = _getTextWidth(textList[curTextType]); | ||||
@@ -927,28 +931,15 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
width = contentWidth; | width = contentWidth; | ||||
} | } | ||||
showMsg.add(InkWell( | |||||
onTap: () { | |||||
if (msg.transTag == 1) { | |||||
return; | |||||
} | |||||
if (msg.transTag == 2 || msg.transTag == 3) { | |||||
setState(() { | |||||
curTextType += 1; | |||||
curTextType %= textList.length; | |||||
}); | |||||
return; | |||||
} | |||||
}, | |||||
child: Container( | |||||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||||
alignment: Alignment.centerLeft, | |||||
child: extendedText( | |||||
textList[curTextType], | |||||
color: isUrl ? Colors.blue : Constants.BlackTextColor, | |||||
hideKeyboard: widget.hideKeyboard, | |||||
fontSize: FontSize, | |||||
)))); | |||||
showMsg.add(Container( | |||||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||||
alignment: Alignment.centerLeft, | |||||
child: extendedText( | |||||
textList[curTextType], | |||||
color: isUrl ? Colors.blue : Constants.BlackTextColor, | |||||
hideKeyboard: widget.hideKeyboard, | |||||
fontSize: FontSize, | |||||
))); | |||||
} | } | ||||
var minWidth = width + 20; | var minWidth = width + 20; | ||||
@@ -989,11 +980,26 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
: Container() | : Container() | ||||
]); | ]); | ||||
return text; | |||||
return InkWell( | |||||
child: text, | |||||
onTap: () { | |||||
MessageMgr().emit('Keyboard Hide'); | |||||
if (msg.transTag == 1) { | |||||
return; | |||||
} | |||||
if (msg.transTag == 2 || msg.transTag == 3) { | |||||
setState(() { | |||||
curTextType += 1; | |||||
curTextType %= textList.length; | |||||
}); | |||||
return; | |||||
} | |||||
}, | |||||
); | |||||
} | } | ||||
_translateItemWidget(int code, String title, Function onTap) { | _translateItemWidget(int code, String title, Function onTap) { | ||||
Color color = onTap == null ? Constants.GreyTextColor : Color(0xFF087FF3); | |||||
Color color = onTap == null ? Color(0xFFC5C5C5) : Color(0xFF6A6A6A); | |||||
return InkWell( | return InkWell( | ||||
onTap: onTap, | onTap: onTap, | ||||
splashColor: Colors.red, | splashColor: Colors.red, | ||||
@@ -1192,7 +1198,6 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
), | ), | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
_receiveVideo(BuildContext context, List<int> imgData, | _receiveVideo(BuildContext context, List<int> imgData, | ||||
@@ -1440,8 +1445,8 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
shape: BoxShape.circle, | shape: BoxShape.circle, | ||||
color: isShow ? Color(0xFFFF7E00) : Color(0xFFCFCFCF), | color: isShow ? Color(0xFFFF7E00) : Color(0xFFCFCFCF), | ||||
), | ), | ||||
width: 6, | |||||
height: 6, | |||||
width: 4, | |||||
height: 4, | |||||
); | ); | ||||
} | } | ||||
@@ -1542,13 +1547,11 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
]); | ]); | ||||
} | } | ||||
Widget _buildServiceCard(bool isStart, Function callBack) { | Widget _buildServiceCard(bool isStart, Function callBack) { | ||||
String endStr = UserData().isTranslateUser?I18n.of(context).translation_butler_evaluation_tips2:I18n.of(context).translation_butler_evaluation_tips; | |||||
String endStr = UserData().isTranslateUser | |||||
? I18n.of(context).translation_butler_evaluation_tips2 | |||||
: I18n.of(context).translation_butler_evaluation_tips; | |||||
return Container( | return Container( | ||||
alignment: Alignment.center, | alignment: Alignment.center, | ||||
margin: EdgeInsets.all(10), | margin: EdgeInsets.all(10), | ||||
child: Card( | child: Card( | ||||
@@ -1562,52 +1565,53 @@ class _ChatPageItemState extends State<ChatPageItem> | |||||
padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 15), | padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 15), | ||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Expanded(child: Container( child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Text( | |||||
isStart | |||||
? I18n.of(context).translation_butler_start_service | |||||
: I18n.of(context).translation_butler_service_end, | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle( | |||||
color: AppColors.NewAppbarTextColor, fontSize: 15), | |||||
), | |||||
Text( | |||||
isStart | |||||
? I18n.of(context).translation_butler_start_tips | |||||
: endStr, | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle( | |||||
color: Color(0xFF797979), fontSize: 13), | |||||
), | |||||
], | |||||
),)), | |||||
(isStart||UserData().isTranslateUser) | |||||
Expanded( | |||||
child: Container( | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Text( | |||||
isStart | |||||
? I18n.of(context).translation_butler_start_service | |||||
: I18n.of(context).translation_butler_service_end, | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle( | |||||
color: AppColors.NewAppbarTextColor, fontSize: 15), | |||||
), | |||||
Text( | |||||
isStart | |||||
? I18n.of(context).translation_butler_start_tips | |||||
: endStr, | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle(color: Color(0xFF797979), fontSize: 13), | |||||
), | |||||
], | |||||
), | |||||
)), | |||||
(isStart || UserData().isTranslateUser) | |||||
? Container() | ? Container() | ||||
: Expanded( | : Expanded( | ||||
child: Container( | |||||
margin: EdgeInsets.only(left: 15), | |||||
height: 30, | |||||
child: RaisedButton( | |||||
color: Color(0xff3875E9), | |||||
shape: RoundedRectangleBorder( | |||||
borderRadius: | |||||
BorderRadius.all(Radius.circular(10))), | |||||
child: Text( | |||||
I18n.of(context).translation_butler_evaluation, | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle(color: Colors.white, fontSize: 15), | |||||
), | |||||
onPressed: () { | |||||
CustomUI.buildTranslationEvaluationDialog(context); | |||||
}), | |||||
)), | |||||
child: Container( | |||||
margin: EdgeInsets.only(left: 15), | |||||
height: 30, | |||||
child: RaisedButton( | |||||
color: Color(0xff3875E9), | |||||
shape: RoundedRectangleBorder( | |||||
borderRadius: | |||||
BorderRadius.all(Radius.circular(10))), | |||||
child: Text( | |||||
I18n.of(context).translation_butler_evaluation, | |||||
textScaleFactor: 1.0, | |||||
style: TextStyle(color: Colors.white, fontSize: 15), | |||||
), | |||||
onPressed: () { | |||||
CustomUI.buildTranslationEvaluationDialog(context); | |||||
}), | |||||
)), | |||||
], | ], | ||||
), | ), | ||||
), | ), | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
} | } |
@@ -158,8 +158,8 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
showTimeStr = | showTimeStr = | ||||
DateUtils().getFormartData(timeSamp: sendTime, format: 'HH:mm'); | DateUtils().getFormartData(timeSamp: sendTime, format: 'HH:mm'); | ||||
} else { | } else { | ||||
showTimeStr = DateUtils() | |||||
.getFormartData(timeSamp: sendTime, format: 'yyyy/MM/dd HH:mm'); | |||||
showTimeStr = | |||||
DateUtils().getFormartData(timeSamp: sendTime, format: 'MM/dd HH:mm'); | |||||
} | } | ||||
return showTimeStr; | return showTimeStr; | ||||
@@ -278,6 +278,101 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
); | ); | ||||
} | } | ||||
double getQuoteContentWidth(QuoteMsg quoteMsg, String refName, | |||||
String showTimeStr, String quoteContent) { | |||||
double width; | |||||
var timetWidth = CustomUI.getRealTextWidht(showTimeStr, 13); | |||||
var nameWidhth = CustomUI.getRealTextWidht(refName, 13); | |||||
width = timetWidth + (nameWidhth > 70 ? 70 : nameWidhth) + 59; | |||||
var contentWidht = _getTextWidth(quoteContent, fontSize: 13); | |||||
return min(max(width, contentWidht), maxWidth); | |||||
} | |||||
Widget getQuoteContent(QuoteMsg quoteMsg, String refName, String showTimeStr, | |||||
String quoteContent, bool isSend) { | |||||
var strColor; | |||||
var bgColor; | |||||
if (isSend) { | |||||
strColor = const Color(0xFF24343C); | |||||
bgColor = const Color(0xFFC4E0F5); | |||||
} else { | |||||
strColor = const Color(0xFF515151); | |||||
bgColor = const Color(0xFFEBEBEC); | |||||
} | |||||
return Container( | |||||
padding: EdgeInsets.only(left: 8, bottom: 8), | |||||
margin: EdgeInsets.only(bottom: 5, top: 2), | |||||
decoration: | |||||
BoxDecoration(color: bgColor, borderRadius: BorderRadius.circular(7)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Row(children: <Widget>[ | |||||
Container( | |||||
constraints: BoxConstraints(maxWidth: 70), | |||||
child: Text( | |||||
refName, | |||||
style: TextStyle(fontSize: 13, color: strColor), | |||||
overflow: TextOverflow.ellipsis, | |||||
)), | |||||
SizedBox(width: 10), | |||||
Text( | |||||
showTimeStr, | |||||
style: TextStyle(fontSize: 13, color: strColor), | |||||
), | |||||
Expanded(child: SizedBox()), | |||||
InkWell( | |||||
onTap: () { | |||||
MessageMgr().emit('Jump to Msg', quoteMsg.sendTime.toInt()); | |||||
}, | |||||
child: Container( | |||||
alignment: Alignment.center, | |||||
height: 27, | |||||
padding: EdgeInsets.only( | |||||
left: 10, | |||||
right: 10, | |||||
), | |||||
child: Icon( | |||||
IconData(0xe67e, fontFamily: Constants.IconFontFamily), | |||||
size: 13, | |||||
color: strColor, | |||||
))) | |||||
]), | |||||
Padding( | |||||
padding: EdgeInsets.only(right: 8), | |||||
child: Text( | |||||
quoteContent, | |||||
style: TextStyle(fontSize: 13, color: strColor), | |||||
), | |||||
), | |||||
], | |||||
), | |||||
); | |||||
} | |||||
Map getQuoteItem(MsgModel msgModel) { | |||||
QuoteMsg quoteMsg = QuoteMsg.fromBuffer(widget.msg.refMsgContent); | |||||
var refName = Provider.of<RefNameProvider>(context) | |||||
.getGroupRefName(msgModel.sessionId, quoteMsg.sendUserId); | |||||
var msgDate = | |||||
DateTime.fromMillisecondsSinceEpoch(quoteMsg.sendTime.toInt()); | |||||
var showTimeStr = | |||||
getTodayTime(msgDate, sendTime: quoteMsg.sendTime.toInt()); | |||||
var tempIndex = quoteMsg.content.indexOf(':'); | |||||
var quoteContent = tempIndex == -1 | |||||
? quoteMsg.content | |||||
: quoteMsg.content.substring(quoteMsg.content.indexOf(':') + 2); | |||||
return { | |||||
"quoteMsg": quoteMsg, | |||||
"refName": refName, | |||||
"showTimeStr": showTimeStr, | |||||
"quoteContent": quoteContent, | |||||
}; | |||||
} | |||||
_textMsg(MsgModel msgModel) { | _textMsg(MsgModel msgModel) { | ||||
List<Widget> showMsg = []; | List<Widget> showMsg = []; | ||||
var width = 0.0; | var width = 0.0; | ||||
@@ -294,61 +389,12 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
} | } | ||||
if (msgModel.refMsgContent != null && msgModel.refMsgContent.length > 0) { | if (msgModel.refMsgContent != null && msgModel.refMsgContent.length > 0) { | ||||
QuoteMsg quoteMsg = QuoteMsg.fromBuffer(msgModel.refMsgContent); | |||||
var refName = Provider.of<RefNameProvider>(context) | |||||
.getGroupRefName(msgModel.sessionId, quoteMsg.sendUserId); | |||||
var msgDate = | |||||
DateTime.fromMillisecondsSinceEpoch(quoteMsg.sendTime.toInt()); | |||||
var showTimeStr = | |||||
getTodayTime(msgDate, sendTime: quoteMsg.sendTime.toInt()); | |||||
var timetWidth = CustomUI.getRealTextWidht(showTimeStr, 13); | |||||
var nameWidhth = CustomUI.getRealTextWidht(refName, 13); | |||||
width = timetWidth + (nameWidhth > 70 ? 70 : nameWidhth) + 36; | |||||
var tempIndex = quoteMsg.content.indexOf(':'); | |||||
var quoteContent = tempIndex == -1 | |||||
? quoteMsg.content | |||||
: quoteMsg.content.substring(quoteMsg.content.indexOf(':') + 2); | |||||
var contentWidht = _getTextWidth(quoteContent, fontSize: 13); | |||||
width = min(max(width, contentWidht), maxWidth); | |||||
showMsg.add(InkWell( | |||||
onTap: () { | |||||
MessageMgr().emit('Jump to Msg', quoteMsg.sendTime.toInt()); | |||||
}, | |||||
child: Container( | |||||
padding: EdgeInsets.all(8), | |||||
margin: EdgeInsets.only(bottom: 5), | |||||
decoration: BoxDecoration( | |||||
color: Color(0xFFC4E0F5), | |||||
borderRadius: BorderRadius.circular(5.5)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Row(children: <Widget>[ | |||||
Container( | |||||
constraints: BoxConstraints(maxWidth: 70), | |||||
child: Text( | |||||
refName, | |||||
style: TextStyle(fontSize: 13), | |||||
overflow: TextOverflow.ellipsis, | |||||
)), | |||||
SizedBox(width: 20), | |||||
Text( | |||||
showTimeStr, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
]), | |||||
SizedBox(height: 7.5), | |||||
Text( | |||||
quoteContent, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
], | |||||
), | |||||
))); | |||||
var quoteItem = getQuoteItem(msgModel); | |||||
width = getQuoteContentWidth(quoteItem['quoteMsg'], quoteItem['refName'], | |||||
quoteItem['showTimeStr'], quoteItem['quoteContent']); | |||||
showMsg.add(getQuoteContent(quoteItem['quoteMsg'], quoteItem['refName'], | |||||
quoteItem['showTimeStr'], quoteItem['quoteContent'], true)); | |||||
} | } | ||||
var contentWidth = _getTextWidth(textList[curTextType]); | var contentWidth = _getTextWidth(textList[curTextType]); | ||||
if (contentWidth > width && contentWidth <= maxWidth) { | if (contentWidth > width && contentWidth <= maxWidth) { | ||||
@@ -823,8 +869,8 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
shape: BoxShape.circle, | shape: BoxShape.circle, | ||||
color: isShow ? Color(0xFFFF7E00) : Color(0xFFCFCFCF), | color: isShow ? Color(0xFFFF7E00) : Color(0xFFCFCFCF), | ||||
), | ), | ||||
width: 6, | |||||
height: 6, | |||||
width: 4, | |||||
height: 4, | |||||
); | ); | ||||
} | } | ||||
@@ -838,58 +884,15 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
} | } | ||||
if (msg.refMsgContent != null && msg.refMsgContent.length > 0) { | if (msg.refMsgContent != null && msg.refMsgContent.length > 0) { | ||||
QuoteMsg quoteMsg = QuoteMsg.fromBuffer(msg.refMsgContent); | |||||
var refName = Provider.of<RefNameProvider>(context) | |||||
.getGroupRefName(msg.sessionId, quoteMsg.sendUserId); | |||||
var msgDate = | |||||
DateTime.fromMillisecondsSinceEpoch(quoteMsg.sendTime.toInt()); | |||||
var showTimeStr = | |||||
getTodayTime(msgDate, sendTime: quoteMsg.sendTime.toInt()); | |||||
var timetWidth = CustomUI.getRealTextWidht(showTimeStr, 13); | |||||
var nameWidhth = CustomUI.getRealTextWidht(refName, 13); | |||||
width = timetWidth + (nameWidhth > 70 ? 70 : nameWidhth) + 36; | |||||
var quoteContent = | |||||
quoteMsg.content.substring(quoteMsg.content.indexOf(':') + 2); | |||||
var contentWidht = _getTextWidth(quoteContent, fontSize: 13); | |||||
width = min(max(width, contentWidht), maxWidth); | |||||
showMsg.add(InkWell( | |||||
onTap: () { | |||||
MessageMgr().emit('Jump to Msg', quoteMsg.sendTime.toInt()); | |||||
}, | |||||
child: Container( | |||||
padding: EdgeInsets.all(8), | |||||
margin: EdgeInsets.only(bottom: 5), | |||||
decoration: BoxDecoration( | |||||
color: Color(0xFFC4E0F5), | |||||
borderRadius: BorderRadius.circular(5.5)), | |||||
child: Column( | |||||
crossAxisAlignment: CrossAxisAlignment.start, | |||||
children: <Widget>[ | |||||
Row(children: <Widget>[ | |||||
Container( | |||||
constraints: BoxConstraints(maxWidth: 70), | |||||
child: Text( | |||||
refName, | |||||
style: TextStyle(fontSize: 13), | |||||
overflow: TextOverflow.ellipsis, | |||||
)), | |||||
SizedBox(width: 20), | |||||
Text( | |||||
showTimeStr, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
]), | |||||
SizedBox(height: 7.5), | |||||
Text( | |||||
quoteContent, | |||||
style: TextStyle(fontSize: 13), | |||||
) | |||||
], | |||||
), | |||||
))); | |||||
var quoteItem = getQuoteItem(msg); | |||||
width = getQuoteContentWidth( | |||||
quoteItem['quoteMsg'], | |||||
quoteItem['refName'], | |||||
quoteItem['showTimeStr'], | |||||
quoteItem['quoteContent']); | |||||
showMsg.add(getQuoteContent(quoteItem['quoteMsg'], quoteItem['refName'], | |||||
quoteItem['showTimeStr'], quoteItem['quoteContent'], false)); | |||||
} | } | ||||
var contentWidth = _getTextWidth(textList[curTextType]); | var contentWidth = _getTextWidth(textList[curTextType]); | ||||
@@ -897,28 +900,15 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
width = contentWidth; | width = contentWidth; | ||||
} | } | ||||
showMsg.add(InkWell( | |||||
onTap: () { | |||||
if (msg.transTag == 1) { | |||||
return; | |||||
} | |||||
if (msg.transTag == 2 || msg.transTag == 3) { | |||||
setState(() { | |||||
curTextType += 1; | |||||
curTextType %= textList.length; | |||||
}); | |||||
return; | |||||
} | |||||
}, | |||||
child: Container( | |||||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||||
alignment: Alignment.centerLeft, | |||||
child: extendedText( | |||||
textList[curTextType], | |||||
color: isUrl ? Colors.blue : Constants.BlackTextColor, | |||||
hideKeyboard: widget.hideKeyboard, | |||||
fontSize: FontSize, | |||||
)))); | |||||
showMsg.add(Container( | |||||
constraints: BoxConstraints(maxWidth: maxWidth, minHeight: 22), | |||||
alignment: Alignment.centerLeft, | |||||
child: extendedText( | |||||
textList[curTextType], | |||||
color: isUrl ? Colors.blue : Constants.BlackTextColor, | |||||
hideKeyboard: widget.hideKeyboard, | |||||
fontSize: FontSize, | |||||
))); | |||||
} | } | ||||
var minWidth = width + 20; | var minWidth = width + 20; | ||||
@@ -958,7 +948,22 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
: Container() | : Container() | ||||
]); | ]); | ||||
return text; | |||||
return InkWell( | |||||
child: text, | |||||
onTap: () { | |||||
MessageMgr().emit('Keyboard Hide'); | |||||
if (msg.transTag == 1) { | |||||
return; | |||||
} | |||||
if (msg.transTag == 2 || msg.transTag == 3) { | |||||
setState(() { | |||||
curTextType += 1; | |||||
curTextType %= textList.length; | |||||
}); | |||||
return; | |||||
} | |||||
}, | |||||
); | |||||
} | } | ||||
//用户评价人工翻译,差评 | //用户评价人工翻译,差评 | ||||
@@ -971,7 +976,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem> | |||||
} | } | ||||
_translateItemWidget(int code, String title, Function onTap) { | _translateItemWidget(int code, String title, Function onTap) { | ||||
Color color = onTap == null ? Constants.GreyTextColor : Color(0xFF087FF3); | |||||
Color color = onTap == null ? Color(0xFFC5C5C5) : Color(0xFF6A6A6A); | |||||
return InkWell( | return InkWell( | ||||
onTap: onTap, | onTap: onTap, | ||||
splashColor: Colors.red, | splashColor: Colors.red, | ||||
@@ -182,9 +182,9 @@ class _GroupChatPageState extends State<GroupChatPage> { | |||||
jumIndex = msgList.length - 1; | jumIndex = msgList.length - 1; | ||||
} | } | ||||
await controller.scrollToIndex(jumIndex, | await controller.scrollToIndex(jumIndex, | ||||
preferPosition: AutoScrollPosition.begin); | |||||
preferPosition: AutoScrollPosition.middle); | |||||
controller.highlight(jumIndex, | controller.highlight(jumIndex, | ||||
highlightDuration: new Duration(milliseconds: 500)); | |||||
highlightDuration: new Duration(milliseconds: 100)); | |||||
} | } | ||||
void _sendFile(File file) async { | void _sendFile(File file) async { | ||||
@@ -32,10 +32,16 @@ import 'package:shared_preferences/shared_preferences.dart'; | |||||
import 'emoji_gif_text.dart'; | import 'emoji_gif_text.dart'; | ||||
import 'emoji_text.dart'; | import 'emoji_text.dart'; | ||||
class AlterPostion { | |||||
int start; | |||||
int length; | |||||
AlterPostion(this.start, this.length); | |||||
} | |||||
class InputBar extends StatefulWidget { | class InputBar extends StatefulWidget { | ||||
final Function sendMsg; | final Function sendMsg; | ||||
final bool isTranslateHK; | final bool isTranslateHK; | ||||
InputBar({this.sendMsg,this.isTranslateHK=false}); | |||||
InputBar({this.sendMsg, this.isTranslateHK = false}); | |||||
@override | @override | ||||
InputBarState createState() => InputBarState(); | InputBarState createState() => InputBarState(); | ||||
@@ -63,10 +69,11 @@ class InputBarState extends State<InputBar> | |||||
int lastTxtLen = 0; | int lastTxtLen = 0; | ||||
List<AlterPostion> alterPosition = []; | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
super.initState(); | super.initState(); | ||||
print('~~~~~~~~~~inputbar initState~~~~~~~~~~~'); | print('~~~~~~~~~~inputbar initState~~~~~~~~~~~'); | ||||
pageController = new PageController(); | pageController = new PageController(); | ||||
getKeyboardHeight(); | getKeyboardHeight(); | ||||
@@ -153,7 +160,7 @@ class InputBarState extends State<InputBar> | |||||
// SystemChannels.textInput.invokeMethod('TextInput.show'); | // SystemChannels.textInput.invokeMethod('TextInput.show'); | ||||
} | } | ||||
_getRefShortText(){ | |||||
_getRefShortText() { | |||||
if (refMsg == null) { | if (refMsg == null) { | ||||
return null; | return null; | ||||
} | } | ||||
@@ -713,13 +720,10 @@ class InputBarState extends State<InputBar> | |||||
_sendPhotoFile(file); | _sendPhotoFile(file); | ||||
} | } | ||||
} | } | ||||
} on Exception catch (e) { | } on Exception catch (e) { | ||||
print(e.toString()); | print(e.toString()); | ||||
} | } | ||||
// var photos = await PhotoPicker.pickAsset( | // var photos = await PhotoPicker.pickAsset( | ||||
// context: context, | // context: context, | ||||
// themeColor: Color(0xFFF0F0F0), | // themeColor: Color(0xFFF0F0F0), | ||||
@@ -744,8 +748,9 @@ class InputBarState extends State<InputBar> | |||||
friendId = Provider.of<int>(context); | friendId = Provider.of<int>(context); | ||||
} | } | ||||
ChatChannelType channelType =isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
if(widget.isTranslateHK){ | |||||
ChatChannelType channelType = | |||||
isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
if (widget.isTranslateHK) { | |||||
channelType = ChatChannelType.TransHK; | channelType = ChatChannelType.TransHK; | ||||
print('聊天是 TransHK'); | print('聊天是 TransHK'); | ||||
} | } | ||||
@@ -793,8 +798,9 @@ class InputBarState extends State<InputBar> | |||||
friendId = Provider.of<int>(context); | friendId = Provider.of<int>(context); | ||||
} | } | ||||
ChatChannelType channelType =isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
if(widget.isTranslateHK){ | |||||
ChatChannelType channelType = | |||||
isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
if (widget.isTranslateHK) { | |||||
channelType = ChatChannelType.TransHK; | channelType = ChatChannelType.TransHK; | ||||
print('聊天是 TransHK'); | print('聊天是 TransHK'); | ||||
} | } | ||||
@@ -853,8 +859,9 @@ class InputBarState extends State<InputBar> | |||||
} | } | ||||
} | } | ||||
ChatChannelType channelType =isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
if(widget.isTranslateHK){ | |||||
ChatChannelType channelType = | |||||
isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
if (widget.isTranslateHK) { | |||||
channelType = ChatChannelType.TransHK; | channelType = ChatChannelType.TransHK; | ||||
print('聊天是 TransHK'); | print('聊天是 TransHK'); | ||||
} | } | ||||
@@ -865,7 +872,7 @@ class InputBarState extends State<InputBar> | |||||
refMsg: refMsg, | refMsg: refMsg, | ||||
refShortTxt: _getRefShortText(), | refShortTxt: _getRefShortText(), | ||||
altUsers: alterUsers, | altUsers: alterUsers, | ||||
channelType: channelType); | |||||
channelType: channelType); | |||||
widget.sendMsg(msg); | widget.sendMsg(msg); | ||||
@@ -1,3 +1,4 @@ | |||||
import 'dart:async'; | |||||
import 'dart:convert'; | import 'dart:convert'; | ||||
import 'package:amap_location/amap_location.dart'; | import 'package:amap_location/amap_location.dart'; | ||||
@@ -5,6 +6,7 @@ import 'package:chat/data/constants.dart'; | |||||
import 'package:chat/utils/HttpUtil.dart'; | import 'package:chat/utils/HttpUtil.dart'; | ||||
import 'package:crclib/crclib.dart'; | import 'package:crclib/crclib.dart'; | ||||
import 'package:shared_preferences/shared_preferences.dart'; | import 'package:shared_preferences/shared_preferences.dart'; | ||||
import 'package:vibration/vibration.dart'; | |||||
import '../models/UserInfo.dart'; | import '../models/UserInfo.dart'; | ||||
@@ -59,13 +61,15 @@ class UserData { | |||||
bool stationOpenSwitch = true; //开启电台开关 | bool stationOpenSwitch = true; //开启电台开关 | ||||
bool myProgramOpenSwitch = true; //我的节目开关 | bool myProgramOpenSwitch = true; //我的节目开关 | ||||
bool nearbyOpenSwitch = true; //附近的人开关 | bool nearbyOpenSwitch = true; //附近的人开关 | ||||
bool isTranslateUser = false ; | |||||
bool isTranslateUser = false; | |||||
List contactList = []; | List contactList = []; | ||||
bool isInChina = false; | bool isInChina = false; | ||||
int homemainIndex = 0; | int homemainIndex = 0; | ||||
String currentCity = ''; | String currentCity = ''; | ||||
String deviceLanguageCode; | String deviceLanguageCode; | ||||
bool shockNoticSwitch = true; //震动通知 | |||||
bool isShocking = false; //是否震动中 | |||||
Map<String, dynamic> toJson() { | Map<String, dynamic> toJson() { | ||||
Map<String, dynamic> json = new Map<String, dynamic>(); | Map<String, dynamic> json = new Map<String, dynamic>(); | ||||
@@ -236,4 +240,15 @@ class UserData { | |||||
return 'HoChiMinhCIty'; | return 'HoChiMinhCIty'; | ||||
} | } | ||||
} | } | ||||
shock() { | |||||
//有震动通知 | |||||
if (UserData().shockNoticSwitch && !UserData().isShocking) { | |||||
UserData().isShocking = true; | |||||
Vibration.vibrate(); | |||||
Timer.periodic(Duration(seconds: 3), (timer) async { | |||||
UserData().isShocking = false; | |||||
}); | |||||
} | |||||
} | |||||
} | } |
@@ -2515,6 +2515,8 @@ class I18n implements WidgetsLocalizations { | |||||
String get travel_end => "终点"; | String get travel_end => "终点"; | ||||
/// "翻译订单超时已被取消" | /// "翻译订单超时已被取消" | ||||
String get translation_butler_order_time_out => "翻译订单超时已被取消"; | String get translation_butler_order_time_out => "翻译订单超时已被取消"; | ||||
/// "震动通知" | |||||
String get shock_notice => "震动通知"; | |||||
} | } | ||||
class _I18n_en_US extends I18n { | class _I18n_en_US extends I18n { | ||||
@@ -6247,6 +6249,9 @@ class _I18n_vi_VN extends I18n { | |||||
/// "翻译订单超时已被取消" | /// "翻译订单超时已被取消" | ||||
@override | @override | ||||
String get translation_butler_order_time_out => "翻译订单超时已被取消"; | String get translation_butler_order_time_out => "翻译订单超时已被取消"; | ||||
/// "震动通知" | |||||
@override | |||||
String get shock_notice => "震动通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -9975,6 +9980,9 @@ class _I18n_zh_HK extends I18n { | |||||
/// "翻译订单超时已被取消" | /// "翻译订单超时已被取消" | ||||
@override | @override | ||||
String get translation_butler_order_time_out => "翻译订单超时已被取消"; | String get translation_butler_order_time_out => "翻译订单超时已被取消"; | ||||
/// "震動通知" | |||||
@override | |||||
String get shock_notice => "震動通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -13706,6 +13714,9 @@ class _I18n_zh_CN extends _I18n_zh_HK { | |||||
/// "翻译订单超时已被取消" | /// "翻译订单超时已被取消" | ||||
@override | @override | ||||
String get translation_butler_order_time_out => "翻译订单超时已被取消"; | String get translation_butler_order_time_out => "翻译订单超时已被取消"; | ||||
/// "震动通知" | |||||
@override | |||||
String get shock_notice => "震动通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -17437,6 +17448,9 @@ class _I18n_ko_KR extends I18n { | |||||
/// "翻译订单超时已被取消" | /// "翻译订单超时已被取消" | ||||
@override | @override | ||||
String get translation_butler_order_time_out => "翻译订单超时已被取消"; | String get translation_butler_order_time_out => "翻译订单超时已被取消"; | ||||
/// "震动通知" | |||||
@override | |||||
String get shock_notice => "震动通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -21165,6 +21179,9 @@ class _I18n_ja_JP extends I18n { | |||||
/// "翻译订单超时已被取消" | /// "翻译订单超时已被取消" | ||||
@override | @override | ||||
String get translation_butler_order_time_out => "翻译订单超时已被取消"; | String get translation_butler_order_time_out => "翻译订单超时已被取消"; | ||||
/// "震动通知" | |||||
@override | |||||
String get shock_notice => "震动通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -37,6 +37,8 @@ class _MessagePushPageState extends State<MessagePushPage> { | |||||
bool womenAgree = false; | bool womenAgree = false; | ||||
//邀请码申请成功 | //邀请码申请成功 | ||||
bool codeSucess = false; | bool codeSucess = false; | ||||
//震动通知 | |||||
bool shockNotic = false; | |||||
bool isLoadingFish = false; | bool isLoadingFish = false; | ||||
@@ -59,6 +61,7 @@ class _MessagePushPageState extends State<MessagePushPage> { | |||||
if (resData['code'] == 0) { | if (resData['code'] == 0) { | ||||
privatyMsg = resData['data']['PrivacyChat'] == 1; | privatyMsg = resData['data']['PrivacyChat'] == 1; | ||||
newDate = resData['data']['NewBroadcast'] == 1; | newDate = resData['data']['NewBroadcast'] == 1; | ||||
shockNotic = resData['data']['VibrationReminder'] == 1; | |||||
if (isMan) { | if (isMan) { | ||||
womenAgree = resData['data']['AcceptCheck'] == 1; | womenAgree = resData['data']['AcceptCheck'] == 1; | ||||
codeSucess = resData['data']['ApplySuccess'] == 1; | codeSucess = resData['data']['ApplySuccess'] == 1; | ||||
@@ -110,6 +113,7 @@ class _MessagePushPageState extends State<MessagePushPage> { | |||||
data['sign'] = TokenMgr().getSign(data); | data['sign'] = TokenMgr().getSign(data); | ||||
data['privacyChat'] = privatyMsg ? 1 : 0; | data['privacyChat'] = privatyMsg ? 1 : 0; | ||||
data['newBroadcast'] = newDate ? 1 : 0; | data['newBroadcast'] = newDate ? 1 : 0; | ||||
data['vibrationReminder'] = shockNotic ? 1 : 0; | |||||
if (isMan) { | if (isMan) { | ||||
data['acceptCheck'] = womenAgree ? 1 : 0; | data['acceptCheck'] = womenAgree ? 1 : 0; | ||||
data['applySuccess'] = codeSucess ? 1 : 0; | data['applySuccess'] = codeSucess ? 1 : 0; | ||||
@@ -132,6 +136,7 @@ class _MessagePushPageState extends State<MessagePushPage> { | |||||
UserData().acceptCheckSwitch = womenAgree; | UserData().acceptCheckSwitch = womenAgree; | ||||
UserData().checkPhotoSwitch = watchMyPicture; | UserData().checkPhotoSwitch = watchMyPicture; | ||||
UserData().codeSucessSwitch = codeSucess; | UserData().codeSucessSwitch = codeSucess; | ||||
UserData().shockNoticSwitch = shockNotic; | |||||
} | } | ||||
} catch (e) {} | } catch (e) {} | ||||
}, | }, | ||||
@@ -171,11 +176,11 @@ class _MessagePushPageState extends State<MessagePushPage> { | |||||
womenAgree = !womenAgree; | womenAgree = !womenAgree; | ||||
}); | }); | ||||
}), | }), | ||||
// _buildHiddenButtom(I18n.of(context).applied_successfully, codeSucess, () { | |||||
// setState(() { | |||||
// codeSucess = !codeSucess; | |||||
// }); | |||||
// }), | |||||
_buildHiddenButtom(I18n.of(context).shock_notice, shockNotic, () { | |||||
setState(() { | |||||
shockNotic = !shockNotic; | |||||
}); | |||||
}), | |||||
]; | ]; | ||||
List<Widget> women = [ | List<Widget> women = [ | ||||
_buildHiddenButtom(I18n.of(context).private_chat2, privatyMsg, () { | _buildHiddenButtom(I18n.of(context).private_chat2, privatyMsg, () { | ||||
@@ -198,6 +203,11 @@ class _MessagePushPageState extends State<MessagePushPage> { | |||||
watchMyPicture = !watchMyPicture; | watchMyPicture = !watchMyPicture; | ||||
}); | }); | ||||
}), | }), | ||||
_buildHiddenButtom(I18n.of(context).shock_notice, shockNotic, () { | |||||
setState(() { | |||||
shockNotic = !shockNotic; | |||||
}); | |||||
}), | |||||
]; | ]; | ||||
return new ListView( | return new ListView( | ||||
children: isMan ? man : women, | children: isMan ? man : women, | ||||
@@ -1,7 +1,6 @@ | |||||
import 'dart:async'; | import 'dart:async'; | ||||
import 'package:chat/chat/ChatPage.dart'; | import 'package:chat/chat/ChatPage.dart'; | ||||
import 'package:chat/data/UserData.dart'; | import 'package:chat/data/UserData.dart'; | ||||
import 'package:chat/data/chat_data_mgr.dart'; | |||||
import 'package:chat/data/constants.dart'; | import 'package:chat/data/constants.dart'; | ||||
import 'package:chat/data/translate_hk_data_mgr.dart'; | import 'package:chat/data/translate_hk_data_mgr.dart'; | ||||
import 'package:chat/generated/i18n.dart'; | import 'package:chat/generated/i18n.dart'; | ||||
@@ -9,10 +8,8 @@ import 'package:chat/home/SystemEditPage.dart'; | |||||
import 'package:chat/home/find_page.dart'; | import 'package:chat/home/find_page.dart'; | ||||
import 'package:chat/home/realtimehelper/real_time_helper_page.dart'; | import 'package:chat/home/realtimehelper/real_time_helper_page.dart'; | ||||
import 'package:chat/home/unread_dot_widget.dart'; | import 'package:chat/home/unread_dot_widget.dart'; | ||||
import 'package:chat/models/ChatMsg.dart'; | |||||
import 'package:chat/models/UserInfo.dart'; | import 'package:chat/models/UserInfo.dart'; | ||||
import 'package:chat/models/ref_name_provider.dart'; | import 'package:chat/models/ref_name_provider.dart'; | ||||
import 'package:chat/proto/all.pbserver.dart'; | |||||
import 'package:chat/utils/CustomUI.dart'; | import 'package:chat/utils/CustomUI.dart'; | ||||
import 'package:chat/utils/HttpUtil.dart'; | import 'package:chat/utils/HttpUtil.dart'; | ||||
import 'package:chat/utils/MessageMgr.dart'; | import 'package:chat/utils/MessageMgr.dart'; | ||||
@@ -25,6 +25,7 @@ import 'package:flutter/material.dart'; | |||||
import 'package:oktoast/oktoast.dart'; | import 'package:oktoast/oktoast.dart'; | ||||
import 'package:fixnum/fixnum.dart'; | import 'package:fixnum/fixnum.dart'; | ||||
import 'package:vibration/vibration.dart'; | |||||
import 'MessageMgr.dart'; | import 'MessageMgr.dart'; | ||||
const MaxMsgContentSize = 1024 * 1024 * 3; | const MaxMsgContentSize = 1024 * 1024 * 3; | ||||
@@ -257,6 +258,7 @@ class MsgHandler { | |||||
static int timeInterval = 2500; | static int timeInterval = 2500; | ||||
// static int receivedCount=0; | // static int receivedCount=0; | ||||
static handlerReceiveMsg(PushChat chat) async { | static handlerReceiveMsg(PushChat chat) async { | ||||
UserData().shock(); | |||||
bool isGroup = false; | bool isGroup = false; | ||||
bool isTranslateHK = false; | bool isTranslateHK = false; | ||||
if (chat.channelType == ChatChannelType.Group) { | if (chat.channelType == ChatChannelType.Group) { | ||||
@@ -413,43 +415,42 @@ class MsgHandler { | |||||
} else if (isTranslateHK) { | } else if (isTranslateHK) { | ||||
var myId = UserData().basicInfo.userId; | var myId = UserData().basicInfo.userId; | ||||
print('chat.contentBuff:${chat.contentBuff.length}'); | print('chat.contentBuff:${chat.contentBuff.length}'); | ||||
TransHKChatNotice notice = TransHKChatNotice.fromBuffer(chat.contentBuff); | |||||
BaseUserInfo friendId ; | |||||
TransHKChatNotice notice = | |||||
TransHKChatNotice.fromBuffer(chat.contentBuff); | |||||
BaseUserInfo friendId; | |||||
print('chat.contentBuff AAAA'); | print('chat.contentBuff AAAA'); | ||||
TranslateHKMgr().isUser = myId== notice.employer.id; ///判断自己是翻译官还是用户 | |||||
TranslateHKMgr().isUser = myId == notice.employer.id; | |||||
///判断自己是翻译官还是用户 | |||||
print('chat.contentBuff BBBB'); | print('chat.contentBuff BBBB'); | ||||
if(myId== notice.employer.id){ | |||||
friendId =notice.inter; | |||||
}else{ | |||||
if (myId == notice.employer.id) { | |||||
friendId = notice.inter; | |||||
} else { | |||||
friendId = notice.employer; | friendId = notice.employer; | ||||
} | } | ||||
print('friend id: ${friendId.id} '); | print('friend id: ${friendId.id} '); | ||||
int sessionId = chat.targetId; | int sessionId = chat.targetId; | ||||
if (chat.cType == ChatType.GroupChatNoticeType) { | if (chat.cType == ChatType.GroupChatNoticeType) { | ||||
msgModel = MsgModel(0, friendId.id, chat.cType.value, | msgModel = MsgModel(0, friendId.id, chat.cType.value, | ||||
chat.contentBuff, chat.sendTime.toInt(), sessionId, | chat.contentBuff, chat.sendTime.toInt(), sessionId, | ||||
channelType: ChatChannelType.Session.value); | channelType: ChatChannelType.Session.value); | ||||
} | } | ||||
///接到开始翻译管家消息-打开翻译管家聊天页面 | ///接到开始翻译管家消息-打开翻译管家聊天页面 | ||||
if(notice.noticeType==TransHKChatNoticeType.StartChat){ | |||||
Future.delayed(Duration(seconds: 1),(){ | |||||
if (notice.noticeType == TransHKChatNoticeType.StartChat) { | |||||
Future.delayed(Duration(seconds: 1), () { | |||||
TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY; | TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY; | ||||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_REFRESH_ORDER ); | |||||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_REFRESH_ORDER); | |||||
curActiveSession = sessionId; | curActiveSession = sessionId; | ||||
print('curActiveSession:$curActiveSession'); | print('curActiveSession:$curActiveSession'); | ||||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_START_CHAT, friendId.id); | |||||
MessageMgr() | |||||
.emit(MessageMgr.TRANSLATE_HK_START_CHAT, friendId.id); | |||||
}); | }); | ||||
}else if(notice.noticeType==TransHKChatNoticeType.EndChat){ | |||||
} else if (notice.noticeType == TransHKChatNoticeType.EndChat) { | |||||
print('chat.contentBuff cccc'); | print('chat.contentBuff cccc'); | ||||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_END_CHAT, friendId.id); | MessageMgr().emit(MessageMgr.TRANSLATE_HK_END_CHAT, friendId.id); | ||||
} | } | ||||
@@ -975,9 +976,9 @@ class MsgHandler { | |||||
handlerCancelTranslateOrder(content); | handlerCancelTranslateOrder(content); | ||||
} else if (msgId == 20) { | } else if (msgId == 20) { | ||||
handlerDeliveryInterpreterOrderPush(content); | handlerDeliveryInterpreterOrderPush(content); | ||||
}else if(msgId==21){ | |||||
} else if (msgId == 21) { | |||||
handlerCancellationTransHKOrderPush(content); | handlerCancellationTransHKOrderPush(content); | ||||
}else if(msgId==8){ | |||||
} else if (msgId == 8) { | |||||
handlerEndTransHKOrderRes(content); | handlerEndTransHKOrderRes(content); | ||||
} | } | ||||
break; | break; | ||||
@@ -1268,10 +1269,11 @@ class MsgHandler { | |||||
} | } | ||||
//发布翻译管家帮助订单 | //发布翻译管家帮助订单 | ||||
static sendCreateTranslateOrder(int fromLanguage,int toLanguage,int scences,String extraDesc) { | |||||
TranslateHKMgr().isUser=true; | |||||
debugPrint('发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage|toLanguage}' ); | |||||
static sendCreateTranslateOrder( | |||||
int fromLanguage, int toLanguage, int scences, String extraDesc) { | |||||
TranslateHKMgr().isUser = true; | |||||
debugPrint( | |||||
'发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage | toLanguage}'); | |||||
var seq = IssueTransHKOrderReq.create(); | var seq = IssueTransHKOrderReq.create(); | ||||
seq.tLanguage = fromLanguage | toLanguage; | seq.tLanguage = fromLanguage | toLanguage; | ||||
seq.scenes = scences; | seq.scenes = scences; | ||||
@@ -1324,20 +1326,18 @@ class MsgHandler { | |||||
'OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); | 'OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); | ||||
TranslateOrder order = new TranslateOrder(); | TranslateOrder order = new TranslateOrder(); | ||||
order.orderId=res.orderId; | |||||
order.desc=res.desc; | |||||
order.createTime=res.createTime.toInt(); | |||||
order.tLanguage=res.tLanguage.toInt(); | |||||
order.scenes=res.scenes.toInt(); | |||||
order.orderId = res.orderId; | |||||
order.desc = res.desc; | |||||
order.createTime = res.createTime.toInt(); | |||||
order.tLanguage = res.tLanguage.toInt(); | |||||
order.scenes = res.scenes.toInt(); | |||||
order.userName = res.employer.niceName; | order.userName = res.employer.niceName; | ||||
TranslateHKMgr().order = order; | TranslateHKMgr().order = order; | ||||
MessageMgr().emit(MessageMgr.TRANSLATE_HK_RECEIVE_ORDER, order); | MessageMgr().emit(MessageMgr.TRANSLATE_HK_RECEIVE_ORDER, order); | ||||
} | } | ||||
//派送订单已被取消 | //派送订单已被取消 | ||||
static handlerCancellationTransHKOrderPush(List<int> msgContent) { | static handlerCancellationTransHKOrderPush(List<int> msgContent) { | ||||
var res = CancellationTransHKOrderPush.fromBuffer(msgContent); | var res = CancellationTransHKOrderPush.fromBuffer(msgContent); | ||||
debugPrint('派送订单已被取消: orderId${res.orderId}'); | debugPrint('派送订单已被取消: orderId${res.orderId}'); | ||||
// print('OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); | // print('OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); | ||||
@@ -1347,8 +1347,6 @@ class MsgHandler { | |||||
showToast(I18n.of(context).translation_butler_order_time_out); | showToast(I18n.of(context).translation_butler_order_time_out); | ||||
} | } | ||||
//接收订单请求 | //接收订单请求 | ||||
static sendReceiveOrder() { | static sendReceiveOrder() { | ||||
TranslateOrder order = TranslateHKMgr().order; | TranslateOrder order = TranslateHKMgr().order; | ||||
@@ -1371,13 +1369,9 @@ class MsgHandler { | |||||
} | } | ||||
} | } | ||||
//用户主动结束翻译管家服务 | //用户主动结束翻译管家服务 | ||||
static sendEndTransHKOrderReq() { | static sendEndTransHKOrderReq() { | ||||
debugPrint('用户主动结束翻译管家服务 ${TranslateHKMgr().orderId}' ); | |||||
debugPrint('用户主动结束翻译管家服务 ${TranslateHKMgr().orderId}'); | |||||
var seq = EndTransHKOrderReq.create(); | var seq = EndTransHKOrderReq.create(); | ||||
seq.orderId = TranslateHKMgr().orderId; | seq.orderId = TranslateHKMgr().orderId; | ||||
NetWork().sendMsg(ComId.TranslateOrder, 7, seq); | NetWork().sendMsg(ComId.TranslateOrder, 7, seq); | ||||
@@ -1388,7 +1382,6 @@ class MsgHandler { | |||||
debugPrint('用户主动结束翻译管家服务'); | debugPrint('用户主动结束翻译管家服务'); | ||||
var res = EndTransHKOrderRes.fromBuffer(msgContent); | var res = EndTransHKOrderRes.fromBuffer(msgContent); | ||||
if (res.errorCode == 0) { | if (res.errorCode == 0) { | ||||
// GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); | // GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); | ||||
debugPrint('用户主动结束翻译管家服务 成功: '); | debugPrint('用户主动结束翻译管家服务 成功: '); | ||||
} else { | } else { | ||||
@@ -1396,11 +1389,6 @@ class MsgHandler { | |||||
} | } | ||||
} | } | ||||
//消息免打扰请求结果 | //消息免打扰请求结果 | ||||
static handlerGroupIsShowMenberNiceName(List<int> msgContent) { | static handlerGroupIsShowMenberNiceName(List<int> msgContent) { | ||||
print('设置是否显示群昵称'); | print('设置是否显示群昵称'); | ||||
@@ -1117,6 +1117,13 @@ packages: | |||||
url: "https://pub.flutter-io.cn" | url: "https://pub.flutter-io.cn" | ||||
source: hosted | source: hosted | ||||
version: "2.0.8" | version: "2.0.8" | ||||
vibration: | |||||
dependency: "direct main" | |||||
description: | |||||
name: vibration | |||||
url: "https://pub.flutter-io.cn" | |||||
source: hosted | |||||
version: "1.2.4" | |||||
video_player: | video_player: | ||||
dependency: "direct main" | dependency: "direct main" | ||||
description: | description: | ||||
@@ -181,6 +181,8 @@ dependencies: | |||||
device_info: ^0.4.2+1 | device_info: ^0.4.2+1 | ||||
#跳转到指定索引 | #跳转到指定索引 | ||||
scroll_to_index: any | scroll_to_index: any | ||||
#震动反馈 | |||||
vibration: ^1.2.4 | |||||
dev_dependencies: | dev_dependencies: | ||||
flutter_test: | flutter_test: | ||||