diff --git a/i18n/en-US.json b/i18n/en-US.json index e9339d8..430dd53 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -1240,5 +1240,6 @@ "travel_start": "起点", "travel_end": "终点", "translation_butler_order_time_out": "翻译订单超时已被取消", - "shock_notice": "震动通知" + "shock_notice": "震动通知", + "max_upload_size": "最多上传/s1张" } \ No newline at end of file diff --git a/i18n/ja-JP.json b/i18n/ja-JP.json index ffd813b..467343c 100644 --- a/i18n/ja-JP.json +++ b/i18n/ja-JP.json @@ -1239,5 +1239,6 @@ "travel_start": "起点", "travel_end": "终点", "translation_butler_order_time_out": "翻译订单超时已被取消", - "shock_notice": "震动通知" + "shock_notice": "震动通知", + "max_upload_size": "最多上传/s1张" } \ No newline at end of file diff --git a/i18n/ko-KR.json b/i18n/ko-KR.json index 6f6038c..988201f 100644 --- a/i18n/ko-KR.json +++ b/i18n/ko-KR.json @@ -1240,5 +1240,6 @@ "travel_start": "起点", "travel_end": "终点", "translation_butler_order_time_out": "翻译订单超时已被取消", - "shock_notice": "震动通知" + "shock_notice": "震动通知", + "max_upload_size": "最多上传/s1张" } \ No newline at end of file diff --git a/i18n/vi-VN.json b/i18n/vi-VN.json index 9b75b7b..74350a6 100644 --- a/i18n/vi-VN.json +++ b/i18n/vi-VN.json @@ -1239,5 +1239,6 @@ "travel_start": "起点", "travel_end": "终点", "translation_butler_order_time_out": "翻译订单超时已被取消", - "shock_notice": "震动通知" + "shock_notice": "震动通知", + "max_upload_size": "最多上传/s1张" } \ No newline at end of file diff --git a/i18n/zh-CN.json b/i18n/zh-CN.json index 1b7f4de..1d5efc0 100644 --- a/i18n/zh-CN.json +++ b/i18n/zh-CN.json @@ -1082,7 +1082,7 @@ "undefine_name": "未命名", "group_qr_code": "群二维码名片", "group_qr_code_tips": "该二维码7天内(/s1月/s2日前)有效,重新进入将更新", - "Goddess_heat": "女神热度", + "Goddess_heat": "女神热度", "Goddess_heat_tips": "累计收获的礼物", "new_friends": "新朋友", "before_three_day": "三天前", @@ -1162,7 +1162,7 @@ "confrim_recovery": "确定恢复已被焚毁的照片吗?\n(已经看过的用户可以再看一次)", "send_to": "发送到", "search_plach": "搜索位置", - "finding_place": "查找位置", + "finding_place": "查找位置", "real_time_helper": "实时帮", "translation_butler": "翻译管家", "travel_butler": "出行管家", @@ -1218,15 +1218,15 @@ "translation_more_desc": "更多描述", "file": "文件", "max_file": "文件大于/s1M", - "feedback_assistant":"反馈小助手", - "feedback_tips":"有什么问题都可以反馈给我哦", - "man_retranslate":"人工重译", - "robot_retranslate":"机器重译", - "see_original":"查看原文", - "forward":"转发", - "copy_download_url":"复制下载地址", - "total_friends_nus":"共/s1位朋友", - "hava_error_photo":"有图片违规", + "feedback_assistant": "反馈小助手", + "feedback_tips": "有什么问题都可以反馈给我哦", + "man_retranslate": "人工重译", + "robot_retranslate": "机器重译", + "see_original": "查看原文", + "forward": "转发", + "copy_download_url": "复制下载地址", + "total_friends_nus": "共/s1位朋友", + "hava_error_photo": "有图片违规", "translation_butler_evaluation_tips2": "翻译服务已结束,辛苦你了。请保持在线,留意新订单通知", "translation_butler_push_order_time": "时间:今天/s1 时长:", "translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:", @@ -1240,5 +1240,6 @@ "travel_start": "起点", "travel_end": "终点", "translation_butler_order_time_out": "翻译订单超时已被取消", - "shock_notice":"震动通知" + "shock_notice": "震动通知", + "max_upload_size": "最多上傳/s1張" } \ No newline at end of file diff --git a/i18n/zh-HK.json b/i18n/zh-HK.json index a81fbfe..b20904f 100644 --- a/i18n/zh-HK.json +++ b/i18n/zh-HK.json @@ -1239,5 +1239,6 @@ "travel_start": "起点", "travel_end": "终点", "translation_butler_order_time_out": "翻译订单超时已被取消", - "shock_notice": "震動通知" + "shock_notice": "震動通知", + "max_upload_size": "最多上传/s1张" } \ No newline at end of file diff --git a/lib/chat/group_chat_view.dart b/lib/chat/group_chat_view.dart index 6cff39d..9c9c28f 100644 --- a/lib/chat/group_chat_view.dart +++ b/lib/chat/group_chat_view.dart @@ -118,7 +118,7 @@ class _GroupChatPageState extends State { isGroup: true); msgList = ChatDataMgr().getGroupRecord(); - if (unreadNums >= 10) { + if (unreadNums >= 10 && unreadNums <= msgList.length) { unreadTime = msgList[unreadNums - 1].time; } for (int i = 0; i < msgList.length; i++) { diff --git a/lib/chat/input_bar.dart b/lib/chat/input_bar.dart index 4768e8b..bce93f5 100644 --- a/lib/chat/input_bar.dart +++ b/lib/chat/input_bar.dart @@ -33,9 +33,9 @@ import 'emoji_gif_text.dart'; import 'emoji_text.dart'; class AlterPostion { - int start; - int length; - AlterPostion(this.start, this.length); + int startIndex; + int endIndex; + AlterPostion(this.startIndex, this.endIndex); } class InputBar extends StatefulWidget { @@ -70,6 +70,7 @@ class InputBarState extends State int lastTxtLen = 0; List alterPosition = []; + String originalInputStr = ''; @override void initState() { @@ -78,7 +79,28 @@ class InputBarState extends State pageController = new PageController(); getKeyboardHeight(); _bloc.start(); - + _textCtrl.addListener(() { + if (alterPosition.length > 0) { + int offset = -1; + int currentIndex = _textCtrl.selection.baseOffset; + for (int i = 0; i < alterPosition.length; i++) { + var postion = alterPosition[i]; + if (currentIndex >= postion.startIndex && + currentIndex <= postion.endIndex) { + int middle = (postion.startIndex + postion.endIndex) ~/ 2; + offset = + currentIndex >= middle ? postion.endIndex : postion.startIndex; + break; + } + } + if (offset != -1) { + _textCtrl.value = TextEditingValue( + text: _textCtrl.text, + selection: + TextSelection.fromPosition(TextPosition(offset: offset))); + } + } + }); //处理引用事件 MessageMgr().on('Reply Select Message', replySelectMsg); @@ -133,17 +155,22 @@ class InputBarState extends State print('选中的成员~~~~~~~~~~~~ ${memberInfo.refName}'); String textStr; + String alterStr = '@${memberInfo.refName} '; if (_textCtrl.text.length > 0) { - textStr = '${_textCtrl.text} @${memberInfo.refName} '; + textStr += _textCtrl.text + alterStr; } else { - textStr = '@${memberInfo.refName} '; + textStr = alterStr; } + alterPosition.add(AlterPostion( + _textCtrl.text.length, _textCtrl.text.length + alterStr.length)); _textCtrl.value = TextEditingValue( text: textStr, selection: TextSelection.fromPosition(TextPosition(offset: textStr.length))); + originalInputStr = _textCtrl.text; + setState(() { showKeyBoard(); _isComposingMessage = _textCtrl.text.length > 0; @@ -160,6 +187,31 @@ class InputBarState extends State // SystemChannels.textInput.invokeMethod('TextInput.show'); } + quickDeleteAlterName(String str) { + var result = str; + int starIndex = 0; + if (str.length < originalInputStr.length) { + int currentIndex = _textCtrl.selection.baseOffset; + for (int i = 0; i < alterPosition.length; i++) { + var postion = alterPosition[i]; + if (currentIndex >= postion.startIndex && + currentIndex <= postion.endIndex) { + result = originalInputStr.replaceRange( + postion.startIndex, postion.endIndex, ''); + starIndex = postion.startIndex; + alterPosition.removeAt(i); + break; + } + } + } + if (str != result) { + _textCtrl.value = TextEditingValue( + text: result, + selection: + TextSelection.fromPosition(TextPosition(offset: starIndex))); + } + } + _getRefShortText() { if (refMsg == null) { return null; @@ -248,16 +300,20 @@ class InputBarState extends State // textSelectionControls: ExtendedMaterialTextSelectionControls(), keyboardAppearance: Brightness.light, onChanged: (String messageText) { + quickDeleteAlterName(messageText); if (_textCtrl.text.length > 0) { var last = messageText.substring(_textCtrl.text.length - 1); if (last == '@' && _textCtrl.text.length > lastTxtLen) { - editFocus.unfocus(); - _openAlterSelectPage(); + bool isGroup = Provider.of(context); + if (isGroup) { + editFocus.unfocus(); + _openAlterSelectPage(); + } } } lastTxtLen = _textCtrl.text.length; - + originalInputStr = _textCtrl.text; setState(() { _isComposingMessage = _textCtrl.text.length > 0; }); @@ -645,28 +701,28 @@ class InputBarState extends State } void _openAlterSelectPage() async { - bool isGroup = Provider.of(context); - - if (isGroup) { - GroupInfoModel groupInfoModel = Provider.of(context); - - editFocus.unfocus(); - Provider.of(context, listen: false) - .changeReadOnlyKey(true); - - GroupMemberModel member = - await AlterSelectPage.pickAlterUser(context, groupInfoModel); + GroupInfoModel groupInfoModel = Provider.of(context); - if (member != null) { - print('选中的成员~~~~~~~~~~~~ ${member.refName}'); - _textCtrl.text = '${_textCtrl.text}${member.refName} '; - alterMemberList.add(member); - } - - editFocus.requestFocus(); - Provider.of(context, listen: false) - .changeReadOnlyKey(false); + editFocus.unfocus(); + Provider.of(context, listen: false) + .changeReadOnlyKey(true); + + GroupMemberModel member = + await AlterSelectPage.pickAlterUser(context, groupInfoModel); + + if (member != null) { + print('选中的成员~~~~~~~~~~~~ ${member.refName}'); + alterPosition.add(AlterPostion(_textCtrl.text.length - 1, + _textCtrl.text.length + member.refName.length + 1)); + _textCtrl.text += '${member.refName} '; + originalInputStr = _textCtrl.text; + alterMemberList.add(member); } + + editFocus.requestFocus(); + _textCtrl.text; + Provider.of(context, listen: false) + .changeReadOnlyKey(false); } List getAlterUsers(String messageText) { diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index bc2fb8f..8572b5e 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -2517,6 +2517,8 @@ class I18n implements WidgetsLocalizations { String get translation_butler_order_time_out => "翻译订单超时已被取消"; /// "震动通知" String get shock_notice => "震动通知"; + /// "最多上传/s1张" + String get max_upload_size => "最多上传/s1张"; } class _I18n_en_US extends I18n { @@ -6252,6 +6254,9 @@ class _I18n_vi_VN extends I18n { /// "震动通知" @override String get shock_notice => "震动通知"; + /// "最多上传/s1张" + @override + String get max_upload_size => "最多上传/s1张"; @override TextDirection get textDirection => TextDirection.ltr; @@ -9983,6 +9988,9 @@ class _I18n_zh_HK extends I18n { /// "震動通知" @override String get shock_notice => "震動通知"; + /// "最多上传/s1张" + @override + String get max_upload_size => "最多上传/s1张"; @override TextDirection get textDirection => TextDirection.ltr; @@ -13717,6 +13725,9 @@ class _I18n_zh_CN extends _I18n_zh_HK { /// "震动通知" @override String get shock_notice => "震动通知"; + /// "最多上傳/s1張" + @override + String get max_upload_size => "最多上傳/s1張"; @override TextDirection get textDirection => TextDirection.ltr; @@ -17451,6 +17462,9 @@ class _I18n_ko_KR extends I18n { /// "震动通知" @override String get shock_notice => "震动通知"; + /// "最多上传/s1张" + @override + String get max_upload_size => "最多上传/s1张"; @override TextDirection get textDirection => TextDirection.ltr; @@ -21182,6 +21196,9 @@ class _I18n_ja_JP extends I18n { /// "震动通知" @override String get shock_notice => "震动通知"; + /// "最多上传/s1张" + @override + String get max_upload_size => "最多上传/s1张"; @override TextDirection get textDirection => TextDirection.ltr; diff --git a/lib/home/ProfilePage.dart b/lib/home/ProfilePage.dart index c5adf24..66eea87 100644 --- a/lib/home/ProfilePage.dart +++ b/lib/home/ProfilePage.dart @@ -64,6 +64,8 @@ var cardWidth; var greyColor = const Color(0xFFB2B2B2); +const MaxImgSize = 20; + class ProfilePage extends StatefulWidget { @required final userId; @@ -431,10 +433,15 @@ class _ProfilePageState extends State // } // } + int leftLength = MaxImgSize - imgList.length; + if(leftLength <=0){ + showToast(I18n.of(context).max_upload_size.replaceFirst('/s1', MaxImgSize.toString())); + return; + } List resultList = List(); resultList = await MultiImagePicker.pickImages( - maxImages: 9, + maxImages: leftLength > 9 ? 9 : leftLength, enableCamera: false, selectedAssets: [], cupertinoOptions: CupertinoOptions(takePhotoIcon: "chat"), @@ -476,6 +483,8 @@ class _ProfilePageState extends State showToast(I18n.of(context).hava_error_photo); } MessageMgr().emit('refresh_photo'); + }else{ + showToast(resData['msg']); } } @@ -1192,6 +1201,7 @@ class _ProfilePageState extends State isWatch: f['IsCheck'] == 1, userId: userInfo.userId, isBuy: f['PayStatus'] == 1, + isCheck: f['Status'] == 0, )) .toList(); var list = imgList.map((data) { @@ -1239,7 +1249,9 @@ class _ProfilePageState extends State ? I18n.of(context).his_photo : I18n.of(context).her_photo)), //+'(${I18n.of(context).visit_you.replaceFirst('/s1', userInfo.accessNum.toString())})', - description: isMyself ? I18n.of(context).upload : '', + description: isMyself + ? '${I18n.of(context).upload}(${imgList.length}/$MaxImgSize)' + : '', descriptionColor: Constants.BlueTextColor, showDivider: true, showRightIcon: false, @@ -1369,10 +1381,16 @@ class _ProfilePageState extends State showToast(I18n.of(context).no_photos); return; } + var moneyList = []; + for(int i = 0 ; i< imgList.length;i++){ + if(imgList[i]['Status'] == 1){ + moneyList.add(imgList[i]); + } + } Navigator.of(context) .push(new MaterialPageRoute(builder: (context) { return MoneyPicture( - imageList: imgList, + imageList: moneyList, ); })); }, diff --git a/lib/home/money_picture_view.dart b/lib/home/money_picture_view.dart index ab7d35e..a7672c3 100644 --- a/lib/home/money_picture_view.dart +++ b/lib/home/money_picture_view.dart @@ -21,6 +21,7 @@ class MoneyPicture extends StatefulWidget { class _MoneyPictureState extends State { int selectId = 0; + int originalMoneyId = 0; Widget _buildImg(data) { var width = (MediaQuery.of(context).size.width - 30) / 3; @@ -77,6 +78,7 @@ class _MoneyPictureState extends State { if (element['Type'] == PhotoType.money.index || element['Type'] == PhotoType.destroyMoney.index) { selectId = element['Id']; + originalMoneyId = selectId; } } } @@ -107,6 +109,10 @@ class _MoneyPictureState extends State { style: Constants.AppBarActionTextStyle), ), onTap: () async { + if (originalMoneyId == selectId) { + Navigator.of(context).pop(); + return; + } Map rdata = { "userId": UserData().basicInfo.userId, "Id": selectId, diff --git a/lib/utils/HttpUtil.dart b/lib/utils/HttpUtil.dart index f4a5a37..26e6552 100644 --- a/lib/utils/HttpUtil.dart +++ b/lib/utils/HttpUtil.dart @@ -219,7 +219,7 @@ class HttpUtil { var fileBytes; if (contentType == 'image' && size > 10240) { fileBytes = - await WidgetUtil.getCompressImg(path, quality: 80, percentage: 80); + await WidgetUtil.getCompressImg(path, quality: 20, percentage: 60); } else { fileBytes = imgfile.readAsBytesSync(); } diff --git a/lib/utils/PicSwiper.dart b/lib/utils/PicSwiper.dart index eda75e9..1e66570 100644 --- a/lib/utils/PicSwiper.dart +++ b/lib/utils/PicSwiper.dart @@ -18,6 +18,7 @@ import 'package:extended_image/extended_image.dart'; import 'dart:ui' as ui; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; +import 'package:oktoast/oktoast.dart'; import 'package:provider/provider.dart'; import 'ChargeMoney.dart'; @@ -224,6 +225,10 @@ class _PicSwiperState extends State value: isAgree, activeColor: Colors.blue, onChanged: (bool val) { + if(widget.pics[currentIndex].isCheck){ + showToast(I18n.of(context).reviewing); + return; + } HttpUtil().setPhote(context, id, isAgree ? 0 : 1, () { this.setState(() { isAgree = !isAgree; @@ -895,6 +900,7 @@ class PicSwiperItem { int type; bool isBuy; //是否购买 bool isWatch; //是否观看 + bool isCheck;//是否审核中 PicSwiperItem( this.picUrl, { this.file, @@ -904,5 +910,6 @@ class PicSwiperItem { this.isBuy = false, this.isWatch = false, this.userId, + this.isCheck = false, }); }