|
|
|
@ -23,7 +23,7 @@ import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import '../../retrofit/data/im_user_list.dart'; |
|
|
|
|
import '../../retrofit/data/im_user.dart'; |
|
|
|
|
import '../../utils/flutter_utils.dart'; |
|
|
|
|
import '../../view_widget/custom_image.dart'; |
|
|
|
|
import 'on_chat_message.dart'; |
|
|
|
@ -88,7 +88,7 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
|
|
|
|
|
List<String> userIds = []; |
|
|
|
|
Map<String, Message> lastMessageMap = {}; |
|
|
|
|
Map<String, int> unreadCountMap = {}; |
|
|
|
|
Map<String, ImUserList> contactMap = {}; |
|
|
|
|
Map<String, ImUser> contactMap = {}; |
|
|
|
|
|
|
|
|
|
loadMessageList() async { |
|
|
|
|
SharedPreferences shared = await SharedPreferences.getInstance(); |
|
|
|
@ -123,7 +123,7 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
|
|
|
|
|
.toSet() |
|
|
|
|
.where((element) => element != userId) |
|
|
|
|
.toList(); |
|
|
|
|
List<ImUserList> contacts = (await hxDatabase.queryImUser(userIds)) ?? []; |
|
|
|
|
List<ImUser> contacts = (await hxDatabase.queryImUser(userIds)) ?? []; |
|
|
|
|
|
|
|
|
|
unreadCountMap = await hxDatabase.messageUnreadCount(userIds, userId); |
|
|
|
|
lastMessageMap = messages.lGroupBy((p0) => p0.toId != userId ? p0.toId : p0.fromId).mGroupItem; |
|
|
|
@ -235,7 +235,7 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
|
|
|
|
|
if (mids.isEmpty) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
BaseData<List<ImUserList>> baseData = await apiService.memberInfoByIds({ |
|
|
|
|
BaseData<List<ImUser>> baseData = await apiService.memberInfoByIds({ |
|
|
|
|
"mids": mids, |
|
|
|
|
}).catchError((error) { |
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), |
|
|
|
@ -504,22 +504,23 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
width: 16, |
|
|
|
|
height: 16, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(100), |
|
|
|
|
color: Color(0xFFFF441A), |
|
|
|
|
), |
|
|
|
|
child: RoundButton( |
|
|
|
|
text: "99", |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Color(0xFFFF441A), |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
radius: 100, |
|
|
|
|
if (unreadCountMap[userId] != null && unreadCountMap[userId] > 0) |
|
|
|
|
Container( |
|
|
|
|
width: 16, |
|
|
|
|
height: 16, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(100), |
|
|
|
|
color: Color(0xFFFF441A), |
|
|
|
|
), |
|
|
|
|
child: RoundButton( |
|
|
|
|
text: "${unreadCountMap[userId]}", |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Color(0xFFFF441A), |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
radius: 100, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|