Sfoglia il codice sorgente

修改实时帮界面/优化本地群推送/

master
jiahao 5 anni fa
parent
commit
99e898e284
20 ha cambiato i file con 258 aggiunte e 95 eliminazioni
  1. +3
    -1
      i18n/en-US.json
  2. +3
    -1
      i18n/ja-JP.json
  3. +3
    -1
      i18n/ko-KR.json
  4. +3
    -1
      i18n/vi-VN.json
  5. +3
    -1
      i18n/zh-CN.json
  6. +4
    -1
      i18n/zh-HK.json
  7. +31
    -6
      lib/chat/ChatPage.dart
  8. +4
    -4
      lib/chat/ChatPageItem.dart
  9. +1
    -0
      lib/chat/group_chat_item.dart
  10. +23
    -0
      lib/chat/group_chat_view.dart
  11. +34
    -0
      lib/generated/i18n.dart
  12. +5
    -5
      lib/home/realtimehelper/real_time_helper_page.dart
  13. +119
    -64
      lib/home/realtimehelper/translation_butler_page.dart
  14. +3
    -1
      lib/home/realtimehelper/translation_evaluation_dialog.dart
  15. +2
    -2
      lib/home/realtimehelper/travel_butler_page.dart
  16. +1
    -1
      lib/home/unread_dot_widget.dart
  17. +1
    -1
      lib/utils/CustomUI.dart
  18. +1
    -1
      lib/utils/group_info_table.dart
  19. +1
    -1
      lib/utils/local_notification_util.dart
  20. +13
    -3
      lib/utils/msgHandler.dart

+ 3
- 1
i18n/en-US.json Vedi File

@@ -1213,7 +1213,9 @@
"translation_scenes_1": "机场/车站", "translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店", "translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧", "translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
} }

+ 3
- 1
i18n/ja-JP.json Vedi File

@@ -1213,5 +1213,7 @@
"translation_scenes_1": "机场/车站", "translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店", "translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧", "translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
} }

+ 3
- 1
i18n/ko-KR.json Vedi File

@@ -1212,5 +1212,7 @@
"translation_scenes_1": "机场/车站", "translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店", "translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧", "translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
} }

+ 3
- 1
i18n/vi-VN.json Vedi File

@@ -1213,5 +1213,7 @@
"translation_scenes_1": "机场/车站", "translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店", "translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧", "translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
} }

+ 3
- 1
i18n/zh-CN.json Vedi File

@@ -1213,5 +1213,7 @@
"translation_scenes_1": "机场/车站", "translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店", "translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧", "translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
} }

+ 4
- 1
i18n/zh-HK.json Vedi File

@@ -1213,6 +1213,9 @@
"translation_scenes_1": "机场/车站", "translation_scenes_1": "机场/车站",
"translation_scenes_2": "餐厅/酒店", "translation_scenes_2": "餐厅/酒店",
"translation_scenes_3": "KTV/酒吧", "translation_scenes_3": "KTV/酒吧",
"translation_scenes_4": "其他"
"translation_scenes_4": "其他",
"translation_input_limit": "还可以输入/s1字",
"translation_more_desc": "更多描述"
} }

