From 99e898e284df100d0ffb651316a8b9ae41c2ab98 Mon Sep 17 00:00:00 2001 From: jiahao <283739569@qq.com> Date: Fri, 20 Mar 2020 18:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E6=97=B6=E5=B8=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2/=E4=BC=98=E5=8C=96=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=BE=A4=E6=8E=A8=E9=80=81/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/en-US.json | 4 +- i18n/ja-JP.json | 4 +- i18n/ko-KR.json | 4 +- i18n/vi-VN.json | 4 +- i18n/zh-CN.json | 4 +- i18n/zh-HK.json | 5 +- lib/chat/ChatPage.dart | 37 +++- lib/chat/ChatPageItem.dart | 8 +- lib/chat/group_chat_item.dart | 1 + lib/chat/group_chat_view.dart | 23 +++ lib/generated/i18n.dart | 34 ++++ .../realtimehelper/real_time_helper_page.dart | 10 +- .../translation_butler_page.dart | 183 ++++++++++++------ .../translation_evaluation_dialog.dart | 4 +- .../realtimehelper/travel_butler_page.dart | 4 +- lib/home/unread_dot_widget.dart | 2 +- lib/utils/CustomUI.dart | 2 +- lib/utils/group_info_table.dart | 2 +- lib/utils/local_notification_util.dart | 2 +- lib/utils/msgHandler.dart | 16 +- 20 files changed, 258 insertions(+), 95 deletions(-) diff --git a/i18n/en-US.json b/i18n/en-US.json index 1eea443..a3d7407 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -1213,7 +1213,9 @@ "translation_scenes_1": "机场/车站", "translation_scenes_2": "餐厅/酒店", "translation_scenes_3": "KTV/酒吧", - "translation_scenes_4": "其他" + "translation_scenes_4": "其他", + "translation_input_limit": "还可以输入/s1字", + "translation_more_desc": "更多描述" } \ No newline at end of file diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json index 7e3000d..fc4bdfb 100644 --- a/i18n/ja-JP.json +++ b/i18n/ja-JP.json @@ -1213,5 +1213,7 @@ "translation_scenes_1": "机场/车站", "translation_scenes_2": "餐厅/酒店", "translation_scenes_3": "KTV/酒吧", - "translation_scenes_4": "其他" + "translation_scenes_4": "其他", + "translation_input_limit": "还可以输入/s1字", + "translation_more_desc": "更多描述" } \ No newline at end of file diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json index c7cee59..ee93407 100644 --- a/i18n/ko-KR.json +++ b/i18n/ko-KR.json @@ -1212,5 +1212,7 @@ "translation_scenes_1": "机场/车站", "translation_scenes_2": "餐厅/酒店", "translation_scenes_3": "KTV/酒吧", - "translation_scenes_4": "其他" + "translation_scenes_4": "其他", + "translation_input_limit": "还可以输入/s1字", + "translation_more_desc": "更多描述" } \ No newline at end of file diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json index 2788b79..c09317b 100644 --- a/i18n/vi-VN.json +++ b/i18n/vi-VN.json @@ -1213,5 +1213,7 @@ "translation_scenes_1": "机场/车站", "translation_scenes_2": "餐厅/酒店", "translation_scenes_3": "KTV/酒吧", - "translation_scenes_4": "其他" + "translation_scenes_4": "其他", + "translation_input_limit": "还可以输入/s1字", + "translation_more_desc": "更多描述" } \ No newline at end of file diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index 26eda67..ca92718 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -1213,5 +1213,7 @@ "translation_scenes_1": "机场/车站", "translation_scenes_2": "餐厅/酒店", "translation_scenes_3": "KTV/酒吧", - "translation_scenes_4": "其他" + "translation_scenes_4": "其他", + "translation_input_limit": "还可以输入/s1字", + "translation_more_desc": "更多描述" } \ No newline at end of file diff --git a/i18n/zh-HK.json b/i18n/zh-HK.json index 9530d60..85bedc4 100644 --- a/i18n/zh-HK.json +++ b/i18n/zh-HK.json @@ -1213,6 +1213,9 @@ "translation_scenes_1": "机场/车站", "translation_scenes_2": "餐厅/酒店", "translation_scenes_3": "KTV/酒吧", - "translation_scenes_4": "其他" + "translation_scenes_4": "其他", + "translation_input_limit": "还可以输入/s1字", + "translation_more_desc": "更多描述" + } \ No newline at end of file diff --git a/lib/chat/ChatPage.dart b/lib/chat/ChatPage.dart index f3c2441..f478227 100644 --- a/lib/chat/ChatPage.dart +++ b/lib/chat/ChatPage.dart @@ -1,5 +1,6 @@ +import 'dart:convert'; import 'dart:io'; - +import 'package:fixnum/fixnum.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:chat/chat/translate_state.dart'; import 'package:chat/data/UserData.dart'; @@ -493,7 +494,7 @@ class _ChatPageState extends State { return Container( margin: EdgeInsets.all(10), child: Card( - elevation: 5, + elevation: 2, // 阴影 shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -509,19 +510,20 @@ class _ChatPageState extends State { 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), + color: AppColors.NewAppbarTextColor, fontSize: 14), ), + SizedBox(height: 5,), Text( isStart?I18n.of(context).translation_butler_start_tips:I18n.of(context).translation_butler_evaluation_tips, textScaleFactor: 1.0, style: TextStyle( - color: AppColors.NewAppbarTextColor, fontSize: 13), + color:Color(0xFF797979), fontSize: 11), ) ], ), isStart?Container():Expanded(child: Container( margin: EdgeInsets.only(left: 15 ), - height: 30, + height: 35, child: RaisedButton( color: Color(0xff3875E9), shape: RoundedRectangleBorder( @@ -529,7 +531,7 @@ class _ChatPageState extends State { child: Text( I18n.of(context).translation_butler_evaluation , textScaleFactor: 1.0, - style: TextStyle(color: Colors.white, fontSize: 19), + style: TextStyle(color: Colors.white, fontSize: 15), ), onPressed:(){ CustomUI.buildTranslationEvaluationDialog(context); @@ -603,8 +605,31 @@ class _ChatPageState extends State { duration: new Duration(milliseconds: 500), curve: Curves.ease); } } +// testBig(msg); } + MsgModel msg; + int count=0; + testBig(MsgModel msg)async{ + + + + for(int k=0;k<100;k++){ + msg.msgContent = utf8.encode('测试$count'); + Int64 time = Int64((DateTime.now()).millisecondsSinceEpoch); + msg.time = time.toInt(); + MsgHandler.insertMsgToDB(msg); + MsgHandler.sendChatMsg(msg); + await Future.delayed(Duration(milliseconds: 500),(){}); + count++; + } + count=0; + print('发送完毕'); + showToast('发送完毕'); + } + + + void receiveMsg(args) { if (mounted) { setState(() {}); diff --git a/lib/chat/ChatPageItem.dart b/lib/chat/ChatPageItem.dart index 98feaae..d72f9a5 100644 --- a/lib/chat/ChatPageItem.dart +++ b/lib/chat/ChatPageItem.dart @@ -662,8 +662,8 @@ class _ChatPageItemState extends State SoundUtils.instance.savePlayModeConfig(soundPlayMode); }); } - - return WPopupMenu( +// String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString(); + return WPopupMenu( child: item, actions: actions, onLongPressStart: () { @@ -709,11 +709,11 @@ class _ChatPageItemState extends State RegExp alterStr = RegExp(r'\[([0-9]+)\]'); Iterable matches = alterStr.allMatches(text); - print('~~~~~~~~~~~~~~${matches.length}~~~~~~~~~~~~~~~'); +// print('~~~~~~~~~~~~~~${matches.length}~~~~~~~~~~~~~~~'); double delta = 0; for (Match m in matches) { - print('~~~~~~~~~~~~~~${m.group(1)}~~~~~~~~~~~~~~~'); +// print('~~~~~~~~~~~~~~${m.group(1)}~~~~~~~~~~~~~~~'); if (int.parse(m.group(1)) > 10) { delta += 20 + 4 - 25; } else { diff --git a/lib/chat/group_chat_item.dart b/lib/chat/group_chat_item.dart index ba24ceb..3d59422 100644 --- a/lib/chat/group_chat_item.dart +++ b/lib/chat/group_chat_item.dart @@ -595,6 +595,7 @@ class _GroupChatPageItemState extends State SoundUtils.instance.savePlayModeConfig(soundPlayMode); }); } +// String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString(); return WPopupMenu( child: item, diff --git a/lib/chat/group_chat_view.dart b/lib/chat/group_chat_view.dart index cf76619..d62bdc5 100644 --- a/lib/chat/group_chat_view.dart +++ b/lib/chat/group_chat_view.dart @@ -31,6 +31,7 @@ import 'package:provider/provider.dart'; import '../r.dart'; import 'input_bar.dart'; import 'package:chat/models/ref_name_provider.dart'; +import 'package:fixnum/fixnum.dart'; class GroupChatPage extends StatefulWidget { @@ -419,6 +420,28 @@ class _GroupChatPageState extends State { _scrollCtrl.animateTo(0, duration: new Duration(milliseconds: 500), curve: Curves.ease); } + +// testBig(msg); + } + + MsgModel msg; + int count=0; + testBig(MsgModel msg)async{ + + + + for(int k=0;k<100;k++){ + msg.msgContent = utf8.encode('测试$count'); + Int64 time = Int64((DateTime.now()).millisecondsSinceEpoch); + msg.time = time.toInt(); + MsgHandler.insertMsgToDB(msg); + MsgHandler.sendChatMsg(msg); + await Future.delayed(Duration(milliseconds: 300),(){}); + count++; + } + count=0; + print('攻击完毕'); + showToast('攻击完毕'); } void receiveMsg(args) { diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 27d1e60..1c6d9ee 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -2463,6 +2463,10 @@ class I18n implements WidgetsLocalizations { String get translation_scenes_3 => "KTV/酒吧"; /// "其他" String get translation_scenes_4 => "其他"; + /// "还可以输入/s1字" + String get translation_input_limit => "还可以输入/s1字"; + /// "更多描述" + String get translation_more_desc => "更多描述"; } class _I18n_en_US extends I18n { @@ -6120,6 +6124,12 @@ class _I18n_vi_VN extends I18n { /// "其他" @override String get translation_scenes_4 => "其他"; + /// "还可以输入/s1字" + @override + String get translation_input_limit => "还可以输入/s1字"; + /// "更多描述" + @override + String get translation_more_desc => "更多描述"; @override TextDirection get textDirection => TextDirection.ltr; @@ -9773,6 +9783,12 @@ class _I18n_zh_HK extends I18n { /// "其他" @override String get translation_scenes_4 => "其他"; + /// "还可以输入/s1字" + @override + String get translation_input_limit => "还可以输入/s1字"; + /// "更多描述" + @override + String get translation_more_desc => "更多描述"; @override TextDirection get textDirection => TextDirection.ltr; @@ -13426,6 +13442,12 @@ class _I18n_zh_CN extends _I18n_zh_HK { /// "其他" @override String get translation_scenes_4 => "其他"; + /// "还可以输入/s1字" + @override + String get translation_input_limit => "还可以输入/s1字"; + /// "更多描述" + @override + String get translation_more_desc => "更多描述"; @override TextDirection get textDirection => TextDirection.ltr; @@ -17076,6 +17098,12 @@ class _I18n_ko_KR extends I18n { /// "其他" @override String get translation_scenes_4 => "其他"; + /// "还可以输入/s1字" + @override + String get translation_input_limit => "还可以输入/s1字"; + /// "更多描述" + @override + String get translation_more_desc => "更多描述"; @override TextDirection get textDirection => TextDirection.ltr; @@ -20729,6 +20757,12 @@ class _I18n_ja_JP extends I18n { /// "其他" @override String get translation_scenes_4 => "其他"; + /// "还可以输入/s1字" + @override + String get translation_input_limit => "还可以输入/s1字"; + /// "更多描述" + @override + String get translation_more_desc => "更多描述"; @override TextDirection get textDirection => TextDirection.ltr; diff --git a/lib/home/realtimehelper/real_time_helper_page.dart b/lib/home/realtimehelper/real_time_helper_page.dart index a7ba1ad..322f695 100644 --- a/lib/home/realtimehelper/real_time_helper_page.dart +++ b/lib/home/realtimehelper/real_time_helper_page.dart @@ -58,7 +58,7 @@ class RealTimeHelperPageState extends State { builder: (_) => TranslationButlerPage(), ), ); - }), + },textColor: Color(0xff2685FA)), helperCard( I18n.of(context).travel_butler, R.assetsImagesImgTravelButler, () { @@ -67,7 +67,7 @@ class RealTimeHelperPageState extends State { builder: (_) => TravelButlerPage(), ), ); - }), + },textColor: Color(0xffff682d)), SizedBox( height: 15, ), @@ -78,12 +78,12 @@ class RealTimeHelperPageState extends State { ); } - Widget helperCard(String title, String assets, Function callBack) { + Widget helperCard(String title, String assets, Function callBack,{Color textColor }) { return InkWell( child: Container( margin: EdgeInsets.all(10), child: Card( - elevation: 5, // 阴影 + elevation: 2, // 阴影 shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), // side: BorderSide(color: Colors.green,width: 25), @@ -98,7 +98,7 @@ class RealTimeHelperPageState extends State { child: Text( title + ' >>', textScaleFactor: 1.0, - style: TextStyle(color: Color(0xff2685FA), fontSize: 20), + style: TextStyle(color: textColor, fontSize: 20), ), ) ], diff --git a/lib/home/realtimehelper/translation_butler_page.dart b/lib/home/realtimehelper/translation_butler_page.dart index 90eafda..06e0e8d 100644 --- a/lib/home/realtimehelper/translation_butler_page.dart +++ b/lib/home/realtimehelper/translation_butler_page.dart @@ -51,16 +51,29 @@ class TranslationButlerPageState extends State { String extraMsg; + FocusNode focusNode = new FocusNode(); + + String textLimitTips=''; + ScrollController _scrollController = new ScrollController(); + @override void initState() { super.initState(); initData(); + + focusNode.addListener((){ + if(focusNode.hasFocus){ + + } + }); + + WidgetsBinding.instance.addPostFrameCallback((_) { - Future.delayed(Duration(seconds: 2), () { + Future.delayed(Duration(seconds: 4), () { // CustomUI.buildTranslationHelperOrderDialog(context); Navigator.of(context).push( new MaterialPageRoute( @@ -112,6 +125,7 @@ class TranslationButlerPageState extends State { void didChangeDependencies() { super.didChangeDependencies(); + textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', '80'); langList = [ I18n.of(context).english, I18n.of(context).Vietnamese, @@ -147,22 +161,22 @@ class TranslationButlerPageState extends State { return myPop.PopupMenuButton( child: Container( - height: 40, + height: 37, width: double.maxFinite, decoration: BoxDecoration( color: Color(0xffD3E7FF), - borderRadius: BorderRadius.circular(10)), + borderRadius: BorderRadius.circular(5)), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ Expanded( - child: Text( - langList[curIndex], - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - textScaleFactor: 1.0, - style: TextStyle(color: Color(0xff4A5E76), fontSize: 14), - )), + child: Container(padding: EdgeInsets.only(left: 5),alignment: Alignment.center,child: Text( + langList[curIndex], + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + textScaleFactor: 1.0, + style: TextStyle(color: Color(0xff4A5E76), fontSize: 14), + ),)), Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily), size: 30, color: Color(0xff4A5E76)) ], @@ -210,27 +224,33 @@ class TranslationButlerPageState extends State { child: Container( height: 40, width: double.maxFinite, - child: Card( - elevation: 2, // 阴影 - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), -// side: BorderSide(color: Colors.green,width: 25), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: Text( - scenesList[curIndex], - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - textScaleFactor: 1.0, - style: TextStyle(color: Color(0xff3875E9), fontSize: 14), - )), - Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily), - size: 30, color: Color(0xff4A5E76)) - ], - ), + decoration:BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(6)), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0x739f9f9f), + offset: Offset(0.2, 0.4), + blurRadius: 1.0, + spreadRadius: 0.6), +// BoxShadow( +// color: Color(0x9900FF00), offset: Offset(1.0, 1.0)), +// BoxShadow(color: Color(0xFF0000FF)) + ]), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: Text( + scenesList[curIndex], + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + textScaleFactor: 1.0, + style: TextStyle(color: Color(0xff3875E9), fontSize: 14), + )), + Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily), + size: 30, color: Color(0xff4A5E76)) + ], ), ), offset: Offset(0, 100), @@ -246,7 +266,7 @@ class TranslationButlerPageState extends State { (int i) { return myPop.PopupMenuItem( child: Container( - width: Screen.width / 2 - 40, + width: Screen.width *0.43, alignment: Alignment.center, color: Colors.white, padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), @@ -302,6 +322,7 @@ class TranslationButlerPageState extends State { Widget applyPage() { return ListView( + controller: _scrollController, children: [ Padding( padding: EdgeInsets.only(left: 20, right: 10, top: 15), @@ -336,6 +357,7 @@ class TranslationButlerPageState extends State { ), Row( children: [ + SizedBox(width: 15,), Expanded( child: _langPopMenu(true), flex: 5, @@ -367,9 +389,11 @@ class TranslationButlerPageState extends State { child: _langPopMenu(false), flex: 5, ), + SizedBox(width: 15,), ], ), Row( + children: [ Expanded( child: Image.asset( @@ -377,10 +401,11 @@ class TranslationButlerPageState extends State { width: 195, height: 175, ), - flex: 1, + flex: 4, ), Expanded( child: Column( + children: [ Text( I18n.of(context).translation_butler_scenes, @@ -388,48 +413,73 @@ class TranslationButlerPageState extends State { textAlign: TextAlign.left, style: TextStyle( color: AppColors.NewAppbarTextColor, + fontWeight: FontWeight.w700, fontSize: 15), ), + SizedBox(height: 10,), _scenesPopMenu(), ], ), - flex: 1, + flex: 6, ) ], ), - Container( - alignment: Alignment.topLeft, - height: 100.5, - width: Screen.width-50, - padding: EdgeInsets.only(left: 17), -// constraints: BoxConstraints( -// minHeight: 82, -// ), - decoration: BoxDecoration( - color: Color(0xFFE9EEF4), - borderRadius: BorderRadius.all(Radius.circular(10))), - child: TextField( - keyboardAppearance: Brightness.light, - decoration: new InputDecoration( - hintText: I18n.of(context).set_password2, - hintStyle: TextStyle(fontSize: 14), - border: InputBorder.none, - ), + Stack(children: [ + + Container( + alignment: Alignment.topLeft, + height: 110.5, + padding: EdgeInsets.only(bottom: 10), + decoration: BoxDecoration( + color: Color(0xFFE9EEF4), + borderRadius: BorderRadius.all(Radius.circular(10))), + child: TextField( + keyboardAppearance: Brightness.light, + maxLines: 10, + focusNode: focusNode, + textInputAction: TextInputAction.done, + onSubmitted: (input) { + focusNode.unfocus(); + + }, + decoration: new InputDecoration( + hintText: I18n.of(context).translation_more_desc, + hintStyle: TextStyle(fontSize: 14), + border: InputBorder.none, + + ), // maxLines: 1, - inputFormatters: [LengthLimitingTextInputFormatter(160)], + inputFormatters: [LengthLimitingTextInputFormatter(80)], // obscureText: true, - style: TextStyle(textBaseline: TextBaseline.alphabetic), - onChanged: (str) { - extraMsg = str; - setState(() {}); - }, - ), - ), - Text( + style: TextStyle(textBaseline: TextBaseline.alphabetic), + onChanged: (str) { + if (_scrollController != null) { + ///解决键盘遮挡输入框 + _scrollController.position.moveTo( + 200, + duration: Duration(milliseconds: 100), + curve: Curves.easeIn, + ); + } + extraMsg = str; + textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', (80-str.length).toString()); + setState(() {}); + }, + ), + ), + + + Positioned.fill(child: Container(padding: EdgeInsets.only(bottom: 5,right: 5),alignment: Alignment.bottomRight,child: Text( + textLimitTips, + textScaleFactor: 1.0, + style: TextStyle(color: Color(0xFF95A3B2), fontSize: 11), + ),)), + ],), + Padding(padding: EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 8),child: Text( I18n.of(context).translation_butler_scenes_tips, textScaleFactor: 1.0, style: TextStyle(color: Color(0xFFFA7B3D), fontSize: 12), - ), + ),), ], ), @@ -593,7 +643,7 @@ class TranslationButlerPageState extends State { width: 190.0, child: CircularProgressIndicator( //0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值 - value: null, + value: time60/60, strokeWidth: 5, //背景颜色 backgroundColor: Color(0xffB2B2B2), @@ -665,11 +715,16 @@ class TranslationButlerPageState extends State { int secondsPassed = 1; int timeStamp; Timer timer; - + int time60=1; void handleTick() { // if (isActive) { setState(() { secondsPassed = secondsPassed + 1; //需要更新UI + + time60=time60+1; + if(time60==60){ + time60=0; + } }); // } } diff --git a/lib/home/realtimehelper/translation_evaluation_dialog.dart b/lib/home/realtimehelper/translation_evaluation_dialog.dart index 9cb0b5b..865f588 100644 --- a/lib/home/realtimehelper/translation_evaluation_dialog.dart +++ b/lib/home/realtimehelper/translation_evaluation_dialog.dart @@ -4,6 +4,8 @@ import 'package:chat/r.dart'; import 'package:chat/utils/screen.dart'; import 'package:flutter/material.dart'; + +///翻译管家-结束后评论弹窗 class TravelEvaluationPage extends StatefulWidget { @override State createState() { @@ -64,7 +66,7 @@ class TravelEvaluationPageState extends State { width: Screen.width - 20, margin: EdgeInsets.all(10), child: Card( - elevation: 5, // 阴影 + elevation: 2, // 阴影 shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), // side: BorderSide(color: Colors.green,width: 25), diff --git a/lib/home/realtimehelper/travel_butler_page.dart b/lib/home/realtimehelper/travel_butler_page.dart index aab9d49..19ba83f 100644 --- a/lib/home/realtimehelper/travel_butler_page.dart +++ b/lib/home/realtimehelper/travel_butler_page.dart @@ -68,7 +68,7 @@ class TravelButlerPageState extends State { Container( margin: EdgeInsets.all(10), child: Card( - elevation: 5, // 阴影 + elevation: 2, // 阴影 shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), // side: BorderSide(color: Colors.green,width: 25), @@ -189,7 +189,7 @@ class TravelButlerPageState extends State { Container( margin: EdgeInsets.all(10), child: Card( - elevation: 5, // 阴影 + elevation: 2, // 阴影 shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), // side: BorderSide(color: Colors.green,width: 25), diff --git a/lib/home/unread_dot_widget.dart b/lib/home/unread_dot_widget.dart index 58eec2a..ec3ae92 100644 --- a/lib/home/unread_dot_widget.dart +++ b/lib/home/unread_dot_widget.dart @@ -28,7 +28,7 @@ class _UnreadDotState extends State { } updateDotState(args) { - print('更新未读状态'); +// print('更新未读状态'); Future.delayed(Duration(milliseconds: 100), () { if (mounted) { setState(() {}); diff --git a/lib/utils/CustomUI.dart b/lib/utils/CustomUI.dart index 76cb3e9..b67942c 100644 --- a/lib/utils/CustomUI.dart +++ b/lib/utils/CustomUI.dart @@ -1262,7 +1262,7 @@ class CustomUI { width: Screen.width-20, margin: EdgeInsets.all(10), child: Card( - elevation: 5, // 阴影 + elevation: 2, // 阴影 shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), // side: BorderSide(color: Colors.green,width: 25), diff --git a/lib/utils/group_info_table.dart b/lib/utils/group_info_table.dart index f437197..0854b9e 100644 --- a/lib/utils/group_info_table.dart +++ b/lib/utils/group_info_table.dart @@ -203,7 +203,7 @@ class GroupInfoTableModel { //修改是否在聊天中展示用户名称 updateShowNameSwitch(int sessionId, int isShow) { - print('修改是否在聊天中展示用户名称'); + print('修改是否在聊天中展示用户名称:$isShow'); var curUserId = UserData().basicInfo.userId; diff --git a/lib/utils/local_notification_util.dart b/lib/utils/local_notification_util.dart index 95004a7..2ec28e5 100644 --- a/lib/utils/local_notification_util.dart +++ b/lib/utils/local_notification_util.dart @@ -306,7 +306,7 @@ class LocalNotificationUtil { Future show(String title, String content,{int id}) async { if (!isBackground || !UserData().privatyMsgPushSwitch) { - print('程序在前台,不发生推送通知 || 用户关闭推送'); +// print('程序在前台,不发生推送通知 || 用户关闭推送'); return; } showNotification(title, content,id: id); diff --git a/lib/utils/msgHandler.dart b/lib/utils/msgHandler.dart index 622c367..e518632 100644 --- a/lib/utils/msgHandler.dart +++ b/lib/utils/msgHandler.dart @@ -236,6 +236,7 @@ class MsgHandler { //获取会话未读消息 static getUnreadMsgDetail(bool isGroup) { print('获取未读消息 群$isGroup'); +// showToast('获取未读消息 群$isGroup'); var seq = RequestTargetUnreadReq.create(); seq.targetId = curActiveSession; @@ -250,6 +251,7 @@ class MsgHandler { NetWork().sendMsg(ComId.Chat, 5, seq); } + static int tempGroupId=0; static handlerReceiveMsg(PushChat chat) async { bool isGroup = false; if (chat.channelType == ChatChannelType.Group) { @@ -426,6 +428,10 @@ class MsgHandler { } } } else { //聊天消息 + +// receivedCount++; + + int sessionId = chat.targetId; print('sessionId $sessionId'); if (isGroup) { @@ -436,7 +442,8 @@ class MsgHandler { if (groupInfo != null) { showGroup = groupInfo.messageFree == 0; } - if (showGroup) { + if (showGroup && tempGroupId!=sessionId) { + tempGroupId = sessionId; LocalNotificationUtil.instance.show( I18n.of(context).notice, I18n.of(context).new_chat_msg, id: sessionId > 1000 @@ -453,6 +460,9 @@ class MsgHandler { chat.contentBuff, chat.sendTime.toInt(), chat.targetId, channelType: chat.channelType.value); + String content =utf8.decode(msgModel.msgContent); +// print('当前收到消息条数$receivedCount $content'); + if (chat.hasTencentTranslate()) { msgModel.translateContent = chat.tencentTranslate; } @@ -511,7 +521,7 @@ class MsgHandler { print('消息为空,无法保存'); return; } - print('收到消息,准备保存 会话Id:${msgModel.sessionId}'); +// print('收到消息,准备保存 会话Id:${msgModel.sessionId}'); ChatDataMgr().saveMsg(msgModel); if (msgModel.msgType == ChatType.ShortVoiceChatType.value) { //如果是语音消息,自动下载 @@ -807,7 +817,7 @@ class MsgHandler { } } else if (msgId == 3) { var msgContent = PushChat.fromBuffer(content); - print('收到聊天消息'); +// print('收到聊天消息'); ackServerMsg(msgContent.sendTime); handlerReceiveMsg(msgContent); } else if (msgId == 4) {