@@ -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. | ||||
@@ -1247,5 +1247,6 @@ | |||||
"translation_butler_introduction": "Still annoying that the other person does n’t understand what you say? Choose the language you need to translate and describe the problem you are experiencing. Personal translation butler will be at your service", | "translation_butler_introduction": "Still annoying that the other person does n’t understand what you say? Choose the language you need to translate and describe the problem you are experiencing. Personal translation butler will be at your service", | ||||
"travel_introduction": "Are you traveling further and further away from your destination? Choose your starting point and ending point, the travel manager will accurately measure the distance for you", | "travel_introduction": "Are you traveling further and further away from your destination? Choose your starting point and ending point, the travel manager will accurately measure the distance for you", | ||||
"splash_tips_content4": "Unobstructed travel chat", | "splash_tips_content4": "Unobstructed travel chat", | ||||
"splash_tips_content5": "Worry-free your trip" | |||||
"splash_tips_content5": "Worry-free your trip", | |||||
"shock_notice": "Vibration notification" | |||||
} | } |
@@ -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": "大神专属", | ||||
@@ -1246,5 +1246,6 @@ | |||||
"translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | "translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | ||||
"travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | "travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | ||||
"splash_tips_content4": "出行聊天畅通无阻", | "splash_tips_content4": "出行聊天畅通无阻", | ||||
"splash_tips_content5": "无忧你的旅行" | |||||
"splash_tips_content5": "无忧你的旅行" , | |||||
"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 等待时长:", | ||||
@@ -1247,5 +1247,6 @@ | |||||
"translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | "translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | ||||
"travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | "travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | ||||
"splash_tips_content4": "出行聊天畅通无阻", | "splash_tips_content4": "出行聊天畅通无阻", | ||||
"splash_tips_content5": "无忧你的旅行" | |||||
"splash_tips_content5": "无忧你的旅行" , | |||||
"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": "大神专属", | ||||
@@ -1246,5 +1246,6 @@ | |||||
"translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | "translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | ||||
"travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | "travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | ||||
"splash_tips_content4": "出行聊天畅通无阻", | "splash_tips_content4": "出行聊天畅通无阻", | ||||
"splash_tips_content5": "无忧你的旅行" | |||||
"splash_tips_content5": "无忧你的旅行" , | |||||
"shock_notice": "震动通知" | |||||
} | } |
@@ -1247,7 +1247,6 @@ | |||||
"translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | "translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | ||||
"travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | "travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | ||||
"splash_tips_content4": "出行聊天畅通无阻", | "splash_tips_content4": "出行聊天畅通无阻", | ||||
"splash_tips_content5": "无忧你的旅行" | |||||
"splash_tips_content5": "无忧你的旅行", | |||||
"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": "大神专属", | ||||
@@ -1246,5 +1246,6 @@ | |||||
"translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | "translation_butler_introduction": "还在烦恼对方听不懂你说什么吗?选择你需要翻译的语言,描述你遇到的问题。贴身翻译管家将随时为你服务", | ||||
"travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | "travel_introduction": "是否在离目的地越行越远?选择你的起点和终点,出行管家为你精准测距", | ||||
"splash_tips_content4": "出行聊天畅通无阻", | "splash_tips_content4": "出行聊天畅通无阻", | ||||
"splash_tips_content5": "无忧你的旅行" | |||||
"splash_tips_content5": "无忧你的旅行", | |||||
"shock_notice": "震動通知" | |||||
} | } |
@@ -124,7 +124,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; | |||||
}); | |||||
} | |||||
} | |||||
} | } |
@@ -91,8 +91,8 @@ class ChatDataMgr { | |||||
} | } | ||||
//获取私聊记录 | //获取私聊记录 | ||||
List<MsgModel> getRecord() { | |||||
var record = msgRecordMap[MsgHandler.curActiveSession]; | |||||
List<MsgModel> getRecord({int sessionId}) { | |||||
var record = msgRecordMap[sessionId==null?MsgHandler.curActiveSession:sessionId]; | |||||
if (record == null) { | if (record == null) { | ||||
record = []; | record = []; | ||||
msgRecordMap[MsgHandler.curActiveSession] = record; | msgRecordMap[MsgHandler.curActiveSession] = record; | ||||
@@ -101,8 +101,8 @@ class ChatDataMgr { | |||||
} | } | ||||
//获取群聊记录 | //获取群聊记录 | ||||
List<MsgModel> getGroupRecord() { | |||||
var record = groupRecordMap[MsgHandler.curActiveSession]; | |||||
List<MsgModel> getGroupRecord({int sessionId}) { | |||||
var record = groupRecordMap[sessionId==null?MsgHandler.curActiveSession:sessionId]; | |||||
if (record == null) { | if (record == null) { | ||||
record = []; | record = []; | ||||
groupRecordMap[MsgHandler.curActiveSession] = record; | groupRecordMap[MsgHandler.curActiveSession] = record; | ||||
@@ -314,6 +314,10 @@ class ChatDataMgr { | |||||
print('数据为空,无法插入'); | print('数据为空,无法插入'); | ||||
} else { | } else { | ||||
record.insert(0, msg); | record.insert(0, msg); | ||||
int after = DateTime.now().millisecondsSinceEpoch-MsgHandler.time; | |||||
print('******插入数据 use $after'); | |||||
print('******record length ${record.length} ${msg.sessionId}'); | |||||
//record.add(msg); | //record.add(msg); | ||||
SqlUtil.insert(msg); | SqlUtil.insert(msg); | ||||
@@ -2531,6 +2531,8 @@ class I18n implements WidgetsLocalizations { | |||||
String get splash_tips_content4 => "Unobstructed travel chat"; | String get splash_tips_content4 => "Unobstructed travel chat"; | ||||
/// "Worry-free your trip" | /// "Worry-free your trip" | ||||
String get splash_tips_content5 => "Worry-free your trip"; | String get splash_tips_content5 => "Worry-free your trip"; | ||||
/// "Vibration notification" | |||||
String get shock_notice => "Vibration notification"; | |||||
} | } | ||||
class _I18n_en_US extends I18n { | class _I18n_en_US extends I18n { | ||||
@@ -6287,6 +6289,9 @@ class _I18n_vi_VN extends I18n { | |||||
/// "无忧你的旅行" | /// "无忧你的旅行" | ||||
@override | @override | ||||
String get splash_tips_content5 => "无忧你的旅行"; | String get splash_tips_content5 => "无忧你的旅行"; | ||||
/// "震动通知" | |||||
@override | |||||
String get shock_notice => "震动通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -10039,6 +10044,9 @@ class _I18n_zh_HK extends I18n { | |||||
/// "无忧你的旅行" | /// "无忧你的旅行" | ||||
@override | @override | ||||
String get splash_tips_content5 => "无忧你的旅行"; | String get splash_tips_content5 => "无忧你的旅行"; | ||||
/// "震動通知" | |||||
@override | |||||
String get shock_notice => "震動通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -13794,6 +13802,9 @@ class _I18n_zh_CN extends _I18n_zh_HK { | |||||
/// "无忧你的旅行" | /// "无忧你的旅行" | ||||
@override | @override | ||||
String get splash_tips_content5 => "无忧你的旅行"; | String get splash_tips_content5 => "无忧你的旅行"; | ||||
/// "震动通知" | |||||
@override | |||||
String get shock_notice => "震动通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -17549,6 +17560,9 @@ class _I18n_ko_KR extends I18n { | |||||
/// "无忧你的旅行" | /// "无忧你的旅行" | ||||
@override | @override | ||||
String get splash_tips_content5 => "无忧你的旅行"; | String get splash_tips_content5 => "无忧你的旅行"; | ||||
/// "震动通知" | |||||
@override | |||||
String get shock_notice => "震动通知"; | |||||
@override | @override | ||||
TextDirection get textDirection => TextDirection.ltr; | TextDirection get textDirection => TextDirection.ltr; | ||||
@@ -21301,6 +21315,9 @@ class _I18n_ja_JP extends I18n { | |||||
/// "无忧你的旅行" | /// "无忧你的旅行" | ||||
@override | @override | ||||
String get splash_tips_content5 => "无忧你的旅行"; | String get splash_tips_content5 => "无忧你的旅行"; | ||||
/// "震动通知" | |||||
@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'; | ||||
@@ -124,12 +124,12 @@ class MsgHandler { | |||||
static createSendMsg(ChatType chatType, content, | static createSendMsg(ChatType chatType, content, | ||||
{int extra, | {int extra, | ||||
int friendId, | |||||
String localFile, | |||||
MsgModel refMsg, | |||||
String refShortTxt, | |||||
List<int> altUsers, | |||||
ChatChannelType channelType = ChatChannelType.Session}) { | |||||
int friendId, | |||||
String localFile, | |||||
MsgModel refMsg, | |||||
String refShortTxt, | |||||
List<int> altUsers, | |||||
ChatChannelType channelType = ChatChannelType.Session}) { | |||||
MsgModel msg; | MsgModel msg; | ||||
if (content is String) { | if (content is String) { | ||||
@@ -247,7 +247,7 @@ class MsgHandler { | |||||
seq.channelType = ChatChannelType.CSD; | seq.channelType = ChatChannelType.CSD; | ||||
} else { | } else { | ||||
seq.channelType = | seq.channelType = | ||||
isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
isGroup ? ChatChannelType.Group : ChatChannelType.Session; | |||||
} | } | ||||
NetWork().sendMsg(ComId.Chat, 5, seq); | NetWork().sendMsg(ComId.Chat, 5, seq); | ||||
@@ -257,7 +257,9 @@ class MsgHandler { | |||||
static int mLastClickTime = 0; | static int mLastClickTime = 0; | ||||
static int timeInterval = 2500; | static int timeInterval = 2500; | ||||
// static int receivedCount=0; | // static int receivedCount=0; | ||||
static int time; | |||||
static handlerReceiveMsg(PushChat chat) async { | static handlerReceiveMsg(PushChat chat) async { | ||||
bool isGroup = false; | bool isGroup = false; | ||||
bool isTranslateHK = false; | bool isTranslateHK = false; | ||||
if (chat.channelType == ChatChannelType.Group) { | if (chat.channelType == ChatChannelType.Group) { | ||||
@@ -272,17 +274,19 @@ class MsgHandler { | |||||
if (chat.sendUserId == 1) { | if (chat.sendUserId == 1) { | ||||
//更新消息 | //更新消息 | ||||
print('服务器更新消息'); | print('服务器更新消息'); | ||||
MsgModel findMsg; | |||||
MsgModel findMsg; | |||||
int sessionId = chat.targetId; | |||||
var msgList; | var msgList; | ||||
if (isGroup) { | if (isGroup) { | ||||
msgList = ChatDataMgr().getGroupRecord(); | |||||
msgList = ChatDataMgr().getGroupRecord(sessionId: sessionId); | |||||
} else { | } else { | ||||
msgList = ChatDataMgr().getRecord(); | |||||
msgList = ChatDataMgr().getRecord(sessionId: sessionId); | |||||
} | } | ||||
print('msgList ${msgList.length} ${MsgHandler.curActiveSession}'); | |||||
for (var i = 0; i < msgList.length; i++) { | for (var i = 0; i < msgList.length; i++) { | ||||
var msg = msgList[i]; | var msg = msgList[i]; | ||||
print('msg.time ${msg.time} 服务器发来消息 ${chat.sendTime.toInt()}'); | |||||
if (msg.time == chat.sendTime.toInt()) { | if (msg.time == chat.sendTime.toInt()) { | ||||
findMsg = msg; | findMsg = msg; | ||||
} | } | ||||
@@ -417,7 +421,7 @@ class MsgHandler { | |||||
var myId = UserData().basicInfo.userId; | var myId = UserData().basicInfo.userId; | ||||
TransHKChatNotice notice = TransHKChatNotice.fromBuffer(chat.contentBuff); | TransHKChatNotice notice = TransHKChatNotice.fromBuffer(chat.contentBuff); | ||||
BaseUserInfo friendId ; | BaseUserInfo friendId ; | ||||
TranslateHKMgr().isUser = myId== notice.employer.id; ///判断自己是翻译官还是用户 | |||||
TranslateHKMgr().isUser = myId== notice.employer.id; ///判断自己是翻译官还是用户 | |||||
if(myId== notice.employer.id){ | if(myId== notice.employer.id){ | ||||
friendId =notice.inter; | friendId =notice.inter; | ||||
@@ -481,7 +485,8 @@ class MsgHandler { | |||||
} | } | ||||
} else { | } else { | ||||
//聊天消息 | //聊天消息 | ||||
time = DateTime.now().millisecondsSinceEpoch; | |||||
print('******收到聊天消息 $time'); | |||||
int sessionId = chat.targetId; | int sessionId = chat.targetId; | ||||
print('sessionId $sessionId'); | print('sessionId $sessionId'); | ||||
if (isGroup) { | if (isGroup) { | ||||
@@ -999,7 +1004,7 @@ class MsgHandler { | |||||
switch (type) { | switch (type) { | ||||
case 'notice': | case 'notice': | ||||
///由于极光本地推送点击事件无反应,暂时不走这,由远端推 | |||||
///由于极光本地推送点击事件无反应,暂时不走这,由远端推 | |||||
String messageJson = map['message']; | String messageJson = map['message']; | ||||
Map messageMap = json.decode(messageJson); | Map messageMap = json.decode(messageJson); | ||||
@@ -1133,9 +1138,9 @@ class MsgHandler { | |||||
Navigator.pushReplacement(context, | Navigator.pushReplacement(context, | ||||
MaterialPageRoute<void>(builder: (BuildContext context) { | MaterialPageRoute<void>(builder: (BuildContext context) { | ||||
return GroupChatPage( | |||||
key: Key('GroupChat'), groupInfoModel: groupInfoModel); | |||||
})); | |||||
return GroupChatPage( | |||||
key: Key('GroupChat'), groupInfoModel: groupInfoModel); | |||||
})); | |||||
} else { | } else { | ||||
switch (res.errorCode) { | switch (res.errorCode) { | ||||
case 3007: | case 3007: | ||||
@@ -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: | ||||