Browse Source

Merge remote-tracking branch 'origin/wr_202303' into wr_202303

# Conflicts:
#	lib/im/im_view/im_page.dart
wr_202303
wurong 4 months ago
parent
commit
7a7fe90748
  1. 11
      lib/im/chat_details_page.dart
  2. 23
      lib/im/im_view/im_page.dart

11
lib/im/chat_details_page.dart

@ -315,7 +315,15 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
List<String> filePath = mediaPaths.map((e) => e.path).toList(); List<String> filePath = mediaPaths.map((e) => e.path).toList();
Future.forEach(filePath.toSet(), (path) async { Future.forEach(filePath.toSet(), (path) async {
String fileUrl = await qiniu.uploadFile(apiService, path); String fileUrl = await qiniu.uploadFile(apiService, path);
socketClient.sendMessage(_toUser.mid, fileUrl, attach: path, msgType: galleryMode == GalleryMode.image ? 2 : 4); socketClient.sendMessage(_toUser.mid, fileUrl, attach: path, msgType: galleryMode == GalleryMode.image ? 2 : 4).then((value) {
Message message = value;
messages.insert(0, message);
chatController.clear();
messageShowTime().then((value) {
refreshState();
jumpToBottom();
});
});
}); });
} }
@ -954,6 +962,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
} }
Future<Size> fetchImageSize(String imagePath) async { Future<Size> fetchImageSize(String imagePath) async {
debugPrint("$imagePath");
Size size = Size.zero; Size size = Size.zero;
Completer<Size> completer = Completer(); Completer<Size> completer = Completer();
Image.file( Image.file(

23
lib/im/im_view/im_page.dart

@ -17,7 +17,6 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../retrofit/data/im_user.dart'; import '../../retrofit/data/im_user.dart';
import '../../retrofit/data/page.dart';
import '../../utils/flutter_utils.dart'; import '../../utils/flutter_utils.dart';
import '../../view_widget/custom_image.dart'; import '../../view_widget/custom_image.dart';
import 'on_chat_message.dart'; import 'on_chat_message.dart';
@ -641,7 +640,7 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
(lastMessageMap[conversationId]?.content ?? "").contains(".png")?"[图片]":lastMessageMap[conversationId]?.content, messageContent(lastMessageMap[conversationId]),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -679,6 +678,26 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
); );
} }
String messageContent(Message message) {
if (message.msgType == 1) {
return message.content ?? "";
} else if (message.msgType == 2) {
return "【图片】";
} else if (message.msgType == 3) {
return "【语音】";
} else if (message.msgType == 4) {
return "【视频】";
} else if (message.msgType == 5) {
return "【红包】";
} else if (message.msgType == 6) {
return "【转账】";
} else if (message.msgType == 7) {
return "【位置】";
} else {
return "【未知的消息类型】";
}
}
Widget messageItem(img, title, messageNum) { Widget messageItem(img, title, messageNum) {
return Container( return Container(
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 16.w, right: 15.w), padding: EdgeInsets.only(top: 8.h, bottom: 8.h, left: 16.w, right: 15.w),

Loading…
Cancel
Save