+ 31
- 6
lib/chat/ChatPage.dart Vedi File

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:fixnum/fixnum.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:chat/chat/translate_state.dart'; import 'package:chat/chat/translate_state.dart';
import 'package:chat/data/UserData.dart'; import 'package:chat/data/UserData.dart';
@@ -493,7 +494,7 @@ class _ChatPageState extends State<ChatPage> {
return Container( return Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Card( child: Card(
elevation: 5,
elevation: 2,
// 阴影 // 阴影
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
@@ -509,19 +510,20 @@ class _ChatPageState extends State<ChatPage> {
isStart?I18n.of(context).translation_butler_start_service:I18n.of(context).translation_butler_service_end, isStart?I18n.of(context).translation_butler_start_service:I18n.of(context).translation_butler_service_end,
textScaleFactor: 1.0, textScaleFactor: 1.0,
style: TextStyle( style: TextStyle(
color: AppColors.NewAppbarTextColor, fontSize: 15),
color: AppColors.NewAppbarTextColor, fontSize: 14),
), ),
SizedBox(height: 5,),
Text( Text(
isStart?I18n.of(context).translation_butler_start_tips:I18n.of(context).translation_butler_evaluation_tips, isStart?I18n.of(context).translation_butler_start_tips:I18n.of(context).translation_butler_evaluation_tips,
textScaleFactor: 1.0, textScaleFactor: 1.0,
style: TextStyle( style: TextStyle(
color: AppColors.NewAppbarTextColor, fontSize: 13),
color:Color(0xFF797979), fontSize: 11),
) )
], ],
), ),
isStart?Container():Expanded(child: Container( isStart?Container():Expanded(child: Container(
margin: EdgeInsets.only(left: 15 ), margin: EdgeInsets.only(left: 15 ),
height: 30,
height: 35,
child: RaisedButton( child: RaisedButton(
color: Color(0xff3875E9), color: Color(0xff3875E9),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@@ -529,7 +531,7 @@ class _ChatPageState extends State<ChatPage> {
child: Text( child: Text(
I18n.of(context).translation_butler_evaluation , I18n.of(context).translation_butler_evaluation ,
textScaleFactor: 1.0, textScaleFactor: 1.0,
style: TextStyle(color: Colors.white, fontSize: 19),
style: TextStyle(color: Colors.white, fontSize: 15),
), ),
onPressed:(){ onPressed:(){
CustomUI.buildTranslationEvaluationDialog(context); CustomUI.buildTranslationEvaluationDialog(context);
@@ -603,8 +605,31 @@ class _ChatPageState extends State<ChatPage> {
duration: new Duration(milliseconds: 500), curve: Curves.ease); 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) { void receiveMsg(args) {
if (mounted) { if (mounted) {
setState(() {}); setState(() {});


+ 4
- 4
lib/chat/ChatPageItem.dart Vedi File

@@ -662,8 +662,8 @@ class _ChatPageItemState extends State<ChatPageItem>
SoundUtils.instance.savePlayModeConfig(soundPlayMode); SoundUtils.instance.savePlayModeConfig(soundPlayMode);
}); });
} }
return WPopupMenu(
// String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString();
return WPopupMenu(
child: item, child: item,
actions: actions, actions: actions,
onLongPressStart: () { onLongPressStart: () {
@@ -709,11 +709,11 @@ class _ChatPageItemState extends State<ChatPageItem>
RegExp alterStr = RegExp(r'\[([0-9]+)\]'); RegExp alterStr = RegExp(r'\[([0-9]+)\]');
Iterable<Match> matches = alterStr.allMatches(text); Iterable<Match> matches = alterStr.allMatches(text);
print('~~~~~~~~~~~~~~${matches.length}~~~~~~~~~~~~~~~');
// print('~~~~~~~~~~~~~~${matches.length}~~~~~~~~~~~~~~~');
double delta = 0; double delta = 0;
for (Match m in matches) { for (Match m in matches) {
print('~~~~~~~~~~~~~~${m.group(1)}~~~~~~~~~~~~~~~');
// print('~~~~~~~~~~~~~~${m.group(1)}~~~~~~~~~~~~~~~');
if (int.parse(m.group(1)) > 10) { if (int.parse(m.group(1)) > 10) {
delta += 20 + 4 - 25; delta += 20 + 4 - 25;
} else { } else {


+ 1
- 0
lib/chat/group_chat_item.dart Vedi File

@@ -595,6 +595,7 @@ class _GroupChatPageItemState extends State<GroupChatPageItem>
SoundUtils.instance.savePlayModeConfig(soundPlayMode); SoundUtils.instance.savePlayModeConfig(soundPlayMode);
}); });
} }
// String date2 = DateTime.fromMillisecondsSinceEpoch(widget.msg.time).toString();
return WPopupMenu( return WPopupMenu(
child: item, child: item,


+ 23
- 0
lib/chat/group_chat_view.dart Vedi File

@@ -31,6 +31,7 @@ import 'package:provider/provider.dart';
import '../r.dart'; import '../r.dart';
import 'input_bar.dart'; import 'input_bar.dart';
import 'package:chat/models/ref_name_provider.dart'; import 'package:chat/models/ref_name_provider.dart';
import 'package:fixnum/fixnum.dart';
class GroupChatPage extends StatefulWidget { class GroupChatPage extends StatefulWidget {
@@ -419,6 +420,28 @@ class _GroupChatPageState extends State<GroupChatPage> {
_scrollCtrl.animateTo(0, _scrollCtrl.animateTo(0,
duration: new Duration(milliseconds: 500), curve: Curves.ease); 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) { void receiveMsg(args) {


+ 34
- 0
lib/generated/i18n.dart Vedi File

@@ -2463,6 +2463,10 @@ class I18n implements WidgetsLocalizations {
String get translation_scenes_3 => "KTV/酒吧"; String get translation_scenes_3 => "KTV/酒吧";
/// "其他" /// "其他"
String get translation_scenes_4 => "其他"; String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
String get translation_more_desc => "更多描述";
} }


class _I18n_en_US extends I18n { class _I18n_en_US extends I18n {
@@ -6120,6 +6124,12 @@ class _I18n_vi_VN extends I18n {
/// "其他" /// "其他"
@override @override
String get translation_scenes_4 => "其他"; String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";


@override @override
TextDirection get textDirection => TextDirection.ltr; TextDirection get textDirection => TextDirection.ltr;
@@ -9773,6 +9783,12 @@ class _I18n_zh_HK extends I18n {
/// "其他" /// "其他"
@override @override
String get translation_scenes_4 => "其他"; String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";


@override @override
TextDirection get textDirection => TextDirection.ltr; TextDirection get textDirection => TextDirection.ltr;
@@ -13426,6 +13442,12 @@ class _I18n_zh_CN extends _I18n_zh_HK {
/// "其他" /// "其他"
@override @override
String get translation_scenes_4 => "其他"; String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";


@override @override
TextDirection get textDirection => TextDirection.ltr; TextDirection get textDirection => TextDirection.ltr;
@@ -17076,6 +17098,12 @@ class _I18n_ko_KR extends I18n {
/// "其他" /// "其他"
@override @override
String get translation_scenes_4 => "其他"; String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";


@override @override
TextDirection get textDirection => TextDirection.ltr; TextDirection get textDirection => TextDirection.ltr;
@@ -20729,6 +20757,12 @@ class _I18n_ja_JP extends I18n {
/// "其他" /// "其他"
@override @override
String get translation_scenes_4 => "其他"; String get translation_scenes_4 => "其他";
/// "还可以输入/s1字"
@override
String get translation_input_limit => "还可以输入/s1字";
/// "更多描述"
@override
String get translation_more_desc => "更多描述";


@override @override
TextDirection get textDirection => TextDirection.ltr; TextDirection get textDirection => TextDirection.ltr;


+ 5
- 5
lib/home/realtimehelper/real_time_helper_page.dart Vedi File

@@ -58,7 +58,7 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
builder: (_) => TranslationButlerPage(), builder: (_) => TranslationButlerPage(),
), ),
); );
}),
},textColor: Color(0xff2685FA)),
helperCard( helperCard(
I18n.of(context).travel_butler, R.assetsImagesImgTravelButler, I18n.of(context).travel_butler, R.assetsImagesImgTravelButler,
() { () {
@@ -67,7 +67,7 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
builder: (_) => TravelButlerPage(), builder: (_) => TravelButlerPage(),
), ),
); );
}),
},textColor: Color(0xffff682d)),
SizedBox( SizedBox(
height: 15, height: 15,
), ),
@@ -78,12 +78,12 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
); );
} }


Widget helperCard(String title, String assets, Function callBack) {
Widget helperCard(String title, String assets, Function callBack,{Color textColor }) {
return InkWell( return InkWell(
child: Container( child: Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Card( child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25), // side: BorderSide(color: Colors.green,width: 25),
@@ -98,7 +98,7 @@ class RealTimeHelperPageState extends State<RealTimeHelperPage> {
child: Text( child: Text(
title + ' >>', title + ' >>',
textScaleFactor: 1.0, textScaleFactor: 1.0,
style: TextStyle(color: Color(0xff2685FA), fontSize: 20),
style: TextStyle(color: textColor, fontSize: 20),
), ),
) )
], ],


+ 119
- 64
lib/home/realtimehelper/translation_butler_page.dart Vedi File

@@ -51,16 +51,29 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {


String extraMsg; String extraMsg;


FocusNode focusNode = new FocusNode();

String textLimitTips='';
ScrollController _scrollController = new ScrollController();

@override @override
void initState() { void initState() {
super.initState(); super.initState();


initData(); initData();



focusNode.addListener((){
if(focusNode.hasFocus){

}
});


WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {




Future.delayed(Duration(seconds: 2), () {
Future.delayed(Duration(seconds: 4), () {
// CustomUI.buildTranslationHelperOrderDialog(context); // CustomUI.buildTranslationHelperOrderDialog(context);
Navigator.of(context).push( Navigator.of(context).push(
new MaterialPageRoute( new MaterialPageRoute(
@@ -112,6 +125,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();


textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', '80');
langList = [ langList = [
I18n.of(context).english, I18n.of(context).english,
I18n.of(context).Vietnamese, I18n.of(context).Vietnamese,
@@ -147,22 +161,22 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {


return myPop.PopupMenuButton( return myPop.PopupMenuButton(
child: Container( child: Container(
height: 40,
height: 37,
width: double.maxFinite, width: double.maxFinite,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffD3E7FF), color: Color(0xffD3E7FF),
borderRadius: BorderRadius.circular(10)),
borderRadius: BorderRadius.circular(5)),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Expanded( 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), Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily),
size: 30, color: Color(0xff4A5E76)) size: 30, color: Color(0xff4A5E76))
], ],
@@ -210,27 +224,33 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
child: Container( child: Container(
height: 40, height: 40,
width: double.maxFinite, 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: <Widget>[
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: <Widget>[
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), offset: Offset(0, 100),
@@ -246,7 +266,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
(int i) { (int i) {
return myPop.PopupMenuItem( return myPop.PopupMenuItem(
child: Container( child: Container(
width: Screen.width / 2 - 40,
width: Screen.width *0.43,
alignment: Alignment.center, alignment: Alignment.center,
color: Colors.white, color: Colors.white,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
@@ -302,6 +322,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {


Widget applyPage() { Widget applyPage() {
return ListView( return ListView(
controller: _scrollController,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(left: 20, right: 10, top: 15), padding: EdgeInsets.only(left: 20, right: 10, top: 15),
@@ -336,6 +357,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
), ),
Row( Row(
children: <Widget>[ children: <Widget>[
SizedBox(width: 15,),
Expanded( Expanded(
child: _langPopMenu(true), child: _langPopMenu(true),
flex: 5, flex: 5,
@@ -367,9 +389,11 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
child: _langPopMenu(false), child: _langPopMenu(false),
flex: 5, flex: 5,
), ),
SizedBox(width: 15,),
], ],
), ),
Row( Row(

children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Image.asset( child: Image.asset(
@@ -377,10 +401,11 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
width: 195, width: 195,
height: 175, height: 175,
), ),
flex: 1,
flex: 4,
), ),
Expanded( Expanded(
child: Column( child: Column(

children: <Widget>[ children: <Widget>[
Text( Text(
I18n.of(context).translation_butler_scenes, I18n.of(context).translation_butler_scenes,
@@ -388,48 +413,73 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: AppColors.NewAppbarTextColor, color: AppColors.NewAppbarTextColor,
fontWeight: FontWeight.w700,
fontSize: 15), fontSize: 15),
), ),
SizedBox(height: 10,),
_scenesPopMenu(), _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: <Widget>[

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, // maxLines: 1,
inputFormatters: [LengthLimitingTextInputFormatter(160)],
inputFormatters: [LengthLimitingTextInputFormatter(80)],
// obscureText: true, // 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, I18n.of(context).translation_butler_scenes_tips,
textScaleFactor: 1.0, textScaleFactor: 1.0,
style: TextStyle(color: Color(0xFFFA7B3D), fontSize: 12), style: TextStyle(color: Color(0xFFFA7B3D), fontSize: 12),
),
),),


], ],
), ),
@@ -593,7 +643,7 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
width: 190.0, width: 190.0,
child: CircularProgressIndicator( child: CircularProgressIndicator(
//0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值 //0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值
value: null,
value: time60/60,
strokeWidth: 5, strokeWidth: 5,
//背景颜色 //背景颜色
backgroundColor: Color(0xffB2B2B2), backgroundColor: Color(0xffB2B2B2),
@@ -665,11 +715,16 @@ class TranslationButlerPageState extends State<TranslationButlerPage> {
int secondsPassed = 1; int secondsPassed = 1;
int timeStamp; int timeStamp;
Timer timer; Timer timer;
int time60=1;
void handleTick() { void handleTick() {
// if (isActive) { // if (isActive) {
setState(() { setState(() {
secondsPassed = secondsPassed + 1; //需要更新UI secondsPassed = secondsPassed + 1; //需要更新UI

time60=time60+1;
if(time60==60){
time60=0;
}
}); });
// } // }
} }


+ 3
- 1
lib/home/realtimehelper/translation_evaluation_dialog.dart Vedi File

@@ -4,6 +4,8 @@ import 'package:chat/r.dart';
import 'package:chat/utils/screen.dart'; import 'package:chat/utils/screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';



///翻译管家-结束后评论弹窗
class TravelEvaluationPage extends StatefulWidget { class TravelEvaluationPage extends StatefulWidget {
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@@ -64,7 +66,7 @@ class TravelEvaluationPageState extends State<TravelEvaluationPage> {
width: Screen.width - 20, width: Screen.width - 20,
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Card( child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25), // side: BorderSide(color: Colors.green,width: 25),


+ 2
- 2
lib/home/realtimehelper/travel_butler_page.dart Vedi File

@@ -68,7 +68,7 @@ class TravelButlerPageState extends State<TravelButlerPage> {
Container( Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Card( child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25), // side: BorderSide(color: Colors.green,width: 25),
@@ -189,7 +189,7 @@ class TravelButlerPageState extends State<TravelButlerPage> {
Container( Container(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Card( child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25), // side: BorderSide(color: Colors.green,width: 25),


+ 1
- 1
lib/home/unread_dot_widget.dart Vedi File

@@ -28,7 +28,7 @@ class _UnreadDotState extends State<UnreadDot> {
} }
updateDotState(args) { updateDotState(args) {
print('更新未读状态');
// print('更新未读状态');
Future.delayed(Duration(milliseconds: 100), () { Future.delayed(Duration(milliseconds: 100), () {
if (mounted) { if (mounted) {
setState(() {}); setState(() {});


+ 1
- 1
lib/utils/CustomUI.dart Vedi File

@@ -1262,7 +1262,7 @@ class CustomUI {
width: Screen.width-20, width: Screen.width-20,
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
child: Card( child: Card(
elevation: 5, // 阴影
elevation: 2, // 阴影
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
// side: BorderSide(color: Colors.green,width: 25), // side: BorderSide(color: Colors.green,width: 25),


+ 1
- 1
lib/utils/group_info_table.dart Vedi File

@@ -203,7 +203,7 @@ class GroupInfoTableModel {
//修改是否在聊天中展示用户名称 //修改是否在聊天中展示用户名称
updateShowNameSwitch(int sessionId, int isShow) { updateShowNameSwitch(int sessionId, int isShow) {
print('修改是否在聊天中展示用户名称');
print('修改是否在聊天中展示用户名称:$isShow');
var curUserId = UserData().basicInfo.userId; var curUserId = UserData().basicInfo.userId;


+ 1
- 1
lib/utils/local_notification_util.dart Vedi File

@@ -306,7 +306,7 @@ class LocalNotificationUtil {
Future<void> show(String title, String content,{int id}) async { Future<void> show(String title, String content,{int id}) async {
if (!isBackground || !UserData().privatyMsgPushSwitch) { if (!isBackground || !UserData().privatyMsgPushSwitch) {
print('程序在前台,不发生推送通知 || 用户关闭推送');
// print('程序在前台,不发生推送通知 || 用户关闭推送');
return; return;
} }
showNotification(title, content,id: id); showNotification(title, content,id: id);


+ 13
- 3
lib/utils/msgHandler.dart Vedi File

@@ -236,6 +236,7 @@ class MsgHandler {
//获取会话未读消息 //获取会话未读消息
static getUnreadMsgDetail(bool isGroup) { static getUnreadMsgDetail(bool isGroup) {
print('获取未读消息 群$isGroup'); print('获取未读消息 群$isGroup');
// showToast('获取未读消息 群$isGroup');
var seq = RequestTargetUnreadReq.create(); var seq = RequestTargetUnreadReq.create();
seq.targetId = curActiveSession; seq.targetId = curActiveSession;
@@ -250,6 +251,7 @@ class MsgHandler {
NetWork().sendMsg(ComId.Chat, 5, seq); NetWork().sendMsg(ComId.Chat, 5, seq);
} }
static int tempGroupId=0;
static handlerReceiveMsg(PushChat chat) async { static handlerReceiveMsg(PushChat chat) async {
bool isGroup = false; bool isGroup = false;
if (chat.channelType == ChatChannelType.Group) { if (chat.channelType == ChatChannelType.Group) {
@@ -426,6 +428,10 @@ class MsgHandler {
} }
} }
} else { //聊天消息 } else { //聊天消息
// receivedCount++;
int sessionId = chat.targetId; int sessionId = chat.targetId;
print('sessionId $sessionId'); print('sessionId $sessionId');
if (isGroup) { if (isGroup) {
@@ -436,7 +442,8 @@ class MsgHandler {
if (groupInfo != null) { if (groupInfo != null) {
showGroup = groupInfo.messageFree == 0; showGroup = groupInfo.messageFree == 0;
} }
if (showGroup) {
if (showGroup && tempGroupId!=sessionId) {
tempGroupId = sessionId;
LocalNotificationUtil.instance.show( LocalNotificationUtil.instance.show(
I18n.of(context).notice, I18n.of(context).new_chat_msg, I18n.of(context).notice, I18n.of(context).new_chat_msg,
id: sessionId > 1000 id: sessionId > 1000
@@ -453,6 +460,9 @@ class MsgHandler {
chat.contentBuff, chat.sendTime.toInt(), chat.targetId, chat.contentBuff, chat.sendTime.toInt(), chat.targetId,
channelType: chat.channelType.value); channelType: chat.channelType.value);
String content =utf8.decode(msgModel.msgContent);
// print('当前收到消息条数$receivedCount $content');
if (chat.hasTencentTranslate()) { if (chat.hasTencentTranslate()) {
msgModel.translateContent = chat.tencentTranslate; msgModel.translateContent = chat.tencentTranslate;
} }
@@ -511,7 +521,7 @@ class MsgHandler {
print('消息为空,无法保存'); print('消息为空,无法保存');
return; return;
} }
print('收到消息,准备保存 会话Id:${msgModel.sessionId}');
// print('收到消息,准备保存 会话Id:${msgModel.sessionId}');
ChatDataMgr().saveMsg(msgModel); ChatDataMgr().saveMsg(msgModel);
if (msgModel.msgType == ChatType.ShortVoiceChatType.value) { if (msgModel.msgType == ChatType.ShortVoiceChatType.value) {
//如果是语音消息,自动下载 //如果是语音消息,自动下载
@@ -807,7 +817,7 @@ class MsgHandler {
} }
} else if (msgId == 3) { } else if (msgId == 3) {
var msgContent = PushChat.fromBuffer(content); var msgContent = PushChat.fromBuffer(content);
print('收到聊天消息');
// print('收到聊天消息');
ackServerMsg(msgContent.sendTime); ackServerMsg(msgContent.sendTime);
handlerReceiveMsg(msgContent); handlerReceiveMsg(msgContent);
} else if (msgId == 4) { } else if (msgId == 4) {


Caricamento…
Annulla
Salva