diff --git a/assets/images/img_splash_4.png b/assets/images/img_splash_4.png index 90ed429..0258739 100644 Binary files a/assets/images/img_splash_4.png and b/assets/images/img_splash_4.png differ diff --git a/assets/images/img_splash_5.png b/assets/images/img_splash_5.png index 18abe7e..d69020a 100644 Binary files a/assets/images/img_splash_5.png and b/assets/images/img_splash_5.png differ diff --git a/assets/img_splash_4.png b/assets/img_splash_4.png deleted file mode 100644 index 0258739..0000000 Binary files a/assets/img_splash_4.png and /dev/null differ diff --git a/assets/img_splash_5.png b/assets/img_splash_5.png deleted file mode 100644 index d69020a..0000000 Binary files a/assets/img_splash_5.png and /dev/null differ diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json index 0c72a5e..6848363 100644 --- a/i18n/vi-VN.json +++ b/i18n/vi-VN.json @@ -1164,7 +1164,7 @@ "search_plach": "Rà soát địa điểm", "finding_place": " Tìm địa điểm", "real_time_helper": "Hỗ trợ nhanh", - "translation_butler": "Dịch vụ dịch thuật thời gian thực", + "translation_butler": "Dịch vụ dịch thuật \nthời gian thực", "travel_butler": " Trợ lý chỉ đường", "translation_butler_tips": "Trợ lý dịch thuật giúp bạn giải quyết trở ngại ngôn ngữ", "choose_language": " Vui lòng chọn một ngôn ngữ để dịch ", diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index 8c3b364..5ec5632 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -2,9 +2,10 @@ # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/random/sdk/flutter_sdk" export "FLUTTER_APPLICATION_PATH=/Users/random/code/flutter/project/hibok" -export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_TARGET=/Users/random/code/flutter/project/hibok/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios-release" +export "FLUTTER_FRAMEWORK_DIR=/Users/random/sdk/flutter_sdk/bin/cache/artifacts/engine/ios" export "FLUTTER_BUILD_NAME=1.1.0" export "FLUTTER_BUILD_NUMBER=15" +export "TRACK_WIDGET_CREATION=true" diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index a7fede0..06d12f7 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -188,6 +188,8 @@ io.flutter.embedded_views_preview + UISupportsDocumentBrowser + kTCCServiceMediaLibrary App need your agree, can visit your music diff --git a/lib/chat/ChatPage.dart b/lib/chat/ChatPage.dart index b22a8d7..5972194 100644 --- a/lib/chat/ChatPage.dart +++ b/lib/chat/ChatPage.dart @@ -48,6 +48,9 @@ import 'package:chat/utils/PopUpMenu.dart' as myPop; import 'package:chat/models/money_change.dart'; class ChatPage extends StatefulWidget { + + static bool isChatPageActive=false; + final int friendId; final int enterType; // 0默认 1图片 final dynamic enterContent; @@ -104,6 +107,7 @@ class _ChatPageState extends State { SoundUtils().stop(); nickNameController.dispose(); super.dispose(); + ChatPage.isChatPageActive =false; } jumpToMsg(time) async { @@ -132,6 +136,7 @@ class _ChatPageState extends State { void initState() { super.initState(); print('init chatpage'); + ChatPage.isChatPageActive=true; getDefaultSetting(); getUserInfo(); @@ -194,6 +199,28 @@ class _ChatPageState extends State { TranslateHKMgr().order=null; }); + + if(!UserData().isTranslateUser){ + + var cancle = InkWell(onTap: (){Navigator.pop(context);},child: Container( + decoration: BoxDecoration( + color: const Color(0XFFC7E5FF), + borderRadius: BorderRadius.all( + Radius.circular(Constants.LittleButtonRadius))), + margin: EdgeInsets.only(top: 0, bottom: 18.5), + height: 37.5, + width: 200, + alignment: Alignment.center, + child: CountDownButton(I18n.of(context).cancel, (){Navigator.of(context).pop();},isOnlyRichText: true,countDownTime: 10,)),); + + CustomUI.buildTowConfirmWithCountDown(context, '是否再来一单', '是的', (){ + MsgHandler.sendAnotherOrderReq(); + Navigator.of(context).pop(); + + }, cancle); + } + + } void _sendFile(File file) async { @@ -336,6 +363,9 @@ class _ChatPageState extends State { ); } + + + List actions = []; int voucher = Provider.of(context).voucher; @@ -423,7 +453,7 @@ class _ChatPageState extends State { Provider.value(value: widget.friendId), ], child: GestureDetector( - onTap: hideKeyBoard, + onTapDown: (args){hideKeyBoard();}, child: ExtendedTextSelectionPointerHandler( ///选择文字,消除弹窗 @@ -530,7 +560,7 @@ class _ChatPageState extends State { MsgHandler.sendEndTransHKOrderReq(); Navigator.of(context).pop(); }, - '取消', + I18n.of(context).cancel, (){ Navigator.of(context).pop();}); } }else{ diff --git a/lib/chat/company_server_view.dart b/lib/chat/company_server_view.dart index 9db6c0a..f125a08 100644 --- a/lib/chat/company_server_view.dart +++ b/lib/chat/company_server_view.dart @@ -165,7 +165,7 @@ class _CompanyServerPageState extends State { actionBarColor: "#50A7F9", actionBarTitle: "Hibok", allViewTitle: "", - useDetailsView: false, + useDetailsView: true, selectCircleStrokeColor: "#000000", ), ); diff --git a/lib/chat/full_img_view.dart b/lib/chat/full_img_view.dart index 58599d7..1812631 100644 --- a/lib/chat/full_img_view.dart +++ b/lib/chat/full_img_view.dart @@ -1,8 +1,10 @@ import 'dart:io'; import 'dart:typed_data'; +import 'package:chat/data/constants.dart'; import 'package:chat/generated/i18n.dart'; import 'package:chat/models/ChatMsg.dart'; +import 'package:chat/r.dart'; import 'package:chat/utils/screen.dart'; import 'package:extended_image/extended_image.dart'; import 'package:flutter/material.dart'; @@ -98,19 +100,17 @@ class _PhotoPageState extends State )) ], )), + Positioned(bottom: 1,child: UnconstrainedBox(child: Container( width: Screen.width,height: 95,child: Image.asset(R.assetsImagesImgCheckPhotoBg,fit: BoxFit.fill,),),),), Positioned( - right: 10, - bottom: 10, - child: Material(child: InkWell( + right: 15, + bottom: 15, + child: Material(color: Colors.transparent,child: InkWell( onTap: saveToGallery, child: Container( width: 50, height: 50, padding: EdgeInsets.all(5), - decoration: BoxDecoration( - color: Colors.grey.withAlpha(150), - borderRadius: BorderRadius.circular(8)), - child: Icon(Icons.save_alt, color: Colors.white70), + child: Icon( IconData(0xe680, fontFamily: Constants.IconFontFamily), color: Colors.white70,size: 40,), )),)) ], ))),); diff --git a/lib/chat/input_bar.dart b/lib/chat/input_bar.dart index 8e7f1ba..a76675b 100644 --- a/lib/chat/input_bar.dart +++ b/lib/chat/input_bar.dart @@ -761,7 +761,7 @@ class InputBarState extends State actionBarColor: "#50A7F9", actionBarTitle: "Hibok", allViewTitle: "", - useDetailsView: false, + useDetailsView: true, selectCircleStrokeColor: "#000000", ), ); diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index a0a3a65..c9a4673 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -6044,9 +6044,9 @@ class _I18n_vi_VN extends I18n { /// "Hỗ trợ nhanh" @override String get real_time_helper => "Hỗ trợ nhanh"; - /// "Dịch vụ dịch thuật thời gian thực" + /// "Dịch vụ dịch thuật \nthời gian thực" @override - String get translation_butler => "Dịch vụ dịch thuật thời gian thực"; + String get translation_butler => "Dịch vụ dịch thuật \nthời gian thực"; /// " Trợ lý chỉ đường" @override String get travel_butler => " Trợ lý chỉ đường"; diff --git a/lib/home/AddProgram.dart b/lib/home/AddProgram.dart index 27f6ec4..05589c2 100644 --- a/lib/home/AddProgram.dart +++ b/lib/home/AddProgram.dart @@ -721,7 +721,7 @@ class _AddProgramState extends State { actionBarColor: "#50A7F9", actionBarTitle: "Hibok", allViewTitle: "", - useDetailsView: false, + useDetailsView: true, selectCircleStrokeColor: "#000000", ), ); 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/InformUser.dart b/lib/home/InformUser.dart index 1ad700d..36a7be4 100644 --- a/lib/home/InformUser.dart +++ b/lib/home/InformUser.dart @@ -191,7 +191,7 @@ class _InformUserPageState extends State { actionBarColor: "#50A7F9", actionBarTitle: "Hibok", allViewTitle: "", - useDetailsView: false, + useDetailsView: true, selectCircleStrokeColor: "#000000", ), ); diff --git a/lib/home/ProfilePage.dart b/lib/home/ProfilePage.dart index 5be2db1..ca7b8bd 100644 --- a/lib/home/ProfilePage.dart +++ b/lib/home/ProfilePage.dart @@ -451,7 +451,7 @@ class _ProfilePageState extends State actionBarColor: "#50A7F9", actionBarTitle: "Hibok", allViewTitle: "", - useDetailsView: false, + useDetailsView: true, selectCircleStrokeColor: "#000000", ), ); diff --git a/lib/home/ProgramDetail.dart b/lib/home/ProgramDetail.dart index 5801ed4..e25fc53 100644 --- a/lib/home/ProgramDetail.dart +++ b/lib/home/ProgramDetail.dart @@ -8,6 +8,7 @@ import 'package:chat/utils/MessageBox.dart'; import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/PicSwiper.dart'; import 'package:chat/utils/app_navigator.dart'; +import 'package:chat/utils/local_notification_util.dart'; import 'package:chat/utils/msgHandler.dart'; import 'package:flutter/material.dart'; import 'package:oktoast/oktoast.dart'; @@ -67,6 +68,9 @@ class _ProgramDetailPageState extends State { MessageMgr().on('update_dy', msgUpdateDy); MessageMgr().on('refresh_list', msgRefreshList); getData(); + + LocalNotificationUtil().cleanAllNotifications(); + } msgRefreshList(data) { diff --git a/lib/home/daily_bonus_page.dart b/lib/home/daily_bonus_page.dart index 01080db..dc818c4 100644 --- a/lib/home/daily_bonus_page.dart +++ b/lib/home/daily_bonus_page.dart @@ -501,7 +501,7 @@ class DailyBouusState extends State with SingleTickerProviderStateMixin { child: Text( bean.state == 1 ? I18n.of(context).have_get - : '${bean.h}${I18n.of(context).daily_translate_voucher}', + : '${bean.h}', textScaleFactor: 1.0, style: TextStyle(color: Colors.white, fontSize: 12), ), diff --git a/lib/home/homeMain.dart b/lib/home/homeMain.dart index 75e1633..c3fad2a 100644 --- a/lib/home/homeMain.dart +++ b/lib/home/homeMain.dart @@ -362,79 +362,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), @@ -446,17 +389,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, + type: 6, iconSize: 26.5), - NavigationIconView( title: _titles[3], icon: IconData( @@ -467,16 +408,75 @@ 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, +// ), +// ]; } @override @@ -553,11 +553,12 @@ class _HomeMainState extends State { _navigationViews.map((NavigationIconView view) { return view.item; }).toList(), - onTap: (int index) { + onTap: (int index) async{ if (_currentIndex == index) { //在当前页面点击不刷新 return; } + setStatusBar(); //刷新我的界面数据 if (index == 4) { MessageMgr().emit('update_data'); diff --git a/lib/home/realtimehelper/translation_butler_page.dart b/lib/home/realtimehelper/translation_butler_page.dart index 691242e..ddfb5d6 100644 --- a/lib/home/realtimehelper/translation_butler_page.dart +++ b/lib/home/realtimehelper/translation_butler_page.dart @@ -133,7 +133,7 @@ class TranslationButlerPageState extends State { print('time:$time'); int second = int.parse(time) ~/ 1000; - if((DateTime.now().millisecondsSinceEpoch ~/ 1000 - second)>8*3600){ ///超过5小时清除缓存记录 + if((DateTime.now().millisecondsSinceEpoch ~/ 1000 - second)>1800){ ///超过半小时清除缓存记录 SPUtils.save(Constants.TranslationHelper,null); return; } diff --git a/lib/home/splash_page.dart b/lib/home/splash_page.dart index 28cdcd9..937958b 100644 --- a/lib/home/splash_page.dart +++ b/lib/home/splash_page.dart @@ -42,14 +42,14 @@ class SplashPageState extends State { list.add(SplashBean( 'assets/images/img_splash_4.png', - I18n.of(Constants.getCurrentContext()).translation_butler, - I18n.of(Constants.getCurrentContext()).splash_tips_content4, + I18n.of(Constants.getCurrentContext()).travel_butler, + I18n.of(Constants.getCurrentContext()).splash_tips_content5, Color(0xFF2B79F7))); list.add(SplashBean( 'assets/images/img_splash_5.png', - I18n.of(Constants.getCurrentContext()).travel_butler, - I18n.of(Constants.getCurrentContext()).splash_tips_content5, + I18n.of(Constants.getCurrentContext()).translation_butler, + I18n.of(Constants.getCurrentContext()).splash_tips_content4, Color(0xFFBE58FF))); @@ -176,6 +176,7 @@ class SplashPageState extends State { Text( data.title, textScaleFactor: 1.0, + textAlign: TextAlign.center, style: TextStyle(color: data.titleColor, fontSize: 30), ), SizedBox( diff --git a/lib/main.dart b/lib/main.dart index 98f3866..2a7467e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -294,6 +294,8 @@ class _MyAppState extends State with WidgetsBindingObserver { MessageMgr().emit( 'Receive AudioChat Request', MsgHandler.audioChatRequestFriendId); } +// await FlutterStatusbarcolor.setStatusBarColor(Colors.white); + break; case AppLifecycleState.paused: // 应用程序不可见,后台 print('切换到后台'); diff --git a/lib/proto/transhousekeeper.pb.dart b/lib/proto/transhousekeeper.pb.dart index af427b5..63af7a3 100644 --- a/lib/proto/transhousekeeper.pb.dart +++ b/lib/proto/transhousekeeper.pb.dart @@ -377,6 +377,7 @@ class DeliveryTransHKOrderPush extends $pb.GeneratedMessage { class CancellationTransHKOrderPush extends $pb.GeneratedMessage { static final $pb.BuilderInfo _i = $pb.BuilderInfo('CancellationTransHKOrderPush', package: const $pb.PackageName('yl_pb')) ..aOS(1, 'orderId') + ..e(2, 'type', $pb.PbFieldType.OE, TransHKOrderCancellation.TimeOut, TransHKOrderCancellation.valueOf, TransHKOrderCancellation.values) ..hasRequiredFields = false ; @@ -398,6 +399,11 @@ class CancellationTransHKOrderPush extends $pb.GeneratedMessage { set orderId($core.String v) { $_setString(0, v); } $core.bool hasOrderId() => $_has(0); void clearOrderId() => clearField(1); + + TransHKOrderCancellation get type => $_getN(1); + set type(TransHKOrderCancellation v) { setField(2, v); } + $core.bool hasType() => $_has(1); + void clearType() => clearField(2); } class TransHKChatNotice extends $pb.GeneratedMessage { @@ -447,3 +453,61 @@ class TransHKChatNotice extends $pb.GeneratedMessage { void clearEmployer() => clearField(5); } +class AnotherOrderReq extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('AnotherOrderReq', package: const $pb.PackageName('yl_pb')) + ..aOS(1, 'orderId') + ..hasRequiredFields = false + ; + + AnotherOrderReq._() : super(); + factory AnotherOrderReq() => create(); + factory AnotherOrderReq.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory AnotherOrderReq.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + AnotherOrderReq clone() => AnotherOrderReq()..mergeFromMessage(this); + AnotherOrderReq copyWith(void Function(AnotherOrderReq) updates) => super.copyWith((message) => updates(message as AnotherOrderReq)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static AnotherOrderReq create() => AnotherOrderReq._(); + AnotherOrderReq createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static AnotherOrderReq getDefault() => _defaultInstance ??= create()..freeze(); + static AnotherOrderReq _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 AnotherOrderRes extends $pb.GeneratedMessage { + static final $pb.BuilderInfo _i = $pb.BuilderInfo('AnotherOrderRes', package: const $pb.PackageName('yl_pb')) + ..a<$core.int>(1, 'errorCode', $pb.PbFieldType.O3) + ..aOS(2, 'orderId') + ..hasRequiredFields = false + ; + + AnotherOrderRes._() : super(); + factory AnotherOrderRes() => create(); + factory AnotherOrderRes.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); + factory AnotherOrderRes.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + AnotherOrderRes clone() => AnotherOrderRes()..mergeFromMessage(this); + AnotherOrderRes copyWith(void Function(AnotherOrderRes) updates) => super.copyWith((message) => updates(message as AnotherOrderRes)); + $pb.BuilderInfo get info_ => _i; + @$core.pragma('dart2js:noInline') + static AnotherOrderRes create() => AnotherOrderRes._(); + AnotherOrderRes createEmptyInstance() => create(); + static $pb.PbList createRepeated() => $pb.PbList(); + static AnotherOrderRes getDefault() => _defaultInstance ??= create()..freeze(); + static AnotherOrderRes _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); +} + diff --git a/lib/proto/transhousekeeper.pbenum.dart b/lib/proto/transhousekeeper.pbenum.dart index d85159c..6c6d890 100644 --- a/lib/proto/transhousekeeper.pbenum.dart +++ b/lib/proto/transhousekeeper.pbenum.dart @@ -30,6 +30,23 @@ class TransHKOrderState extends $pb.ProtobufEnum { const TransHKOrderState._($core.int v, $core.String n) : super(v, n); } +class TransHKOrderCancellation extends $pb.ProtobufEnum { + static const TransHKOrderCancellation TimeOut = TransHKOrderCancellation._(1, 'TimeOut'); + static const TransHKOrderCancellation Rejection = TransHKOrderCancellation._(2, 'Rejection'); + static const TransHKOrderCancellation ActiveCancellation = TransHKOrderCancellation._(3, 'ActiveCancellation'); + + static const $core.List values = [ + TimeOut, + Rejection, + ActiveCancellation, + ]; + + static final $core.Map<$core.int, TransHKOrderCancellation> _byValue = $pb.ProtobufEnum.initByValue(values); + static TransHKOrderCancellation valueOf($core.int value) => _byValue[value]; + + const TransHKOrderCancellation._($core.int v, $core.String n) : super(v, n); +} + class TransHKChatNoticeType extends $pb.ProtobufEnum { static const TransHKChatNoticeType StartChat = TransHKChatNoticeType._(1, 'StartChat'); static const TransHKChatNoticeType EndChat = TransHKChatNoticeType._(2, 'EndChat'); diff --git a/lib/proto/transhousekeeper.pbjson.dart b/lib/proto/transhousekeeper.pbjson.dart index 79b45dd..8ddf34f 100644 --- a/lib/proto/transhousekeeper.pbjson.dart +++ b/lib/proto/transhousekeeper.pbjson.dart @@ -16,6 +16,15 @@ const TransHKOrderState$json = const { ], }; +const TransHKOrderCancellation$json = const { + '1': 'TransHKOrderCancellation', + '2': const [ + const {'1': 'TimeOut', '2': 1}, + const {'1': 'Rejection', '2': 2}, + const {'1': 'ActiveCancellation', '2': 3}, + ], +}; + const TransHKChatNoticeType$json = const { '1': 'TransHKChatNoticeType', '2': const [ @@ -117,6 +126,7 @@ const CancellationTransHKOrderPush$json = const { '1': 'CancellationTransHKOrderPush', '2': const [ const {'1': 'OrderId', '3': 1, '4': 1, '5': 9, '10': 'OrderId'}, + const {'1': 'Type', '3': 2, '4': 1, '5': 14, '6': '.yl_pb.TransHKOrderCancellation', '10': 'Type'}, ], }; @@ -131,3 +141,18 @@ const TransHKChatNotice$json = const { ], }; +const AnotherOrderReq$json = const { + '1': 'AnotherOrderReq', + '2': const [ + const {'1': 'OrderId', '3': 1, '4': 1, '5': 9, '10': 'OrderId'}, + ], +}; + +const AnotherOrderRes$json = const { + '1': 'AnotherOrderRes', + '2': const [ + const {'1': 'ErrorCode', '3': 1, '4': 1, '5': 5, '10': 'ErrorCode'}, + const {'1': 'OrderId', '3': 2, '4': 1, '5': 9, '10': 'OrderId'}, + ], +}; + diff --git a/lib/proto/transhousekeeper.proto b/lib/proto/transhousekeeper.proto index e763215..f79f511 100644 --- a/lib/proto/transhousekeeper.proto +++ b/lib/proto/transhousekeeper.proto @@ -13,6 +13,11 @@ enum TransHKOrderState{ Completed = 5; //已完成 } +enum TransHKOrderCancellation { + TimeOut = 1; //超时 + Rejection = 2; //绝收 + ActiveCancellation = 3; //主动取消 +} enum TransHKChatNoticeType{ StartChat = 1; //开始 EndChat = 2; //结束 @@ -65,11 +70,11 @@ message EndTransHKOrderRes{ optional string OrderId = 2; //订单号 } -//翻译官设置是否接单Msg= 9 +//Msg= 9 翻译官设置是否接单 message TransHKInterSetIsReceiptReq { optional bool IsReceipt = 1; //详见错误码文档 } -//翻译官设置是否接单Msg= 10 +//Msg= 10 翻译官设置是否接单 message TransHKInterSetIsReceiptRes { optional int32 ErrorCode = 1; //详见错误码文档 optional bool IsReceipt = 2; //详见错误码文档 @@ -88,10 +93,10 @@ message DeliveryTransHKOrderPush { //Msg= 21 订单取消推送 message CancellationTransHKOrderPush { - optional string OrderId =1; //订单号 + optional string OrderId =1; //订单号s + optional TransHKOrderCancellation Type = 2;//取消原因 } - //翻译会话通告消息 message TransHKChatNotice { optional TransHKChatNoticeType NoticeType = 1; //公告类型 @@ -99,4 +104,14 @@ message TransHKChatNotice { repeated BaseUserInfo OperateduId = 3; //被操作用户Ids 有可能是多人 optional BaseUserInfo Inter = 4; //翻译官 optional BaseUserInfo Employer = 5; //客户 -} \ No newline at end of file +} + +//Msg = 30 再来一单 +message AnotherOrderReq { + optional string OrderId =1; //上一单的订单号 +} +//Msg = 31 再来一单回应 +message AnotherOrderRes { + optional int32 ErrorCode = 1; //详见错误码文档 + optional string OrderId =2; //订单号 +} \ No newline at end of file diff --git a/lib/utils/CustomUI.dart b/lib/utils/CustomUI.dart index 5283053..a3df280 100644 --- a/lib/utils/CustomUI.dart +++ b/lib/utils/CustomUI.dart @@ -1289,4 +1289,24 @@ class CustomUI { ..layout(); return _textPainter.width; } + + + static void buildTowConfirmWithCountDown( + BuildContext context, + String tipTitle, + String confirmButtonTitle, + confirmCallback, + cancelCountDown, + {title = ''}) { + var confirm = buildConfirmBotton(confirmButtonTitle, confirmCallback); +// var cancle = buildCancleBotton(cancleButtonTitle, cancleCallback); + buildTip( + context, + title, + buildConfirmContent( + _buildContentTip(tipTitle), + Column( + children: [cancelCountDown, confirm], + ))); + } } diff --git a/lib/utils/count_down_button.dart b/lib/utils/count_down_button.dart index 33b8c58..5de0475 100644 --- a/lib/utils/count_down_button.dart +++ b/lib/utils/count_down_button.dart @@ -10,7 +10,8 @@ class CountDownButton extends StatefulWidget{ final Function onPress; final int countDownTime; final AlignmentGeometry align; - CountDownButton(this.text,this.countDownCallBack,{this.countDownTime=5*60,this.align=Alignment.center,this.onPress}); + final bool isOnlyRichText; + CountDownButton(this.text,this.countDownCallBack,{this.countDownTime=5*60,this.align=Alignment.center,this.onPress,this.isOnlyRichText=false}); @override State createState() { @@ -62,7 +63,21 @@ class CountDownButtonState extends State { // ~/ 取整操作 int seconds = secondsPassed % 60; int minutes = secondsPassed ~/ 60; - return Container( + return widget.isOnlyRichText?RichText( + maxLines: 1, + textAlign: TextAlign.center, + text: TextSpan(children: [ + TextSpan( + text: widget.text, + style: TextStyle( + color: Colors.white, + fontSize: 16)), + TextSpan( + text:' ('+ getFull(minutes)+' : '+getFull(seconds)+')', + style: TextStyle( + color: Colors.white, fontSize: 13)), + ])): + Container( alignment: widget.align, // margin: EdgeInsets.only(left: 30, right: 30, top: 20,bottom: 20), height: 48, diff --git a/lib/utils/msgHandler.dart b/lib/utils/msgHandler.dart index d821f96..d411e7b 100644 --- a/lib/utils/msgHandler.dart +++ b/lib/utils/msgHandler.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:typed_data'; +import 'package:chat/chat/ChatPage.dart'; import 'package:chat/chat/group_chat_view.dart'; import 'package:chat/data/UserData.dart'; import 'package:chat/data/chat_data_mgr.dart'; @@ -266,6 +267,8 @@ class MsgHandler { } else if (chat.channelType == ChatChannelType.TransHK) { print('聊天管家消息'); isTranslateHK = true; + }else if (chat.channelType == ChatChannelType.CSD) { + print('反馈消息'); } MsgModel msgModel; @@ -441,6 +444,11 @@ class MsgHandler { ///接到开始翻译管家消息-打开翻译管家聊天页面 if(notice.noticeType==TransHKChatNoticeType.StartChat){ + if(ChatPage.isChatPageActive){ + Navigator.of(context).pop(); + } + + Future.delayed(Duration(seconds: 1),(){ TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY; @@ -454,6 +462,9 @@ class MsgHandler { }else if(notice.noticeType==TransHKChatNoticeType.EndChat){ print('chat.contentBuff cccc'); MessageMgr().emit(MessageMgr.TRANSLATE_HK_END_CHAT, friendId.id); + + + } } else { //私聊通知消息 @@ -487,6 +498,7 @@ class MsgHandler { //print('******收到聊天消息 $time'); int sessionId = chat.targetId; print('sessionId $sessionId'); + print('chat.sendUserId ${chat.sendUserId}'); if (isGroup) { GroupInfoMgr() .getGroupInfo(sessionId) @@ -495,7 +507,24 @@ class MsgHandler { if (groupInfo != null) { showGroup = groupInfo.messageFree == 0; } - if (showGroup) { + + bool isAt = false;///@的消息无论开不开群打扰都要显示推送 + if (chat.altUserIds.length > 0) { + print('存在@消息'); + msgModel.altUsers = chat.altUserIds; + + var myId = UserData().basicInfo.userId; + + for (var i = 0; i < msgModel.altUsers.length; i++) { + if (msgModel.altUsers[i] == myId) { + isAt = true; + } + } + } + + + + if (showGroup || isAt) { int nowTime = DateTime.now().millisecondsSinceEpoch; if (nowTime - mLastClickTime < timeInterval && @@ -990,6 +1019,8 @@ class MsgHandler { handlerEndTransHKOrderRes(content); }else if(msgId==10){ handlerTransHKInterSetIsReceiptRes(content); + }else if(msgId==31){ + handlerAnotherOrderRes(content); } break; @@ -1307,6 +1338,7 @@ class MsgHandler { String errorStr=I18n.of(context).translation_butler_order_failed; switch(res.errorCode){ + case 5014: case 5014: errorStr=I18n.of(context).translation_butler_order_failed2; break; @@ -1426,6 +1458,29 @@ class MsgHandler { + //用户发送再来一单请求 + static sendAnotherOrderReq() { + debugPrint2('用户发送再来一单请求 orderId:${ TranslateHKMgr().orderId}'); + var seq = AnotherOrderReq.create(); + seq.orderId = TranslateHKMgr().orderId; + + NetWork().sendMsg(ComId.TranslateOrder, 30, seq); + } + + //用户发送再来一单请求回应 + static handlerAnotherOrderRes(List msgContent) { + debugPrint2('用户发送再来一单请求回应'); + var res = AnotherOrderRes.fromBuffer(msgContent); + if (res.errorCode == 0) { + TranslateHKMgr().orderId = res.orderId; +// GroupInfoMgr().updateMemberMsgFree(res.groupId, res.messageFree); + debugPrint2('用户发送再来一单请求回应成功: '); + } else { + debugPrint2('用户发送再来一单请求回应失败${res.errorCode}'); + } + } + + //用户主动结束翻译管家服务 static sendEndTransHKOrderReq() { diff --git a/lib/utils/wpop/w_popup_menu.dart b/lib/utils/wpop/w_popup_menu.dart index aacde4c..d4f9398 100644 --- a/lib/utils/wpop/w_popup_menu.dart +++ b/lib/utils/wpop/w_popup_menu.dart @@ -203,6 +203,11 @@ class _MenuPopWidgetState extends State<_MenuPopWidget> { (_curPageChildCount - 1 + _curArrowCount) * _separatorWidth + _curArrowWidth; +// if(widget.actions.length==1){ +// _curPageWidth =_curPageWidth-200; +// } + + return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -261,86 +266,87 @@ class _MenuPopWidgetState extends State<_MenuPopWidget> { child: Container( color: widget.backgroundColor, height: widget.menuHeight, - ), - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - // 左箭头:判断是否是第一页,如果是第一页则不显示 - _curPage == 0 - ? Container( - height: widget.menuHeight, - ) - : InkWell( - onTap: () { - setState(() { - _curPage--; - }); - }, - child: Container( - alignment: Alignment.centerRight, - width: _arrowWidth + 3, - height: widget.menuHeight - 10, - child: Image.asset( - 'assets/images/left_white.png', - fit: BoxFit.none, - ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + // 左箭头:判断是否是第一页,如果是第一页则不显示 + _curPage == 0 + ? Container( + height: widget.menuHeight, + ) + : InkWell( + onTap: () { + setState(() { + _curPage--; + }); + }, + child: Container( + alignment: Alignment.center, + width: _arrowWidth , + height: widget.menuHeight - 10, + child: Image.asset( + 'assets/images/left_white.png', + fit: BoxFit.none, ), ), - // 左箭头:判断是否是第一页,如果是第一页则不显示 - _curPage == 0 - ? Container( - height: widget.menuHeight, - ) - : Container( - width: 1, - height: widget.menuHeight, - color: Colors.grey, - ), - - // 中间是ListView - _buildList(_curPageChildCount, _curPageWidth, - _curArrowWidth, _curArrowCount), - - // 右箭头:判断是否有箭头,如果有就显示,没有就不显示 - _curArrowCount > 0 - ? Container( - width: 1, - color: Colors.grey, - height: widget.menuHeight, - ) - : Container( + ), + // 左箭头:判断是否是第一页,如果是第一页则不显示 + _curPage == 0 + ? Container( + height: widget.menuHeight, + ) + : Container( + width: 1, + height: widget.menuHeight, + color: Colors.grey, + ), + + // 中间是ListView + _buildList(_curPageChildCount, _curPageWidth, + _curArrowWidth, _curArrowCount), + + // 右箭头:判断是否有箭头,如果有就显示,没有就不显示 + _curArrowCount > 0 + ? Container( + width: 1, + color: Colors.grey, + height: widget.menuHeight, + ) + : Container( + height: widget.menuHeight, + ), + _curArrowCount > 0 + ? InkWell( + onTap: () { + if ((_curPage + 1) * + widget._pageMaxChildCount < + widget.actions.length) + setState(() { + _curPage++; + }); + }, + child: Container( + width: _arrowWidth-4, height: widget.menuHeight, - ), - _curArrowCount > 0 - ? InkWell( - onTap: () { - if ((_curPage + 1) * - widget._pageMaxChildCount < - widget.actions.length) - setState(() { - _curPage++; - }); - }, - child: Container( - width: _arrowWidth-4, - height: widget.menuHeight, - child: Image.asset( - (_curPage + 1) * - widget - ._pageMaxChildCount >= - widget.actions.length - ? 'assets/images/right_gray.png' - : 'assets/images/right_white.png', - fit: BoxFit.none, - ), + child: Image.asset( + (_curPage + 1) * + widget + ._pageMaxChildCount >= + widget.actions.length + ? 'assets/images/right_gray.png' + : 'assets/images/right_white.png', + fit: BoxFit.none, ), - ) - : Container( - height: widget.menuHeight, ), - ], + ) + : Container( + height: widget.menuHeight, + ), + ], + ), + ), ), + ], ), ), @@ -392,7 +398,7 @@ class _MenuPopWidgetState extends State<_MenuPopWidget> { // (_curPageChildCount - 1 + _curArrowCount) * // _separatorWidth) / // _curPageChildCount, - width: (text.length / (totalTxtLength) * (width)) + minPadding, + width: _curPageChildCount==1?180:(text.length / (totalTxtLength) * (width)) + minPadding, height: widget.menuHeight, child: Center( child: Text(