diff --git a/lib/chat/ChatPage.dart b/lib/chat/ChatPage.dart index 3b8210c..b22a8d7 100644 --- a/lib/chat/ChatPage.dart +++ b/lib/chat/ChatPage.dart @@ -36,7 +36,6 @@ import 'package:dio/dio.dart'; import 'package:extended_text/extended_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:oktoast/oktoast.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; diff --git a/lib/chat/ChatPageItem.dart b/lib/chat/ChatPageItem.dart index d02e3da..07656d9 100644 --- a/lib/chat/ChatPageItem.dart +++ b/lib/chat/ChatPageItem.dart @@ -17,7 +17,6 @@ import 'package:chat/data/constants.dart'; import 'package:chat/generated/i18n.dart'; import 'package:chat/models/ChatMsg.dart'; import 'package:chat/models/UserInfo.dart'; -import 'package:chat/models/group_info_model.dart'; import 'package:chat/models/keyboard_provider.dart'; import 'package:chat/models/ref_name_provider.dart'; import 'package:chat/proto/chat.pbenum.dart'; diff --git a/lib/chat/group_chat_view.dart b/lib/chat/group_chat_view.dart index 6cff39d..7b0434e 100644 --- a/lib/chat/group_chat_view.dart +++ b/lib/chat/group_chat_view.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'dart:io'; import 'package:chat/chat/group_chat_item.dart'; -import 'package:chat/data/UserData.dart'; import 'package:chat/data/chat_data_mgr.dart'; import 'package:chat/data/constants.dart'; import 'package:chat/data/group_data_mgr.dart'; @@ -19,12 +18,10 @@ import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/analyze_utils.dart'; import 'package:chat/utils/msgHandler.dart'; import 'package:chat/utils/net_state_widget.dart'; -import 'package:chat/utils/screen.dart'; import 'package:chat/utils/sound_util.dart'; import 'package:chat/utils/sp_utils.dart'; import 'package:chat/utils/sql_util.dart'; import 'package:chat/utils/upload_util.dart'; -import 'package:chat/utils/white_opacity_anim.dart'; import 'package:extended_text/extended_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -396,91 +393,6 @@ class _GroupChatPageState extends State { ))); } - //更新各个子元素的偏移位置 - _updateMsgItemOffset() { - if (msgList.length == 0) { - return; - } - - var myId = UserData().basicInfo.userId; - double offset = 0; - for (var i = 0; i < msgList.length; i++) { - MsgModel msg = msgList[i]; - - double itemHeight = 70; - switch (ChatType.valueOf(msg.msgType)) { - case ChatType.TextChatType: - //if (msg.from == myId) { - var text = utf8.decode(msg.msgContent); - itemHeight = 21 + _getTextHeight(text); - //} else {} - break; - case ChatType.ShortVoiceChatType: - if (msg.from == myId) { - itemHeight = 22.5 + 24; - } else {} - break; - case ChatType.ImageChatType: - itemHeight = _getImgHeight(msg); - break; - case ChatType.ShortVideoChatType: - itemHeight = _getImgHeight(msg); - break; - case ChatType.EmoticonType: - itemHeight = 40; - break; - case ChatType.RedWalletChatType: - print('红包消息'); - itemHeight = 70; - break; - case ChatType.PlaceChatType: - itemHeight = 100 + 40.0; - break; - case ChatType.GroupChatNoticeType: - itemHeight = 40; - break; - case ChatType.GiftChatType: - itemHeight = 40; - break; - case ChatType.FileChatType: - itemHeight = 80; - break; - default: - } - - itemOffsetMap[i] = offset; - offset += itemHeight; - } - } - - double _getTextHeight(String text) { - var tp = TextPainter( - text: TextSpan(style: TextStyle(fontSize: 15), text: text), - textAlign: TextAlign.left, - textDirection: TextDirection.ltr, - textScaleFactor: 1, - ); - - tp.layout(maxWidth: Screen.width - 140); - - return tp.height; - } - - double _getImgHeight(MsgModel msg) { - double aspectRatio = msg.extraInfo / 100; - - var maxWidth = Screen.width * 0.65; - var maxHeight = Screen.height / 4; - - double height; - if (maxWidth / maxHeight > aspectRatio) { - height = maxHeight; - } else { - height = maxWidth / aspectRatio; - } - - return height; - } Widget _buildMessageList() { return Container( diff --git a/lib/home/realtimehelper/real_time_helper_page.dart b/lib/home/realtimehelper/real_time_helper_page.dart index 792f17c..993c710 100644 --- a/lib/home/realtimehelper/real_time_helper_page.dart +++ b/lib/home/realtimehelper/real_time_helper_page.dart @@ -3,12 +3,9 @@ import 'package:chat/home/realtimehelper/translation_butler_page.dart'; import 'package:chat/home/realtimehelper/travel_butler_page.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/msgHandler.dart'; import 'package:chat/utils/screen.dart'; -import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:oktoast/oktoast.dart'; diff --git a/lib/home/realtimehelper/translation_order_push_dialog.dart b/lib/home/realtimehelper/translation_order_push_dialog.dart index cd7d3a1..28dcf01 100644 --- a/lib/home/realtimehelper/translation_order_push_dialog.dart +++ b/lib/home/realtimehelper/translation_order_push_dialog.dart @@ -2,8 +2,6 @@ import 'package:chat/data/UserData.dart'; import 'package:chat/data/constants.dart'; import 'package:chat/data/translate_hk_data_mgr.dart'; import 'package:chat/generated/i18n.dart'; -import 'package:chat/r.dart'; -import 'package:chat/utils/HttpUtil.dart'; import 'package:chat/utils/MessageMgr.dart'; import 'package:chat/utils/count_down_button.dart'; import 'package:chat/utils/msgHandler.dart'; diff --git a/lib/utils/CustomUI.dart b/lib/utils/CustomUI.dart index 13bebaa..5283053 100644 --- a/lib/utils/CustomUI.dart +++ b/lib/utils/CustomUI.dart @@ -13,7 +13,6 @@ 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'; @@ -31,7 +30,6 @@ import 'PicSwiper.dart'; import 'TutorialOverlay.dart'; import 'app_navigator.dart'; import 'conversation_table.dart'; -import 'count_down_button.dart'; class NoKeyboardEditableTextFocusNode extends FocusNode { // @override