From c8a4839780f31aa0f83766521638ef66a6281ddf Mon Sep 17 00:00:00 2001 From: jiahao <283739569@qq.com> Date: Tue, 24 Mar 2020 18:12:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E8=81=8A=E8=BD=AC=E5=8F=91=E6=B6=88?= =?UTF-8?q?=E6=81=AF/=E4=BF=AE=E5=A4=8D=E8=8B=B9=E6=9E=9C=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E9=97=AA=E9=80=80/=E7=BF=BB=E8=AF=91=E7=AE=A1?= =?UTF-8?q?=E5=AE=B6=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/en-US.json | 3 +- i18n/ja-JP.json | 3 +- i18n/ko-KR.json | 3 +- i18n/vi-VN.json | 3 +- i18n/zh-CN.json | 4 +- i18n/zh-HK.json | 3 +- lib/chat/ChatPageItem.dart | 2 +- lib/chat/group_chat_item.dart | 6 +- lib/data/constants.dart | 1 + lib/generated/i18n.dart | 17 + lib/home/ConversActionPage.dart | 1318 ++++++++--------- lib/home/homeMain.dart | 143 +- .../translation_butler_page.dart | 51 +- lib/main.dart | 6 + lib/proto/interpreter.pb.dart | 250 ++++ lib/proto/interpreter.pbenum.dart | 30 + lib/proto/interpreter.pbjson.dart | 75 + lib/proto/interpreter.pbserver.dart | 9 + lib/proto/interpreter.proto | 55 + lib/utils/CustomUI.dart | 56 +- lib/utils/NetUtil.dart | 2 +- lib/utils/app_navigator.dart | 4 +- lib/utils/msgHandler.dart | 99 ++ lib/utils/wpop/w_popup_menu.dart | 2 +- pubspec.lock | 6 +- pubspec.yaml | 3 +- 26 files changed, 1382 insertions(+), 772 deletions(-) create mode 100644 lib/proto/interpreter.pb.dart create mode 100644 lib/proto/interpreter.pbenum.dart create mode 100644 lib/proto/interpreter.pbjson.dart create mode 100644 lib/proto/interpreter.pbserver.dart create mode 100644 lib/proto/interpreter.proto diff --git a/i18n/en-US.json b/i18n/en-US.json index 9023b62..d350fe8 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -1219,5 +1219,6 @@ "translation_input_limit": "还可以输入/s1字", "translation_more_desc": "更多描述", "feedback_assistant": "反馈小助手", - "feedback_tips":"有什么问题都可以反馈给我哦" + "feedback_tips":"有什么问题都可以反馈给我哦", + "forward":"Forward" } \ No newline at end of file diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json index de76b5c..c19986c 100644 --- a/i18n/ja-JP.json +++ b/i18n/ja-JP.json @@ -1219,5 +1219,6 @@ "translation_input_limit": "还可以输入/s1字", "translation_more_desc": "更多描述", "feedback_assistant": "反馈小助手", - "feedback_tips":"有什么问题都可以反馈给我哦" + "feedback_tips":"有什么问题都可以反馈给我哦", + "forward":"转发" } \ No newline at end of file diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json index ebe3afe..5cc46fe 100644 --- a/i18n/ko-KR.json +++ b/i18n/ko-KR.json @@ -1219,5 +1219,6 @@ "translation_input_limit": "还可以输入/s1字", "translation_more_desc": "更多描述", "feedback_assistant": "反馈小助手", - "feedback_tips": "有什么问题都可以反馈给我哦" + "feedback_tips": "有什么问题都可以反馈给我哦", + "forward":"转发" } \ No newline at end of file diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json index f25c0c9..5f715c7 100644 --- a/i18n/vi-VN.json +++ b/i18n/vi-VN.json @@ -1219,5 +1219,6 @@ "translation_input_limit": "还可以输入/s1字", "translation_more_desc": "更多描述", "feedback_assistant": "反馈小助手", - "feedback_tips":"有什么问题都可以反馈给我哦" + "feedback_tips":"有什么问题都可以反馈给我哦", + "forward":"转发" } \ No newline at end of file diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index d7e67f7..caca255 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -1219,5 +1219,7 @@ "file": "文件", "max_file": "文件大于/s1M", "feedback_assistant":"反馈小助手", - "feedback_tips":"有什么问题都可以反馈给我哦" + "feedback_tips":"有什么问题都可以反馈给我哦", + "forward":"转发" + } \ No newline at end of file diff --git a/i18n/zh-HK.json b/i18n/zh-HK.json index d6c91be..ffc5889 100644 --- a/i18n/zh-HK.json +++ b/i18n/zh-HK.json @@ -1219,5 +1219,6 @@ "translation_input_limit": "还可以输入/s1字", "translation_more_desc": "更多描述", "feedback_assistant": "反饋小助手", - "feedback_tips":"有什麼問題都可以反饋給我哦" + "feedback_tips":"有什麼問題都可以反饋給我哦", + "forward":"转发" } \ No newline at end of file diff --git a/lib/chat/ChatPageItem.dart b/lib/chat/ChatPageItem.dart index d72f9a5..4d14114 100644 --- a/lib/chat/ChatPageItem.dart +++ b/lib/chat/ChatPageItem.dart @@ -623,7 +623,7 @@ class _ChatPageItemState extends State List actions = [ I18n.of(context).delete, I18n.of(context).reply, - '转发' + I18n.of(context).forward ]; actionsFunc.add(() { diff --git a/lib/chat/group_chat_item.dart b/lib/chat/group_chat_item.dart index 3fcf3fe..3ea16e7 100644 --- a/lib/chat/group_chat_item.dart +++ b/lib/chat/group_chat_item.dart @@ -563,7 +563,7 @@ class _GroupChatPageItemState extends State Widget wrapItemWithMenu(item) { List actionsFunc = []; - List actions = [I18n.of(context).delete, I18n.of(context).reply]; + List actions = [I18n.of(context).delete, I18n.of(context).reply,I18n.of(context).forward]; actionsFunc.add(() { MessageMgr().emit('Delete Select Message', widget.msg); @@ -572,6 +572,10 @@ class _GroupChatPageItemState extends State print('发送引用的消息'); MessageMgr().emit('Reply Select Message', widget.msg); }); + actionsFunc.add(() { + print('转发消息'); + AppNavigator.pushForwardPage(context, widget.msg); + }); if (widget.msg.msgType == ChatType.TextChatType.value) { actions.insert(0, I18n.of(context).copy); diff --git a/lib/data/constants.dart b/lib/data/constants.dart index 23ddc32..43b4b25 100644 --- a/lib/data/constants.dart +++ b/lib/data/constants.dart @@ -59,6 +59,7 @@ class ComId { static const int Heart = 0; static const int Login = 1; static const int Chat = 2; + static const int TranslateOrder = 3; static const int PushMsg = 100; } diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 53beeb4..ebbe5f0 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -2475,6 +2475,8 @@ class I18n implements WidgetsLocalizations { String get feedback_assistant => "反馈小助手"; /// "有什么问题都可以反馈给我哦" String get feedback_tips => "有什么问题都可以反馈给我哦"; + /// "Forward" + String get forward => "Forward"; } class _I18n_en_US extends I18n { @@ -6150,6 +6152,9 @@ class _I18n_vi_VN extends I18n { /// "有什么问题都可以反馈给我哦" @override String get feedback_tips => "有什么问题都可以反馈给我哦"; + /// "转发" + @override + String get forward => "转发"; @override TextDirection get textDirection => TextDirection.ltr; @@ -9821,6 +9826,9 @@ class _I18n_zh_HK extends I18n { /// "有什麼問題都可以反饋給我哦" @override String get feedback_tips => "有什麼問題都可以反饋給我哦"; + /// "转发" + @override + String get forward => "转发"; @override TextDirection get textDirection => TextDirection.ltr; @@ -13492,6 +13500,9 @@ class _I18n_zh_CN extends _I18n_zh_HK { /// "有什么问题都可以反馈给我哦" @override String get feedback_tips => "有什么问题都可以反馈给我哦"; + /// "转发" + @override + String get forward => "转发"; @override TextDirection get textDirection => TextDirection.ltr; @@ -17163,6 +17174,9 @@ class _I18n_ko_KR extends I18n { /// "有什么问题都可以反馈给我哦" @override String get feedback_tips => "有什么问题都可以反馈给我哦"; + /// "转发" + @override + String get forward => "转发"; @override TextDirection get textDirection => TextDirection.ltr; @@ -20834,6 +20848,9 @@ class _I18n_ja_JP extends I18n { /// "有什么问题都可以反馈给我哦" @override String get feedback_tips => "有什么问题都可以反馈给我哦"; + /// "转发" + @override + String get forward => "转发"; @override TextDirection get textDirection => TextDirection.ltr; diff --git a/lib/home/ConversActionPage.dart b/lib/home/ConversActionPage.dart index 3d646f3..7f1cf53 100644 --- a/lib/home/ConversActionPage.dart +++ b/lib/home/ConversActionPage.dart @@ -1,620 +1,3 @@ -//import 'package:chat/data/UserData.dart'; -//import 'package:chat/data/WebData.dart'; -//import 'package:chat/data/conversation.dart'; -//import 'package:chat/data/group_data_mgr.dart'; -//import 'package:chat/generated/i18n.dart'; -//import 'package:chat/home/InfoList.dart'; -//import 'package:chat/home/last_chat_record_widget.dart'; -//import 'package:chat/home/rich_title.dart'; -//import 'package:chat/home/unread_dot_widget.dart'; -//import 'package:chat/models/group_info_model.dart'; -//import 'package:chat/utils/CustomUI.dart'; -//import 'package:chat/utils/HttpUtil.dart'; -//import 'package:chat/utils/MessageMgr.dart'; -//import 'package:chat/utils/TokenMgr.dart'; -//import 'package:chat/utils/screen.dart'; -//import 'package:dio/dio.dart'; -//import 'package:flutter/cupertino.dart'; -//import 'package:flutter/material.dart'; -//import 'package:shared_preferences/shared_preferences.dart'; -//import '../data/constants.dart' -// show -// AppColors, -// AppStyles, -// Constants, -// GlobalSearchPageType, -// GroupOperatingPageType; -//import 'package:cached_network_image/cached_network_image.dart'; -// -//import 'create_group_view.dart'; -//import 'global_search.dart'; -//import 'group_item_widget.dart'; -// -//class _ConversationItem extends StatelessWidget { -// const _ConversationItem( -// {Key key, -// this.conversation, -// this.callback, -// this.icon, -// this.bgColor, -// this.iconSize = 20}) -// : assert(conversation != null), -// super(key: key); -// final icon; -// final double iconSize; -// final Conversation conversation; -// final callback; -// final bgColor; -// -// @override -// Widget build(BuildContext context) { -// Widget avatar; -// if (icon != null) { -// avatar = Container( -// height: 47.5, -// width: 47.5, -// margin: EdgeInsets.only(left: 6), -// alignment: Alignment.center, -// decoration: BoxDecoration( -// gradient: bgColor, -// borderRadius: BorderRadius.all(Radius.circular(50))), -// child: Image.asset( -// icon, -// height: iconSize, -// )); -// } else if (conversation.isAvatarFromNet()) { -// avatar = CachedNetworkImage( -// imageUrl: conversation.avatar, -// placeholder: CustomUI.buildImgLoding, -// width: Constants.ConversationAvatarSize, -// height: Constants.ConversationAvatarSize, -// ); -// } else { -// avatar = Image.asset( -// conversation.avatar, -// width: Constants.ConversationAvatarSize, -// height: Constants.ConversationAvatarSize, -// ); -// } -// List _rightArea = [ -// Container( -// padding: EdgeInsets.only(top: 4), -// alignment: Alignment.center, -// child: Text(conversation.updateAt, -// textScaleFactor: 1.0, -// style: TextStyle(fontSize: 11, color: const Color(0xFFC6C6C6))), -// ) -// ]; -// if (conversation.unreadMsgCount > 0) { -// var countStr = conversation.unreadMsgCount.toString(); -// if (conversation.unreadMsgCount > 99) { -// countStr = '99+'; -// } -// // 未读消息角标 -// Widget unreadMsgCountText = Container( -// width: Constants.UnReadMsgNotifyDotSize, -// height: Constants.UnReadMsgNotifyDotSize, -// alignment: Alignment.center, -// decoration: BoxDecoration( -// borderRadius: -// BorderRadius.circular(Constants.UnReadMsgNotifyDotSize / 2.0), -// color: Color(0xFFFF5454), -// ), -// child: Text(countStr, -// textScaleFactor: 1.0, style: AppStyles.UnreadMsgCountDotStyle), -// ); -// _rightArea.add(Expanded( -// child: Align( -// alignment: Alignment.bottomCenter, -// child: unreadMsgCountText, -// ))); -// } -// -// return InkWell( -// child: Container( -// padding: const EdgeInsets.all(10.0), -// decoration: BoxDecoration( -// color: Color(AppColors.ConversationItemBgColor), -// ), -// child: Row( -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// avatar, -// Container(width: 17.0), -// Expanded( -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Text(conversation.title, -// textScaleFactor: 1.0, -// style: TextStyle( -// color: Colors.black, -// )), -// SizedBox( -// height: 5, -// ), -// Text(conversation.desc, -// textScaleFactor: 1.0, -// style: TextStyle( -// fontSize: 12, color: const Color(0xFF9B9B9B))) -// ], -// ), -// ), -// // Container(width: 10.0), -// SizedBox( -// height: Constants.ConversationAvatarSize, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.end, -// mainAxisAlignment: MainAxisAlignment.start, -// children: _rightArea, -// ), -// ) -// ], -// ), -// ), -// onTap: () { -// callback(); -// }, -// ); -// } -//} -// -//class ConversActionPage extends StatefulWidget { -// ConversActionPage({Key key}) : super(key: key); -// -// _ConversActionPageState createState() => _ConversActionPageState(); -//} -// -//Map systemInfo = { -// 'applyList': null, -// 'applyCount': 0, -// 'evaluateList': null, -// 'evaluateCount': 0, -// 'parkList': null, -// 'parkCount': 0, -// 'castList': null, -// 'castCount': 0, -// 'walletList': null, -// 'walletCount': 0, -//}; -// -//int msgNum = 0; -//bool isShowMsg() { -// return msgNum > 0; -//} -// -//getAllResNum(prefs) { -// getResNum(prefs, Constants.ApplyCount); -// getResNum(prefs, Constants.EvaluateCount); -// getResNum(prefs, Constants.ParkCount); -// getResNum(prefs, Constants.CastCount); -// getResNum(prefs, Constants.WalletCount); -//} -// -//getResNum(prefs, url) async { -// var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); -// systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); -// -// msgNum += systemInfo[url]; -//} -// -//setResNum(url) async { -// var localKey = url + UserData().basicInfo.userId.toString(); -// if (systemInfo[url] > 0) { -// SharedPreferences prefs = await SharedPreferences.getInstance(); -// var count = prefs.getInt(localKey); -// prefs.setInt( -// localKey, count == null ? systemInfo[url] : (systemInfo[url] + count)); -// msgNum -= systemInfo[url]; -// systemInfo[url] = 0; -// } -//} -// -//class _ConversActionPageState extends State -// with SingleTickerProviderStateMixin { -// TabController tabCtrl; -// -// void getSystemMsg(data) async { -// Map data = { -// "userId": UserData().basicInfo.userId, -// "type": UserData().basicInfo.sex -// }; -// data['sign'] = TokenMgr().getSign(data); -// -// Response res = await HttpUtil().post('message/all/message', data: data); -// if (res == null) { -// return; -// } -// Map resData = res.data; -// if (resData['code'] == 0) { -// SharedPreferences prefs = await SharedPreferences.getInstance(); -// systemInfo = resData['data']; -// msgNum = 0; -// getAllResNum(prefs); -// if (mounted) { -// setState(() {}); -// } -// } -// } -// -// @override -// void initState() { -// super.initState(); -// -// MessageMgr().on('update_system', getSystemMsg); -// MessageMgr().on('Quit Group', quitGroup); -// -// MessageMgr().on('Update Group List', updateGroupLastMsg); -// getSystemMsg(null); -// -// tabCtrl = TabController(length: 3, vsync: this); -// } -// -// @override -// void dispose() { -// tabCtrl.dispose(); -// MessageMgr().off('update_system', getSystemMsg); -// super.dispose(); -// MessageMgr().off('Quit Group', quitGroup); -// -// MessageMgr().off('Update Group List', updateGroupLastMsg); -// } -// -// @override -// Widget build(BuildContext context) { -// List groupList = GroupInfoMgr().groupInfoList; -// -// return Scaffold( -// backgroundColor: Colors.white, -// appBar: AppBar( -// //backgroundColor: Constants.LightGreyBackgroundColor, -// centerTitle: false, -// title: Text( -// I18n.of(context).message_center, -// textScaleFactor: 1.0, -// style: Constants.MainTitleStyle, -// ), -// actions: [ -// Container( -// child: IconButton( -// icon: CircleAvatar( -// backgroundColor: Constants.GreyBackgroundColor, -// radius: 13.75, -// child: Padding( -// padding: EdgeInsets.only(bottom: 1.5), -// child: Icon( -// IconData(0xe659, -// fontFamily: Constants.IconFontFamily), -// color: Constants.BlackTextColor, -// size: 21, -// ))), -// onPressed: () { -// CustomUI().goScanPage(context); -// }, -// ), -// ), -// // InkWell( -// // onTap: () { -// // Navigator.of(context).push( -// // new MaterialPageRoute( -// // builder: (context) { -// // return MessagePushPage(); -// // }, -// // ), -// // ); -// // }, -// // child: Padding( -// // padding: EdgeInsets.only(right: 10), -// // child: CircleAvatar( -// // backgroundColor: Constants.GreyBackgroundColor, -// // radius: 13.75, -// // child: Icon( -// // Icons.settings, -// // color: Constants.BlackTextColor, -// // size: 22, -// // )), -// // )), -// ], -// elevation: 0, -// bottom: PreferredSize( -// preferredSize: Size.fromHeight(28), -// child: Container( -// padding: EdgeInsets.only(left: 2), -// decoration: BoxDecoration( -// //color: Constants.LightGreyBackgroundColor, -// border: -// Border(bottom: BorderSide(color: Color(0xffeaeaea)))), -// alignment: Alignment.centerLeft, -// child: TabBar( -// isScrollable: true, -// indicatorPadding: EdgeInsets.only(left: 9, right: 9), -// tabs: [ -// UnreadDot( -// child: Container( -// margin: EdgeInsets.only(right: 4), -// child: Text(I18n.of(context).text_chat, -// textScaleFactor: 1.0), -// ), -// type: 1), -// UnreadDot( -// child: Container( -// margin: EdgeInsets.only(right: 4), -// child: Text(I18n.of(context).group_chat, -// textScaleFactor: 1.0), -// ), -// type: 4), -// UnreadDot( -// child: Container( -// margin: EdgeInsets.only(right: 4), -// child: Text(I18n.of(context).system_information, -// textScaleFactor: 1.0)), -// type: 2), -// ], -// controller: tabCtrl, -// ), -// )), -// ), -// body: SafeArea( -// child: TabBarView( -// children: [ -// LastChatPage(), -// ListView.builder( -//// controller: _scrollController, -// itemBuilder: (BuildContext context, int index) { -// if (index == 0) { -// return _buildCreateButton(); -// } else { -// var info = groupList[index - 1]; -// return GroupItem(ValueKey(info), groupInfoModel: info); -// } -// }, -// itemCount: groupList.length + 1, -// ), -// ListView( -// children: [ -// SizedBox(height: 8.5), -// _ConversationItem( -// icon: 'assets/images/chat/icon1.png', -// bgColor: Constants.RadioGradient, -// conversation: Conversation( -// avatar: 'assets/images/ic_tx_news.png', -// title: I18n.of(context).radio_message, -// desc: RichTitle.normalTitle( -// systemInfo['castList'], context, InfoType.Radio), -// updateAt: systemInfo['castList'] == null -// ? "" -// : WebData().getLoginTime( -// context, systemInfo['castList']['CreateTime']), -// unreadMsgCount: systemInfo['castCount'], -// ), -// callback: () { -// setResNum(Constants.CastCount); -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return InfoListPage( -// title: I18n.of(context).radio_message, -// type: InfoType.Radio, -// ); -// }, -// ), -// ); -// }, -// ), -// _ConversationItem( -// icon: 'assets/images/chat/icon4.png', -// bgColor: Constants.MoneyGradient, -// conversation: Conversation( -// avatar: 'assets/images/ic_tx_news.png', -// title: I18n.of(context).wallet_reminder, -// desc: RichTitle.normalTitle( -// systemInfo['walletList'], context, InfoType.IncomeMoney), -// updateAt: systemInfo['walletList'] == null -// ? "" -// : WebData().getLoginTime( -// context, systemInfo['walletList']['CreateTime']), -// unreadMsgCount: systemInfo['walletCount'], -// ), -// callback: () { -// setResNum(Constants.WalletCount); -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return InfoListPage( -// title: I18n.of(context).wallet_reminder, -// type: InfoType.IncomeMoney, -// ); -// }, -// ), -// ); -// }, -// ), -// _ConversationItem( -// icon: 'assets/images/chat/icon3.png', -// iconSize: 27, -// bgColor: Constants.ApplyGradient, -// conversation: Conversation( -// avatar: 'assets/images/ic_tx_news.png', -// title: I18n.of(context).application_notice, -// desc: RichTitle.normalTitle( -// systemInfo['applyList'], context, InfoType.Apply), -// updateAt: systemInfo['applyList'] == null -// ? "" -// : WebData().getLoginTime( -// context, systemInfo['applyList']['CreatTime']), -// unreadMsgCount: systemInfo['applyCount'], -// ), -// callback: () { -// setResNum(Constants.ApplyCount); -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return InfoListPage( -// title: I18n.of(context).application_notice, -// type: InfoType.Apply, -// ); -// }, -// ), -// ); -// }, -// ), -// _ConversationItem( -// icon: 'assets/images/chat/icon6.png', -// bgColor: Constants.EvaGradient, -// conversation: Conversation( -// avatar: 'assets/images/ic_tx_news.png', -// title: I18n.of(context).evaluation_notice, -// desc: RichTitle.normalTitle(systemInfo['evaluateList'], -// context, InfoType.Evaluation), -// updateAt: systemInfo['evaluateList'] == null -// ? '' -// : WebData().getLoginTime( -// context, systemInfo['evaluateList']['CreateTime']), -// unreadMsgCount: systemInfo['evaluateCount'], -// ), -// callback: () { -// setResNum(Constants.EvaluateCount); -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return InfoListPage( -// title: I18n.of(context).evaluation_notice, -// type: 2, -// ); -// }, -// ), -// ); -// }, -// ), -// _ConversationItem( -// icon: 'assets/images/chat/icon5.png', -// bgColor: Constants.ParkGradient, -// conversation: Conversation( -// avatar: 'assets/images/ic_tx_news.png', -// title: I18n.of(context).appName, -// desc: RichTitle.normalTitle( -// systemInfo['parkList'], context, InfoType.System), -// updateAt: systemInfo['parkList'] == null -// ? "" -// : WebData().getLoginTime( -// context, systemInfo['parkList']['CreateTime']), -// unreadMsgCount: systemInfo['parkCount'], -// ), -// callback: () { -// setResNum(Constants.ParkCount); -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return InfoListPage( -// title: I18n.of(context).appName, -// type: InfoType.System, -// ); -// }, -// ), -// ); -// }, -// ) -// ], -// ) -// ], -// controller: tabCtrl, -// ))); -// } -// -// Widget _buildCreateButton() { -// List groupList = GroupInfoMgr().groupInfoList; -// Widget _avatarIcon = ClipRRect( -// borderRadius: BorderRadius.circular(GroupRadius), -// child: Container( -// color: const Color(0xFFF2F2F2), -// height: AvatarSize, -// width: AvatarSize, -// child: Icon( -// IconData(0xe66f, fontFamily: Constants.IconFontFamily), -// color: Constants.BlueTextColor, -// size: 35, -// ), -// )); -// -// Widget _button = InkWell( -// onTap: () { -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return CreateGroupPage( -// GroupOperatingPageType.CreateGroup, [], null); -// }, -// ), -// ); -// }, -// child: Container( -// padding: EdgeInsets.only(top: 14, bottom: 14), -// color: Constants.GreyBackgroundColor, -// child: Container( -// height: ItemHeight, -// decoration: BoxDecoration(color: Colors.white), -// child: Row( -// children: [ -// SizedBox(width: LeftPadding), -// _avatarIcon, -// SizedBox(width: 14.0), -// Text( -// I18n.of(context).create_group_chat, -// style: TextStyle(fontSize: 15.5), -// ), -// ], -// ), -// ))); -// -// Widget tips = Container( -// alignment: Alignment.centerLeft, -// width: Screen.width, -// height: 33.5, -// padding: EdgeInsets.only(left: LeftPadding), -// decoration: BoxDecoration( -// color: Colors.white, -// border: Border(bottom: Constants.GreyBorderSide)), -// child: Text(I18n.of(context).group_chat + '(${groupList.length})'), -// ); -// -// return Column( -// children: [ -// SizedBox( -// height: 10, -// ), -// CustomUI.buildSearchButton(context, () { -// Navigator.of(context).push( -// new MaterialPageRoute( -// builder: (context) { -// return GlobalSearchPage( -// type: GlobalSearchPageType.SearchGroup, -// ); -// }, -// ), -// ); -// }, bottom: 10), -// _button, -// tips, -// ], -// ); -// } -// -// quitGroup(args) { -// if (mounted) { -// setState(() { -// print('更新群列表'); -// }); -// } -// } -// -// updateGroupLastMsg(args) async { -// await GroupInfoMgr().sortGroupList(); -// if (mounted) { -// setState(() {}); -// } -// } -//} - import 'package:chat/data/UserData.dart'; import 'package:chat/data/WebData.dart'; import 'package:chat/data/conversation.dart'; @@ -859,12 +242,12 @@ class _ConversActionPageState extends State super.initState(); MessageMgr().on('update_system', getSystemMsg); -// MessageMgr().on('Quit Group', quitGroup); -// -// MessageMgr().on('Update Group List', updateGroupLastMsg); + MessageMgr().on('Quit Group', quitGroup); + + MessageMgr().on('Update Group List', updateGroupLastMsg); getSystemMsg(null); - tabCtrl = TabController(length: 2, vsync: this); + tabCtrl = TabController(length: 3, vsync: this); } @override @@ -872,11 +255,14 @@ class _ConversActionPageState extends State tabCtrl.dispose(); MessageMgr().off('update_system', getSystemMsg); super.dispose(); + MessageMgr().off('Quit Group', quitGroup); + + MessageMgr().off('Update Group List', updateGroupLastMsg); } @override Widget build(BuildContext context) { -// List groupList = GroupInfoMgr().groupInfoList; + List groupList = GroupInfoMgr().groupInfoList; return Scaffold( backgroundColor: Colors.white, @@ -950,13 +336,13 @@ class _ConversActionPageState extends State textScaleFactor: 1.0), ), type: 1), -// UnreadDot( -// child: Container( -// margin: EdgeInsets.only(right: 4), -// child: Text(I18n.of(context).group_chat, -// textScaleFactor: 1.0), -// ), -// type: 4), + UnreadDot( + child: Container( + margin: EdgeInsets.only(right: 4), + child: Text(I18n.of(context).group_chat, + textScaleFactor: 1.0), + ), + type: 4), UnreadDot( child: Container( margin: EdgeInsets.only(right: 4), @@ -972,18 +358,18 @@ class _ConversActionPageState extends State child: TabBarView( children: [ LastChatPage(), -// ListView.builder( -//// controller: _scrollController, -// itemBuilder: (BuildContext context, int index) { -// if (index == 0) { -// return _buildCreateButton(); -// } else { -// var info = groupList[index - 1]; -// return GroupItem(ValueKey(info), groupInfoModel: info); -// } -// }, -// itemCount: groupList.length + 1, -// ), + ListView.builder( +// controller: _scrollController, + itemBuilder: (BuildContext context, int index) { + if (index == 0) { + return _buildCreateButton(); + } else { + var info = groupList[index - 1]; + return GroupItem(ValueKey(info), groupInfoModel: info); + } + }, + itemCount: groupList.length + 1, + ), ListView( children: [ SizedBox(height: 8.5), @@ -1021,8 +407,8 @@ class _ConversActionPageState extends State conversation: Conversation( avatar: 'assets/images/ic_tx_news.png', title: I18n.of(context).wallet_reminder, - desc: RichTitle.normalTitle(systemInfo['walletList'], - context, InfoType.IncomeMoney), + desc: RichTitle.normalTitle( + systemInfo['walletList'], context, InfoType.IncomeMoney), updateAt: systemInfo['walletList'] == null ? "" : WebData().getLoginTime( @@ -1174,7 +560,6 @@ class _ConversActionPageState extends State SizedBox(width: 14.0), Text( I18n.of(context).create_group_chat, - textScaleFactor: 1.0, style: TextStyle(fontSize: 15.5), ), ], @@ -1189,10 +574,7 @@ class _ConversActionPageState extends State decoration: BoxDecoration( color: Colors.white, border: Border(bottom: Constants.GreyBorderSide)), - child: Text( - I18n.of(context).group_chat + '(${groupList.length})', - textScaleFactor: 1.0, - ), + child: Text(I18n.of(context).group_chat + '(${groupList.length})'), ); return Column( @@ -1217,18 +599,636 @@ class _ConversActionPageState extends State ); } -// quitGroup(args) { -// if (mounted) { -// setState(() { -// print('更新群列表'); -// }); + quitGroup(args) { + if (mounted) { + setState(() { + print('更新群列表'); + }); + } + } + + updateGroupLastMsg(args) async { + await GroupInfoMgr().sortGroupList(); + if (mounted) { + setState(() {}); + } + } +} + +//import 'package:chat/data/UserData.dart'; +//import 'package:chat/data/WebData.dart'; +//import 'package:chat/data/conversation.dart'; +//import 'package:chat/data/group_data_mgr.dart'; +//import 'package:chat/generated/i18n.dart'; +//import 'package:chat/home/InfoList.dart'; +//import 'package:chat/home/last_chat_record_widget.dart'; +//import 'package:chat/home/rich_title.dart'; +//import 'package:chat/home/unread_dot_widget.dart'; +//import 'package:chat/models/group_info_model.dart'; +//import 'package:chat/utils/CustomUI.dart'; +//import 'package:chat/utils/HttpUtil.dart'; +//import 'package:chat/utils/MessageMgr.dart'; +//import 'package:chat/utils/TokenMgr.dart'; +//import 'package:chat/utils/screen.dart'; +//import 'package:dio/dio.dart'; +//import 'package:flutter/cupertino.dart'; +//import 'package:flutter/material.dart'; +//import 'package:shared_preferences/shared_preferences.dart'; +//import '../data/constants.dart' +// show +// AppColors, +// AppStyles, +// Constants, +// GlobalSearchPageType, +// GroupOperatingPageType; +//import 'package:cached_network_image/cached_network_image.dart'; +// +//import 'create_group_view.dart'; +//import 'global_search.dart'; +//import 'group_item_widget.dart'; +// +//class _ConversationItem extends StatelessWidget { +// const _ConversationItem( +// {Key key, +// this.conversation, +// this.callback, +// this.icon, +// this.bgColor, +// this.iconSize = 20}) +// : assert(conversation != null), +// super(key: key); +// final icon; +// final double iconSize; +// final Conversation conversation; +// final callback; +// final bgColor; +// +// @override +// Widget build(BuildContext context) { +// Widget avatar; +// if (icon != null) { +// avatar = Container( +// height: 47.5, +// width: 47.5, +// margin: EdgeInsets.only(left: 6), +// alignment: Alignment.center, +// decoration: BoxDecoration( +// gradient: bgColor, +// borderRadius: BorderRadius.all(Radius.circular(50))), +// child: Image.asset( +// icon, +// height: iconSize, +// )); +// } else if (conversation.isAvatarFromNet()) { +// avatar = CachedNetworkImage( +// imageUrl: conversation.avatar, +// placeholder: CustomUI.buildImgLoding, +// width: Constants.ConversationAvatarSize, +// height: Constants.ConversationAvatarSize, +// ); +// } else { +// avatar = Image.asset( +// conversation.avatar, +// width: Constants.ConversationAvatarSize, +// height: Constants.ConversationAvatarSize, +// ); +// } +// List _rightArea = [ +// Container( +// padding: EdgeInsets.only(top: 4), +// alignment: Alignment.center, +// child: Text(conversation.updateAt, +// textScaleFactor: 1.0, +// style: TextStyle(fontSize: 11, color: const Color(0xFFC6C6C6))), +// ) +// ]; +// if (conversation.unreadMsgCount > 0) { +// var countStr = conversation.unreadMsgCount.toString(); +// if (conversation.unreadMsgCount > 99) { +// countStr = '99+'; +// } +// // 未读消息角标 +// Widget unreadMsgCountText = Container( +// width: Constants.UnReadMsgNotifyDotSize, +// height: Constants.UnReadMsgNotifyDotSize, +// alignment: Alignment.center, +// decoration: BoxDecoration( +// borderRadius: +// BorderRadius.circular(Constants.UnReadMsgNotifyDotSize / 2.0), +// color: Color(0xFFFF5454), +// ), +// child: Text(countStr, +// textScaleFactor: 1.0, style: AppStyles.UnreadMsgCountDotStyle), +// ); +// _rightArea.add(Expanded( +// child: Align( +// alignment: Alignment.bottomCenter, +// child: unreadMsgCountText, +// ))); +// } +// +// return InkWell( +// child: Container( +// padding: const EdgeInsets.all(10.0), +// decoration: BoxDecoration( +// color: Color(AppColors.ConversationItemBgColor), +// ), +// child: Row( +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// avatar, +// Container(width: 17.0), +// Expanded( +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Text(conversation.title, +// textScaleFactor: 1.0, +// style: TextStyle( +// color: Colors.black, +// )), +// SizedBox( +// height: 5, +// ), +// Text(conversation.desc, +// textScaleFactor: 1.0, +// style: TextStyle( +// fontSize: 12, color: const Color(0xFF9B9B9B))) +// ], +// ), +// ), +// // Container(width: 10.0), +// SizedBox( +// height: Constants.ConversationAvatarSize, +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, +// mainAxisAlignment: MainAxisAlignment.start, +// children: _rightArea, +// ), +// ) +// ], +// ), +// ), +// onTap: () { +// callback(); +// }, +// ); +// } +//} +// +//class ConversActionPage extends StatefulWidget { +// ConversActionPage({Key key}) : super(key: key); +// +// _ConversActionPageState createState() => _ConversActionPageState(); +//} +// +//Map systemInfo = { +// 'applyList': null, +// 'applyCount': 0, +// 'evaluateList': null, +// 'evaluateCount': 0, +// 'parkList': null, +// 'parkCount': 0, +// 'castList': null, +// 'castCount': 0, +// 'walletList': null, +// 'walletCount': 0, +//}; +// +//int msgNum = 0; +//bool isShowMsg() { +// return msgNum > 0; +//} +// +//getAllResNum(prefs) { +// getResNum(prefs, Constants.ApplyCount); +// getResNum(prefs, Constants.EvaluateCount); +// getResNum(prefs, Constants.ParkCount); +// getResNum(prefs, Constants.CastCount); +// getResNum(prefs, Constants.WalletCount); +//} +// +//getResNum(prefs, url) async { +// var count = prefs.getInt(url + UserData().basicInfo.userId.toString()); +// systemInfo[url] = count == null ? systemInfo[url] : (systemInfo[url] - count); +// +// msgNum += systemInfo[url]; +//} +// +//setResNum(url) async { +// var localKey = url + UserData().basicInfo.userId.toString(); +// if (systemInfo[url] > 0) { +// SharedPreferences prefs = await SharedPreferences.getInstance(); +// var count = prefs.getInt(localKey); +// prefs.setInt( +// localKey, count == null ? systemInfo[url] : (systemInfo[url] + count)); +// msgNum -= systemInfo[url]; +// systemInfo[url] = 0; +// } +//} +// +//class _ConversActionPageState extends State +// with SingleTickerProviderStateMixin { +// TabController tabCtrl; +// +// void getSystemMsg(data) async { +// Map data = { +// "userId": UserData().basicInfo.userId, +// "type": UserData().basicInfo.sex +// }; +// data['sign'] = TokenMgr().getSign(data); +// +// Response res = await HttpUtil().post('message/all/message', data: data); +// if (res == null) { +// return; +// } +// Map resData = res.data; +// if (resData['code'] == 0) { +// SharedPreferences prefs = await SharedPreferences.getInstance(); +// systemInfo = resData['data']; +// msgNum = 0; +// getAllResNum(prefs); +// if (mounted) { +// setState(() {}); +// } // } // } // -// updateGroupLastMsg(args) async { -// await GroupInfoMgr().sortGroupList(); -// if (mounted) { -// setState(() {}); -// } +// @override +// void initState() { +// super.initState(); +// +// MessageMgr().on('update_system', getSystemMsg); +//// MessageMgr().on('Quit Group', quitGroup); +//// +//// MessageMgr().on('Update Group List', updateGroupLastMsg); +// getSystemMsg(null); +// +// tabCtrl = TabController(length: 2, vsync: this); +// } +// +// @override +// void dispose() { +// tabCtrl.dispose(); +// MessageMgr().off('update_system', getSystemMsg); +// super.dispose(); +// } +// +// @override +// Widget build(BuildContext context) { +//// List groupList = GroupInfoMgr().groupInfoList; +// +// return Scaffold( +// backgroundColor: Colors.white, +// appBar: AppBar( +// //backgroundColor: Constants.LightGreyBackgroundColor, +// centerTitle: false, +// title: Text( +// I18n.of(context).message_center, +// textScaleFactor: 1.0, +// style: Constants.MainTitleStyle, +// ), +// actions: [ +// Container( +// child: IconButton( +// icon: CircleAvatar( +// backgroundColor: Constants.GreyBackgroundColor, +// radius: 13.75, +// child: Padding( +// padding: EdgeInsets.only(bottom: 1.5), +// child: Icon( +// IconData(0xe659, +// fontFamily: Constants.IconFontFamily), +// color: Constants.BlackTextColor, +// size: 21, +// ))), +// onPressed: () { +// CustomUI().goScanPage(context); +// }, +// ), +// ), +// // InkWell( +// // onTap: () { +// // Navigator.of(context).push( +// // new MaterialPageRoute( +// // builder: (context) { +// // return MessagePushPage(); +// // }, +// // ), +// // ); +// // }, +// // child: Padding( +// // padding: EdgeInsets.only(right: 10), +// // child: CircleAvatar( +// // backgroundColor: Constants.GreyBackgroundColor, +// // radius: 13.75, +// // child: Icon( +// // Icons.settings, +// // color: Constants.BlackTextColor, +// // size: 22, +// // )), +// // )), +// ], +// elevation: 0, +// bottom: PreferredSize( +// preferredSize: Size.fromHeight(28), +// child: Container( +// padding: EdgeInsets.only(left: 2), +// decoration: BoxDecoration( +// //color: Constants.LightGreyBackgroundColor, +// border: +// Border(bottom: BorderSide(color: Color(0xffeaeaea)))), +// alignment: Alignment.centerLeft, +// child: TabBar( +// isScrollable: true, +// indicatorPadding: EdgeInsets.only(left: 9, right: 9), +// tabs: [ +// UnreadDot( +// child: Container( +// margin: EdgeInsets.only(right: 4), +// child: Text(I18n.of(context).text_chat, +// textScaleFactor: 1.0), +// ), +// type: 1), +//// UnreadDot( +//// child: Container( +//// margin: EdgeInsets.only(right: 4), +//// child: Text(I18n.of(context).group_chat, +//// textScaleFactor: 1.0), +//// ), +//// type: 4), +// UnreadDot( +// child: Container( +// margin: EdgeInsets.only(right: 4), +// child: Text(I18n.of(context).system_information, +// textScaleFactor: 1.0)), +// type: 2), +// ], +// controller: tabCtrl, +// ), +// )), +// ), +// body: SafeArea( +// child: TabBarView( +// children: [ +// LastChatPage(), +//// ListView.builder( +////// controller: _scrollController, +//// itemBuilder: (BuildContext context, int index) { +//// if (index == 0) { +//// return _buildCreateButton(); +//// } else { +//// var info = groupList[index - 1]; +//// return GroupItem(ValueKey(info), groupInfoModel: info); +//// } +//// }, +//// itemCount: groupList.length + 1, +//// ), +// ListView( +// children: [ +// SizedBox(height: 8.5), +// _ConversationItem( +// icon: 'assets/images/chat/icon1.png', +// bgColor: Constants.RadioGradient, +// conversation: Conversation( +// avatar: 'assets/images/ic_tx_news.png', +// title: I18n.of(context).radio_message, +// desc: RichTitle.normalTitle( +// systemInfo['castList'], context, InfoType.Radio), +// updateAt: systemInfo['castList'] == null +// ? "" +// : WebData().getLoginTime( +// context, systemInfo['castList']['CreateTime']), +// unreadMsgCount: systemInfo['castCount'], +// ), +// callback: () { +// setResNum(Constants.CastCount); +// Navigator.of(context).push( +// new MaterialPageRoute( +// builder: (context) { +// return InfoListPage( +// title: I18n.of(context).radio_message, +// type: InfoType.Radio, +// ); +// }, +// ), +// ); +// }, +// ), +// _ConversationItem( +// icon: 'assets/images/chat/icon4.png', +// bgColor: Constants.MoneyGradient, +// conversation: Conversation( +// avatar: 'assets/images/ic_tx_news.png', +// title: I18n.of(context).wallet_reminder, +// desc: RichTitle.normalTitle(systemInfo['walletList'], +// context, InfoType.IncomeMoney), +// updateAt: systemInfo['walletList'] == null +// ? "" +// : WebData().getLoginTime( +// context, systemInfo['walletList']['CreateTime']), +// unreadMsgCount: systemInfo['walletCount'], +// ), +// callback: () { +// setResNum(Constants.WalletCount); +// Navigator.of(context).push( +// new MaterialPageRoute( +// builder: (context) { +// return InfoListPage( +// title: I18n.of(context).wallet_reminder, +// type: InfoType.IncomeMoney, +// ); +// }, +// ), +// ); +// }, +// ), +// _ConversationItem( +// icon: 'assets/images/chat/icon3.png', +// iconSize: 27, +// bgColor: Constants.ApplyGradient, +// conversation: Conversation( +// avatar: 'assets/images/ic_tx_news.png', +// title: I18n.of(context).application_notice, +// desc: RichTitle.normalTitle( +// systemInfo['applyList'], context, InfoType.Apply), +// updateAt: systemInfo['applyList'] == null +// ? "" +// : WebData().getLoginTime( +// context, systemInfo['applyList']['CreatTime']), +// unreadMsgCount: systemInfo['applyCount'], +// ), +// callback: () { +// setResNum(Constants.ApplyCount); +// Navigator.of(context).push( +// new MaterialPageRoute( +// builder: (context) { +// return InfoListPage( +// title: I18n.of(context).application_notice, +// type: InfoType.Apply, +// ); +// }, +// ), +// ); +// }, +// ), +// _ConversationItem( +// icon: 'assets/images/chat/icon6.png', +// bgColor: Constants.EvaGradient, +// conversation: Conversation( +// avatar: 'assets/images/ic_tx_news.png', +// title: I18n.of(context).evaluation_notice, +// desc: RichTitle.normalTitle(systemInfo['evaluateList'], +// context, InfoType.Evaluation), +// updateAt: systemInfo['evaluateList'] == null +// ? '' +// : WebData().getLoginTime( +// context, systemInfo['evaluateList']['CreateTime']), +// unreadMsgCount: systemInfo['evaluateCount'], +// ), +// callback: () { +// setResNum(Constants.EvaluateCount); +// Navigator.of(context).push( +// new MaterialPageRoute( +// builder: (context) { +// return InfoListPage( +// title: I18n.of(context).evaluation_notice, +// type: 2, +// ); +// }, +// ), +// ); +// }, +// ), +// _ConversationItem( +// icon: 'assets/images/chat/icon5.png', +// bgColor: Constants.ParkGradient, +// conversation: Conversation( +// avatar: 'assets/images/ic_tx_news.png', +// title: I18n.of(context).appName, +// desc: RichTitle.normalTitle( +// systemInfo['parkList'], context, InfoType.System), +// updateAt: systemInfo['parkList'] == null +// ? "" +// : WebData().getLoginTime( +// context, systemInfo['parkList']['CreateTime']), +// unreadMsgCount: systemInfo['parkCount'], +// ), +// callback: () { +// setResNum(Constants.ParkCount); +// Navigator.of(context).push( +// new MaterialPageRoute( +// builder: (context) { +// return InfoListPage( +// title: I18n.of(context).appName, +// type: InfoType.System, +// ); +// }, +// ), +// ); +// }, +// ) +// ], +// ) +// ], +// controller: tabCtrl, +// ))); +// } +// +// Widget _buildCreateButton() { +// List groupList = GroupInfoMgr().groupInfoList; +// Widget _avatarIcon = ClipRRect( +// borderRadius: BorderRadius.circular(GroupRadius), +// child: Container( +// color: const Color(0xFFF2F2F2), +// height: AvatarSize, +// width: AvatarSize, +// child: Icon( +// IconData(0xe66f, fontFamily: Constants.IconFontFamily), +// color: Constants.BlueTextColor, +// size: 35, +// ), +// )); +// +// Widget _button = InkWell( +// onTap: () { +// Navigator.of(context).push( +// new MaterialPageRoute( +// builder: (context) { +// return CreateGroupPage( +// GroupOperatingPageType.CreateGroup, [], null); +// }, +// ), +// ); +// }, +// child: Container( +// padding: EdgeInsets.only(top: 14, bottom: 14), +// color: Constants.GreyBackgroundColor, +// child: Container( +// height: ItemHeight, +// decoration: BoxDecoration(color: Colors.white), +// child: Row( +// children: [ +// SizedBox(width: LeftPadding), +// _avatarIcon, +// SizedBox(width: 14.0), +// Text( +// I18n.of(context).create_group_chat, +// textScaleFactor: 1.0, +// style: TextStyle(fontSize: 15.5), +// ), +// ], +// ), +// ))); +// +// Widget tips = Container( +// alignment: Alignment.centerLeft, +// width: Screen.width, +// height: 33.5, +// padding: EdgeInsets.only(left: LeftPadding), +// decoration: BoxDecoration( +// color: Colors.white, +// border: Border(bottom: Constants.GreyBorderSide)), +// child: Text( +// I18n.of(context).group_chat + '(${groupList.length})', +// textScaleFactor: 1.0, +// ), +// ); +// +// return Column( +// children: [ +// SizedBox( +// height: 10, +// ), +// CustomUI.buildSearchButton(context, () { +// Navigator.of(context).push( +// new MaterialPageRoute( +// builder: (context) { +// return GlobalSearchPage( +// type: GlobalSearchPageType.SearchGroup, +// ); +// }, +// ), +// ); +// }, bottom: 10), +// _button, +// tips, +// ], +// ); // } -} +// +//// quitGroup(args) { +//// if (mounted) { +//// setState(() { +//// print('更新群列表'); +//// }); +//// } +//// } +//// +//// updateGroupLastMsg(args) async { +//// await GroupInfoMgr().sortGroupList(); +//// if (mounted) { +//// setState(() {}); +//// } +//// } +//} diff --git a/lib/home/homeMain.dart b/lib/home/homeMain.dart index 8957401..dbd0c6a 100644 --- a/lib/home/homeMain.dart +++ b/lib/home/homeMain.dart @@ -313,79 +313,22 @@ class _HomeMainState extends State { I18n.of(context).me ]; -// _navigationViews = [ -// NavigationIconView( -// title: _titles[2], -// icon: IconData( -// 0xe67c, -// fontFamily: 'iconfont', -// ), -// isShowdot: true, -// iconSize: 29), -// NavigationIconView( -// title: _titles[0], -// isShowdot: true, -// iconMargin: EdgeInsets.only(top: 2), -// type: 5, -// icon: IconData( -// 0xe66e, -// fontFamily: 'iconfont', -// ), -// iconSize: 26.5), -// NavigationIconView( -// title: _titles[1], -// icon: IconData( -// 0xe656, -// fontFamily: 'iconfont', -// ), -// isCenter: true, -// iconSize: 31), -// NavigationIconView( -// title: _titles[1], -// isShowdot: true, -// icon: IconData( -// 0xe60b, -// fontFamily: 'iconfont', -// ), -// type: 6, -// iconSize: 26.5), -// NavigationIconView( -// title: _titles[3], -// icon: IconData( -// 0xe67b, -// fontFamily: 'iconfont', -// ), -// iconSize: 26.5), -// ]; -// -// _pages = [ -// RealTimeHelperPage(), -// FriendPage(), -// FindPage(), -// ConversActionPage(), -//// GroupChatListPage(), -// ProfilePage( -// userId: UserData().basicInfo.userId, -// ), -// ]; - _navigationViews = [ NavigationIconView( - title: _titles[1], - isShowdot: true, + title: _titles[2], icon: IconData( - 0xe60b, + 0xe67c, fontFamily: 'iconfont', ), - type: 1, - iconSize: 26.5), + isShowdot: true, + iconSize: 29), NavigationIconView( title: _titles[0], isShowdot: true, iconMargin: EdgeInsets.only(top: 2), type: 5, icon: IconData( - 0xe663, + 0xe66e, fontFamily: 'iconfont', ), iconSize: 26.5), @@ -397,18 +340,15 @@ class _HomeMainState extends State { ), isCenter: true, iconSize: 31), - NavigationIconView( - title: _titles[3], + title: _titles[1], isShowdot: true, icon: IconData( - 0xe66e, + 0xe60b, fontFamily: 'iconfont', ), - type: 4, - isShowdot: true, + type: 6, iconSize: 26.5), - NavigationIconView( title: _titles[3], icon: IconData( @@ -419,17 +359,76 @@ class _HomeMainState extends State { ]; _pages = [ - ConversActionPage(), -// RealTimeHelperPage(), + RealTimeHelperPage(), FriendPage(), FindPage(), -// ConversActionPage(), - GroupChatListPage(), + ConversActionPage(), +// GroupChatListPage(), ProfilePage( userId: UserData().basicInfo.userId, ), ]; +// _navigationViews = [ +// NavigationIconView( +// title: _titles[1], +// isShowdot: true, +// icon: IconData( +// 0xe60b, +// fontFamily: 'iconfont', +// ), +// type: 1, +// iconSize: 26.5), +// NavigationIconView( +// title: _titles[0], +// isShowdot: true, +// iconMargin: EdgeInsets.only(top: 2), +// type: 5, +// icon: IconData( +// 0xe663, +// fontFamily: 'iconfont', +// ), +// iconSize: 26.5), +// NavigationIconView( +// title: _titles[1], +// icon: IconData( +// 0xe656, +// fontFamily: 'iconfont', +// ), +// isCenter: true, +// iconSize: 31), +// +// NavigationIconView( +// title: _titles[3], +// isShowdot: true, +// icon: IconData( +// 0xe66e, +// fontFamily: 'iconfont', +// ), +// type: 4, +// iconSize: 26.5), +// +// NavigationIconView( +// title: _titles[3], +// icon: IconData( +// 0xe67b, +// fontFamily: 'iconfont', +// ), +// iconSize: 26.5), +// ]; +// +// _pages = [ +// ConversActionPage(), +//// RealTimeHelperPage(), +// FriendPage(), +// FindPage(), +//// ConversActionPage(), +// GroupChatListPage(), +// ProfilePage( +// userId: UserData().basicInfo.userId, +// ), +// ]; + } diff --git a/lib/home/realtimehelper/translation_butler_page.dart b/lib/home/realtimehelper/translation_butler_page.dart index cb045e1..c96a099 100644 --- a/lib/home/realtimehelper/translation_butler_page.dart +++ b/lib/home/realtimehelper/translation_butler_page.dart @@ -42,12 +42,19 @@ class TranslationButlerPage extends StatefulWidget { } } + +class ValueModel{ + String name; + var key; + ValueModel(this.name,this.key); +} + class TranslationButlerPageState extends State { int curToLang = 1; int curSourceLang = UserData().language; int curScenes = 0; - List langList; - List scenesList; + List langList; + List scenesList; String extraMsg; @@ -67,8 +74,8 @@ class TranslationButlerPageState extends State { WidgetsBinding.instance.addPostFrameCallback((_) { -// Future.delayed(Duration(seconds: 4), () { -//// CustomUI.buildTranslationHelperOrderDialog(context); + Future.delayed(Duration(seconds: 1), () { + CustomUI.buildTranslationHelperOrderDialog(context,true); // Navigator.of(context).push( // new MaterialPageRoute( // builder: (context) { @@ -80,7 +87,7 @@ class TranslationButlerPageState extends State { // }, // ), // ); -// }); + }); @@ -107,6 +114,12 @@ class TranslationButlerPageState extends State { } apply() { + + + + MsgHandler.sendCreateTranslateOrder(langList[curSourceLang].key,langList[curToLang].key,scenesList[curScenes].key,extraMsg); + + isApply = false; timer = Timer.periodic(Duration(seconds: 1), (Timer t) { @@ -121,19 +134,19 @@ class TranslationButlerPageState extends State { textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', '80'); langList = [ - I18n.of(context).english, - I18n.of(context).Vietnamese, - I18n.of(context).traditional_Chinese, - I18n.of(context).Simplified_Chinese, - I18n.of(context).Korean, - I18n.of(context).Japanese, + ValueModel(I18n.of(context).english,1), + ValueModel(I18n.of(context).Vietnamese,2), + ValueModel(I18n.of(context).traditional_Chinese,4), + ValueModel(I18n.of(context).Simplified_Chinese,8), + ValueModel(I18n.of(context).Korean,16), + ValueModel(I18n.of(context).Japanese,32), ]; scenesList = [ - I18n.of(context).translation_scenes_1, - I18n.of(context).translation_scenes_2, - I18n.of(context).translation_scenes_3, - I18n.of(context).translation_scenes_4, + ValueModel(I18n.of(context).translation_scenes_1,0), + ValueModel(I18n.of(context).translation_scenes_2,1), + ValueModel(I18n.of(context).translation_scenes_3,2), + ValueModel(I18n.of(context).translation_scenes_4,3), ]; } @@ -164,7 +177,7 @@ class TranslationButlerPageState extends State { children: [ Expanded( child: Container(padding: EdgeInsets.only(left: 5),alignment: Alignment.center,child: Text( - langList[curIndex], + langList[curIndex].name, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, textScaleFactor: 1.0, @@ -195,7 +208,7 @@ class TranslationButlerPageState extends State { alignment: Alignment.center, color: Colors.white, padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - child: Text(langList[i], + child: Text(langList[i].name, textScaleFactor: 1.0, maxLines: 1, style: TextStyle( @@ -235,7 +248,7 @@ class TranslationButlerPageState extends State { children: [ Expanded( child: Text( - scenesList[curIndex], + scenesList[curIndex].name, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, textScaleFactor: 1.0, @@ -263,7 +276,7 @@ class TranslationButlerPageState extends State { alignment: Alignment.center, color: Colors.white, padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - child: Text(scenesList[i], + child: Text(scenesList[i].name, textScaleFactor: 1.0, maxLines: 1, style: TextStyle( diff --git a/lib/main.dart b/lib/main.dart index c2c3d1b..42f1230 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -134,11 +134,17 @@ Map language = { 'zh_Hant_CN': LanguageType.TraditionalChinese, 'zh_TW': LanguageType.TraditionalChinese, 'zh_HK': LanguageType.TraditionalChinese, + 'zh_Hant': LanguageType.TraditionalChinese, 'zh_Hant_MO': LanguageType.TraditionalChinese, + 'zh_Hant_TW': LanguageType.TraditionalChinese, + 'zh_Hant_HK': LanguageType.TraditionalChinese, 'zh_Hant_US': LanguageType.TraditionalChinese, + 'zh_Hans': LanguageType.SimplifiedChinese, 'zh_Hans_CN': LanguageType.SimplifiedChinese, 'zh_Hans_US': LanguageType.SimplifiedChinese, 'zh_Hans_MO': LanguageType.SimplifiedChinese, + 'zh_Hans_SG': LanguageType.SimplifiedChinese, + 'zh_CN': LanguageType.SimplifiedChinese, 'ko_KR': LanguageType.Korean, 'ko_KP': LanguageType.Korean, diff --git a/lib/proto/interpreter.pb.dart b/lib/proto/interpreter.pb.dart new file mode 100644 index 0000000..b8d1c5d --- /dev/null +++ b/lib/proto/interpreter.pb.dart @@ -0,0 +1,250 @@ +/// +// Generated code. Do not modify. +// source: interpreter.proto +// +// @dart = 2.3 +// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type + +import 'dart:core' as $core show bool, Deprecated, double, int, List, Map, override, pragma, String; + +import 'package:fixnum/fixnum.dart'; +import 'package:protobuf/protobuf.dart' as $pb; + +export 'interpreter.pbenum.dart'; + +class IssueInterpreterOrderReq extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('IssueInterpreterOrderReq', package: const $pb.PackageName('yl_pb')) + ..a<$core.int>(1, 'tLanguage', $pb.PbFieldType.OU3) + ..a<$core.int>(2, 'scenes', $pb.PbFieldType.O3) + ..aOS(3, 'desc') + ..hasRequiredFields = false + ; + + IssueInterpreterOrderReq._() : super(); + factory IssueInterpreterOrderReq() => create(); + factory IssueInterpreterOrderReq.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory IssueInterpreterOrderReq.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + IssueInterpreterOrderReq clone() => IssueInterpreterOrderReq()..mergeFromMessage(this); + IssueInterpreterOrderReq copyWith(void Function(IssueInterpreterOrderReq) updates) => super.copyWith((message) => updates(message as IssueInterpreterOrderReq)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static IssueInterpreterOrderReq create() => IssueInterpreterOrderReq._(); + IssueInterpreterOrderReq createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static IssueInterpreterOrderReq getDefault() => _defaultInstance ??= create()..freeze(); + static IssueInterpreterOrderReq _defaultInstance; + + $core.int get tLanguage => $_get(0, 0); + set tLanguage($core.int v) { $_setUnsignedInt32(0, v); } + $core.bool hasTLanguage() => $_has(0); + void clearTLanguage() => clearField(1); + + $core.int get scenes => $_get(1, 0); + set scenes($core.int v) { $_setSignedInt32(1, v); } + $core.bool hasScenes() => $_has(1); + void clearScenes() => clearField(2); + + $core.String get desc => $_getS(2, ''); + set desc($core.String v) { $_setString(2, v); } + $core.bool hasDesc() => $_has(2); + void clearDesc() => clearField(3); +} + +class IssueInterpreterOrderRes extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('IssueInterpreterOrderRes', package: const $pb.PackageName('yl_pb')) + ..a<$core.int>(1, 'errorCode', $pb.PbFieldType.O3) + ..aOS(2, 'orderId') + ..a<$core.int>(3, 'waitNum', $pb.PbFieldType.O3) + ..hasRequiredFields = false + ; + + IssueInterpreterOrderRes._() : super(); + factory IssueInterpreterOrderRes() => create(); + factory IssueInterpreterOrderRes.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory IssueInterpreterOrderRes.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + IssueInterpreterOrderRes clone() => IssueInterpreterOrderRes()..mergeFromMessage(this); + IssueInterpreterOrderRes copyWith(void Function(IssueInterpreterOrderRes) updates) => super.copyWith((message) => updates(message as IssueInterpreterOrderRes)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static IssueInterpreterOrderRes create() => IssueInterpreterOrderRes._(); + IssueInterpreterOrderRes createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static IssueInterpreterOrderRes getDefault() => _defaultInstance ??= create()..freeze(); + static IssueInterpreterOrderRes _defaultInstance; + + $core.int get errorCode => $_get(0, 0); + set errorCode($core.int v) { $_setSignedInt32(0, v); } + $core.bool hasErrorCode() => $_has(0); + void clearErrorCode() => clearField(1); + + $core.String get orderId => $_getS(1, ''); + set orderId($core.String v) { $_setString(1, v); } + $core.bool hasOrderId() => $_has(1); + void clearOrderId() => clearField(2); + + $core.int get waitNum => $_get(2, 0); + set waitNum($core.int v) { $_setSignedInt32(2, v); } + $core.bool hasWaitNum() => $_has(2); + void clearWaitNum() => clearField(3); +} + +class ReceivingInterpreterOrderReq extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('ReceivingInterpreterOrderReq', package: const $pb.PackageName('yl_pb')) + ..aOS(1, 'orderId') + ..hasRequiredFields = false + ; + + ReceivingInterpreterOrderReq._() : super(); + factory ReceivingInterpreterOrderReq() => create(); + factory ReceivingInterpreterOrderReq.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ReceivingInterpreterOrderReq.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + ReceivingInterpreterOrderReq clone() => ReceivingInterpreterOrderReq()..mergeFromMessage(this); + ReceivingInterpreterOrderReq copyWith(void Function(ReceivingInterpreterOrderReq) updates) => super.copyWith((message) => updates(message as ReceivingInterpreterOrderReq)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ReceivingInterpreterOrderReq create() => ReceivingInterpreterOrderReq._(); + ReceivingInterpreterOrderReq createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static ReceivingInterpreterOrderReq getDefault() => _defaultInstance ??= create()..freeze(); + static ReceivingInterpreterOrderReq _defaultInstance; + + $core.String get orderId => $_getS(0, ''); + set orderId($core.String v) { $_setString(0, v); } + $core.bool hasOrderId() => $_has(0); + void clearOrderId() => clearField(1); +} + +class ReceivingInterpreterOrderRes extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('ReceivingInterpreterOrderRes', package: const $pb.PackageName('yl_pb')) + ..a<$core.int>(1, 'errorCode', $pb.PbFieldType.O3) + ..hasRequiredFields = false + ; + + ReceivingInterpreterOrderRes._() : super(); + factory ReceivingInterpreterOrderRes() => create(); + factory ReceivingInterpreterOrderRes.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory ReceivingInterpreterOrderRes.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + ReceivingInterpreterOrderRes clone() => ReceivingInterpreterOrderRes()..mergeFromMessage(this); + ReceivingInterpreterOrderRes copyWith(void Function(ReceivingInterpreterOrderRes) updates) => super.copyWith((message) => updates(message as ReceivingInterpreterOrderRes)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static ReceivingInterpreterOrderRes create() => ReceivingInterpreterOrderRes._(); + ReceivingInterpreterOrderRes createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static ReceivingInterpreterOrderRes getDefault() => _defaultInstance ??= create()..freeze(); + static ReceivingInterpreterOrderRes _defaultInstance; + + $core.int get errorCode => $_get(0, 0); + set errorCode($core.int v) { $_setSignedInt32(0, v); } + $core.bool hasErrorCode() => $_has(0); + void clearErrorCode() => clearField(1); +} + +class CancellationInterpreterOrderReq extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('CancellationInterpreterOrderReq', package: const $pb.PackageName('yl_pb')) + ..aOS(1, 'orderId') + ..hasRequiredFields = false + ; + + CancellationInterpreterOrderReq._() : super(); + factory CancellationInterpreterOrderReq() => create(); + factory CancellationInterpreterOrderReq.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CancellationInterpreterOrderReq.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + CancellationInterpreterOrderReq clone() => CancellationInterpreterOrderReq()..mergeFromMessage(this); + CancellationInterpreterOrderReq copyWith(void Function(CancellationInterpreterOrderReq) updates) => super.copyWith((message) => updates(message as CancellationInterpreterOrderReq)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static CancellationInterpreterOrderReq create() => CancellationInterpreterOrderReq._(); + CancellationInterpreterOrderReq createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static CancellationInterpreterOrderReq getDefault() => _defaultInstance ??= create()..freeze(); + static CancellationInterpreterOrderReq _defaultInstance; + + $core.String get orderId => $_getS(0, ''); + set orderId($core.String v) { $_setString(0, v); } + $core.bool hasOrderId() => $_has(0); + void clearOrderId() => clearField(1); +} + +class CancellationInterpreterOrderRes extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('CancellationInterpreterOrderRes', package: const $pb.PackageName('yl_pb')) + ..a<$core.int>(1, 'errorCode', $pb.PbFieldType.O3) + ..aOS(2, 'orderId') + ..hasRequiredFields = false + ; + + CancellationInterpreterOrderRes._() : super(); + factory CancellationInterpreterOrderRes() => create(); + factory CancellationInterpreterOrderRes.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory CancellationInterpreterOrderRes.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + CancellationInterpreterOrderRes clone() => CancellationInterpreterOrderRes()..mergeFromMessage(this); + CancellationInterpreterOrderRes copyWith(void Function(CancellationInterpreterOrderRes) updates) => super.copyWith((message) => updates(message as CancellationInterpreterOrderRes)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static CancellationInterpreterOrderRes create() => CancellationInterpreterOrderRes._(); + CancellationInterpreterOrderRes createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static CancellationInterpreterOrderRes getDefault() => _defaultInstance ??= create()..freeze(); + static CancellationInterpreterOrderRes _defaultInstance; + + $core.int get errorCode => $_get(0, 0); + set errorCode($core.int v) { $_setSignedInt32(0, v); } + $core.bool hasErrorCode() => $_has(0); + void clearErrorCode() => clearField(1); + + $core.String get orderId => $_getS(1, ''); + set orderId($core.String v) { $_setString(1, v); } + $core.bool hasOrderId() => $_has(1); + void clearOrderId() => clearField(2); +} + +class DeliveryInterpreterOrderPush extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('DeliveryInterpreterOrderPush', package: const $pb.PackageName('yl_pb')) + ..aOS(1, 'orderId') + ..aInt64(2, 'createTime') + ..a<$core.int>(3, 'tLanguage', $pb.PbFieldType.OU3) + ..a<$core.int>(4, 'scenes', $pb.PbFieldType.O3) + ..aOS(5, 'desc') + ..hasRequiredFields = false + ; + + DeliveryInterpreterOrderPush._() : super(); + factory DeliveryInterpreterOrderPush() => create(); + factory DeliveryInterpreterOrderPush.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory DeliveryInterpreterOrderPush.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + DeliveryInterpreterOrderPush clone() => DeliveryInterpreterOrderPush()..mergeFromMessage(this); + DeliveryInterpreterOrderPush copyWith(void Function(DeliveryInterpreterOrderPush) updates) => super.copyWith((message) => updates(message as DeliveryInterpreterOrderPush)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static DeliveryInterpreterOrderPush create() => DeliveryInterpreterOrderPush._(); + DeliveryInterpreterOrderPush createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static DeliveryInterpreterOrderPush getDefault() => _defaultInstance ??= create()..freeze(); + static DeliveryInterpreterOrderPush _defaultInstance; + + $core.String get orderId => $_getS(0, ''); + set orderId($core.String v) { $_setString(0, v); } + $core.bool hasOrderId() => $_has(0); + void clearOrderId() => clearField(1); + + Int64 get createTime => $_getI64(1); + set createTime(Int64 v) { $_setInt64(1, v); } + $core.bool hasCreateTime() => $_has(1); + void clearCreateTime() => clearField(2); + + $core.int get tLanguage => $_get(2, 0); + set tLanguage($core.int v) { $_setUnsignedInt32(2, v); } + $core.bool hasTLanguage() => $_has(2); + void clearTLanguage() => clearField(3); + + $core.int get scenes => $_get(3, 0); + set scenes($core.int v) { $_setSignedInt32(3, v); } + $core.bool hasScenes() => $_has(3); + void clearScenes() => clearField(4); + + $core.String get desc => $_getS(4, ''); + set desc($core.String v) { $_setString(4, v); } + $core.bool hasDesc() => $_has(4); + void clearDesc() => clearField(5); +} + diff --git a/lib/proto/interpreter.pbenum.dart b/lib/proto/interpreter.pbenum.dart new file mode 100644 index 0000000..01ab6c7 --- /dev/null +++ b/lib/proto/interpreter.pbenum.dart @@ -0,0 +1,30 @@ +/// +// Generated code. Do not modify. +// source: interpreter.proto +// +// @dart = 2.3 +// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type + +// ignore_for_file: UNDEFINED_SHOWN_NAME,UNUSED_SHOWN_NAME +import 'dart:core' as $core show int, dynamic, String, List, Map; +import 'package:protobuf/protobuf.dart' as $pb; + +class InterpreterOrderState extends $pb.ProtobufEnum { + static const InterpreterOrderState Distributeing = InterpreterOrderState._(1, 'Distributeing'); + static const InterpreterOrderState Underway = InterpreterOrderState._(2, 'Underway'); + static const InterpreterOrderState Rescinded = InterpreterOrderState._(3, 'Rescinded'); + static const InterpreterOrderState Completed = InterpreterOrderState._(4, 'Completed'); + + static const $core.List values = [ + Distributeing, + Underway, + Rescinded, + Completed, + ]; + + static final $core.Map<$core.int, InterpreterOrderState> _byValue = $pb.ProtobufEnum.initByValue(values); + static InterpreterOrderState valueOf($core.int value) => _byValue[value]; + + const InterpreterOrderState._($core.int v, $core.String n) : super(v, n); +} + diff --git a/lib/proto/interpreter.pbjson.dart b/lib/proto/interpreter.pbjson.dart new file mode 100644 index 0000000..6dfbeef --- /dev/null +++ b/lib/proto/interpreter.pbjson.dart @@ -0,0 +1,75 @@ +/// +// Generated code. Do not modify. +// source: interpreter.proto +// +// @dart = 2.3 +// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type + +const InterpreterOrderState$json = const { + '1': 'InterpreterOrderState', + '2': const [ + const {'1': 'Distributeing', '2': 1}, + const {'1': 'Underway', '2': 2}, + const {'1': 'Rescinded', '2': 3}, + const {'1': 'Completed', '2': 4}, + ], +}; + +const IssueInterpreterOrderReq$json = const { + '1': 'IssueInterpreterOrderReq', + '2': const [ + const {'1': 'TLanguage', '3': 1, '4': 1, '5': 13, '10': 'TLanguage'}, + const {'1': 'Scenes', '3': 2, '4': 1, '5': 5, '10': 'Scenes'}, + const {'1': 'Desc', '3': 3, '4': 1, '5': 9, '10': 'Desc'}, + ], +}; + +const IssueInterpreterOrderRes$json = const { + '1': 'IssueInterpreterOrderRes', + '2': const [ + const {'1': 'ErrorCode', '3': 1, '4': 1, '5': 5, '10': 'ErrorCode'}, + const {'1': 'OrderId', '3': 2, '4': 1, '5': 9, '10': 'OrderId'}, + const {'1': 'WaitNum', '3': 3, '4': 1, '5': 5, '10': 'WaitNum'}, + ], +}; + +const ReceivingInterpreterOrderReq$json = const { + '1': 'ReceivingInterpreterOrderReq', + '2': const [ + const {'1': 'OrderId', '3': 1, '4': 1, '5': 9, '10': 'OrderId'}, + ], +}; + +const ReceivingInterpreterOrderRes$json = const { + '1': 'ReceivingInterpreterOrderRes', + '2': const [ + const {'1': 'ErrorCode', '3': 1, '4': 1, '5': 5, '10': 'ErrorCode'}, + ], +}; + +const CancellationInterpreterOrderReq$json = const { + '1': 'CancellationInterpreterOrderReq', + '2': const [ + const {'1': 'OrderId', '3': 1, '4': 1, '5': 9, '10': 'OrderId'}, + ], +}; + +const CancellationInterpreterOrderRes$json = const { + '1': 'CancellationInterpreterOrderRes', + '2': const [ + const {'1': 'ErrorCode', '3': 1, '4': 1, '5': 5, '10': 'ErrorCode'}, + const {'1': 'OrderId', '3': 2, '4': 1, '5': 9, '10': 'OrderId'}, + ], +}; + +const DeliveryInterpreterOrderPush$json = const { + '1': 'DeliveryInterpreterOrderPush', + '2': const [ + const {'1': 'OrderId', '3': 1, '4': 1, '5': 9, '10': 'OrderId'}, + const {'1': 'CreateTime', '3': 2, '4': 1, '5': 3, '10': 'CreateTime'}, + const {'1': 'TLanguage', '3': 3, '4': 1, '5': 13, '10': 'TLanguage'}, + const {'1': 'Scenes', '3': 4, '4': 1, '5': 5, '10': 'Scenes'}, + const {'1': 'Desc', '3': 5, '4': 1, '5': 9, '10': 'Desc'}, + ], +}; + diff --git a/lib/proto/interpreter.pbserver.dart b/lib/proto/interpreter.pbserver.dart new file mode 100644 index 0000000..207f54e --- /dev/null +++ b/lib/proto/interpreter.pbserver.dart @@ -0,0 +1,9 @@ +/// +// Generated code. Do not modify. +// source: interpreter.proto +// +// @dart = 2.3 +// ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type + +export 'interpreter.pb.dart'; + diff --git a/lib/proto/interpreter.proto b/lib/proto/interpreter.proto new file mode 100644 index 0000000..a7569c7 --- /dev/null +++ b/lib/proto/interpreter.proto @@ -0,0 +1,55 @@ +syntax = "proto2"; +package yl_pb; + +//comid = 3 +enum InterpreterOrderState{ + Distributeing = 1; //派发中 + Underway = 2; //进行中 + Rescinded = 3; //已撤销 + Completed = 4; //已完成 +} + +//-------------------------------------------消息------------------------- +//Msg=1 发布翻译管家帮助订单 +message IssueInterpreterOrderReq { + optional uint32 TLanguage =1; //翻译语言 + optional int32 Scenes =2; //场景 + optional string Desc =3; //描述 +} + +//Msg=2 发布翻译管家帮助订单回应 +message IssueInterpreterOrderRes { + optional int32 ErrorCode = 1; //详见错误码文档 + optional string OrderId =2; //订单号 + optional int32 WaitNum =3; //需要等待人数 +} + +//Msg= 3 接收订单消息请求 +message ReceivingInterpreterOrderReq { + optional string OrderId =1; //订单号 +} + +//Msg= 4 接收订单消息回应 +message ReceivingInterpreterOrderRes { + optional int32 ErrorCode = 1; //详见错误码文档 +} + +//Msg= 5 撤销订单消息 +message CancellationInterpreterOrderReq { + optional string OrderId =1; //订单号 +} + +//Msg= 6 撤销订单消息回应 +message CancellationInterpreterOrderRes { + optional int32 ErrorCode = 1; //详见错误码文档 + optional string OrderId = 2; //订单号 +} + +//Msg= 50 派送订单推送 +message DeliveryInterpreterOrderPush { + optional string OrderId =1; //订单号 + optional int64 CreateTime = 2; //创建时间 + optional uint32 TLanguage =3; //翻译语言 + optional int32 Scenes =4; //场景 + optional string Desc =5; //描述 +} \ No newline at end of file diff --git a/lib/utils/CustomUI.dart b/lib/utils/CustomUI.dart index 9d08836..5731d57 100644 --- a/lib/utils/CustomUI.dart +++ b/lib/utils/CustomUI.dart @@ -11,6 +11,7 @@ import 'package:chat/models/group_info_model.dart'; import 'package:chat/photo/ui/dialog/not_permission_dialog.dart'; import 'package:chat/utils/LoadingDialog.dart'; import 'package:chat/utils/TokenMgr.dart'; +import 'package:chat/utils/msgHandler.dart'; import 'package:chat/utils/screen.dart'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; @@ -1250,7 +1251,15 @@ class CustomUI { - static void buildTranslationHelperOrderDialog(BuildContext context) { + ///** isUser 是否是用户,或为 翻译 + static void buildTranslationHelperOrderDialog(BuildContext context,bool isUser,{String orderId,int scenes=0,String desc}) { + + var scenesList = [ + I18n.of(context).translation_scenes_1, + I18n.of(context).translation_scenes_2, + I18n.of(context).translation_scenes_3, + I18n.of(context).translation_scenes_4, + ]; Navigator.of(context).push(TutorialOverlay( child: @@ -1287,22 +1296,57 @@ class CustomUI { ), ), Text( - I18n.of(context).translation_butler_dialog_order.replaceAll('s1', 'xxx'), + I18n.of(context).translation_butler_dialog_order.replaceAll('/s1',isUser?I18n.of(context).you: 'xxx'), textScaleFactor: 1.0, textAlign: TextAlign.left, style: TextStyle( color: AppColors.NewAppbarTextColor, fontSize: 14), ), SizedBox(height: 10,), - Text( - '时间:今天11:45 时长:10分钟', + Text( + '时间:今天11:45 时长:5分钟', textScaleFactor: 1.0, textAlign: TextAlign.left, style: TextStyle( - color: AppColors.NewAppbarTextColor, fontSize: 14), + color: Color(0xFF797979), fontSize: 11), + ), + + isUser?Container():Text( + '场景:${scenesList[scenes]}', + textScaleFactor: 1.0, + textAlign: TextAlign.left, + style: TextStyle( + color: Color(0xFF797979), fontSize: 11), ), - Container(margin: EdgeInsets.only(left: 30, right: 30, top: 20,bottom: 10),child: CountDownButton( I18n.of(context).translation_butler_dialog_start_service,(){ + isUser?Container():Text( + '更多描述:$desc}', + textScaleFactor: 1.0, + textAlign: TextAlign.left, + style: TextStyle( + color: Color(0xFF797979), fontSize: 11), + ), +// + Container(margin: EdgeInsets.only(left: 30, right: 30, top: 20,bottom: 10),child: isUser?Container( + margin: EdgeInsets.only( top: 10), + height: 36, + alignment: Alignment.center, + child: RaisedButton( + color: Color(0xff3875E9), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(10))), + child: Padding(padding: EdgeInsets.only(left: 10,right: 10),child: Text( + I18n.of(context).translation_butler_dialog_start_chat , + textScaleFactor: 1.0, + style: TextStyle(color: Colors.white, fontSize: 15,fontWeight: FontWeight.w500), + + ),), + onPressed:(){ + Navigator.of(context)..pop(); + } ), + ):CountDownButton( I18n.of(context).translation_butler_dialog_start_service,(){ + + MsgHandler.sendReceiveOrder(orderId); Navigator.of(context).pop(); }) ,) diff --git a/lib/utils/NetUtil.dart b/lib/utils/NetUtil.dart index 56e994c..0240379 100644 --- a/lib/utils/NetUtil.dart +++ b/lib/utils/NetUtil.dart @@ -339,7 +339,7 @@ class NetWork { checkConnect() { debugPrint(' ios bg 取消计时器'); iosBgTimer?.cancel(); - + iosBgTimer=null; if (isInit && !isConnect && !isConnecting) { reconnect(); } else { diff --git a/lib/utils/app_navigator.dart b/lib/utils/app_navigator.dart index c56822d..03ccc53 100644 --- a/lib/utils/app_navigator.dart +++ b/lib/utils/app_navigator.dart @@ -102,7 +102,7 @@ class AppNavigator { //聊天 static pushChatPage(BuildContext context, int friendId, {enterType = 0, enterContent}) async { - if (enterType == 1) { + if (enterType == 1 ||enterType == 2) { Navigator.of(context).pop(context); } AppNavigator.push( @@ -118,7 +118,7 @@ class AppNavigator { //群聊 static pushGroupChatPage(BuildContext context, GroupInfoModel groupInfoModel, {enterType = 0, enterContent}) async { - if (enterType == 1) { + if (enterType == 1 ||enterType == 2) { Navigator.of(context).pop(context); } diff --git a/lib/utils/msgHandler.dart b/lib/utils/msgHandler.dart index c44724b..4b43984 100644 --- a/lib/utils/msgHandler.dart +++ b/lib/utils/msgHandler.dart @@ -11,6 +11,7 @@ import 'package:chat/home/IndexPage.dart'; import 'package:chat/models/ChatMsg.dart'; import 'package:chat/models/group_info_model.dart'; import 'package:chat/proto/all.pbserver.dart'; +import 'package:chat/proto/interpreter.pb.dart'; import 'package:chat/utils/NetUtil.dart'; import 'package:chat/utils/blacklist_mgr.dart'; import 'package:chat/utils/friend_list_mgr.dart'; @@ -919,6 +920,21 @@ class MsgHandler { handlerGroupIsShowMenberNiceName(content); } break; + + + case ComId.TranslateOrder: + + if(msgId==2){ + handlerCreateTranslateOrder(content); + }else if(msgId ==4){ + handlerReceiveOrder(content); + }else if(msgId ==6){ + handlerCancelTranslateOrder(content); + }else if(msgId==50){ + handlerDeliveryInterpreterOrderPush(content); + } + break; + case ComId.PushMsg: String msg = PushNetRelay.fromBuffer(content).msg; print('接受的推送消息:msg $msg'); @@ -1205,6 +1221,89 @@ class MsgHandler { NetWork().sendMsg(ComId.Chat, 229, seq); } + + + //发布翻译管家帮助订单 + static sendCreateTranslateOrder(int fromLanguage,int toLanguage,int scences,String extraDesc) { + + + debugPrint('发布翻译管家帮助订单 fromLanguage:$fromLanguage toLanguage: $toLanguage | ${fromLanguage|toLanguage}' ); + var seq = IssueInterpreterOrderReq.create(); + seq.tLanguage = fromLanguage|toLanguage; + + NetWork().sendMsg(ComId.TranslateOrder, 1, seq); + } + + //发布翻译管家帮助订单回应 + static handlerCreateTranslateOrder(List msgContent) { + debugPrint('发布翻译管家帮助订单回应'); + var res = IssueInterpreterOrderRes.fromBuffer(msgContent); + if (res.errorCode == 0) { + +// GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); + debugPrint('发布翻译管家帮助订单回应-订单号: ${res.orderId} 等待人数 ${res.waitNum}'); + } else { + debugPrint('发布翻译管家帮助订单回应${res.errorCode}'); + } + } + + //撤销订单消息 + static sendCancelTranslateOrder( String orderId) { + + + debugPrint('取消订单 fromLanguage:$orderId' ); + var seq = CancellationInterpreterOrderReq.create(); + seq.orderId = orderId; + + NetWork().sendMsg(ComId.TranslateOrder, 5, seq); + } + + //撤销订单消息回应 + static handlerCancelTranslateOrder(List msgContent) { + debugPrint('撤销订单消息回应'); + var res = CancellationInterpreterOrderRes.fromBuffer(msgContent); + if (res.errorCode == 0) { + +// GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); + debugPrint('撤销订单消息回应成功: ${res.orderId}'); + } else { + debugPrint('撤销订单消息回应成功失败${res.errorCode}'); + } + } + + //派送订单推送 + static handlerDeliveryInterpreterOrderPush(List msgContent) { + debugPrint('撤销订单消息回应'); + var res = DeliveryInterpreterOrderPush.fromBuffer(msgContent); + print('OrderId: ${res.orderId} createTime: ${res.createTime} tLanguage:${res.tLanguage} scenes:${res.scenes} desc${res.desc}'); + } + + +//接收订单请求 + static sendReceiveOrder( String orderId) { + + debugPrint('接收订单消息请求 orderId:$orderId' ); + var seq = ReceivingInterpreterOrderReq.create(); + seq.orderId = orderId; + + NetWork().sendMsg(ComId.TranslateOrder,3, seq); + } + + //接收订单消息回应 + static handlerReceiveOrder(List msgContent) { + debugPrint('接收订单消息回应'); + var res = ReceivingInterpreterOrderRes.fromBuffer(msgContent); + if (res.errorCode == 0) { + +// GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); + debugPrint('接收订单消息回应成功: '); + } else { + debugPrint('接收订单消息回应失败${res.errorCode}'); + } + } + + + //消息免打扰请求结果 static handlerGroupIsShowMenberNiceName(List msgContent) { print('设置是否显示群昵称'); diff --git a/lib/utils/wpop/w_popup_menu.dart b/lib/utils/wpop/w_popup_menu.dart index 62b67eb..d40358a 100644 --- a/lib/utils/wpop/w_popup_menu.dart +++ b/lib/utils/wpop/w_popup_menu.dart @@ -317,7 +317,7 @@ class _MenuPopWidgetState extends State<_MenuPopWidget> { }); }, child: Container( - width: _arrowWidth, + width: _arrowWidth-4, height: widget.menuHeight, child: Image.asset( (_curPage + 1) * diff --git a/pubspec.lock b/pubspec.lock index 665fcff..02f2bdb 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -482,7 +482,7 @@ packages: name: flutter_webview_plugin url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.10" + version: "0.3.10+1" fluwx_no_pay: dependency: "direct main" description: @@ -814,10 +814,10 @@ packages: description: path: "." ref: HEAD - resolved-ref: c3f6591a653851399ab957ed00651cfd86410e37 + resolved-ref: a9ada07787cd41ea8acd97904ee2d1d44e3c07ea url: "https://github.com/CaiJingLong/flutter_photo_manager.git" source: git - version: "0.5.0-dev.1" + version: "0.5.0-dev.3" platform: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 07e33ba..c972722 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -156,7 +156,8 @@ dependencies: lpinyin: ^1.0.7 #网页-支付跳转 - flutter_webview_plugin: ^0.3.10 + flutter_webview_plugin: ^0.3.10+1 +# firebase_auth: ^0.15.3 #图片保存 image_gallery_saver: ^1.2.2