Browse Source

chat add conversation ,database query change userId to conversationId

wr_202303
zsw 4 months ago
parent
commit
a4206f9b9d
  1. 16
      lib/im/chat_details_page.dart

16
lib/im/chat_details_page.dart

@ -67,7 +67,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
int copyIndex = 0; int copyIndex = 0;
String selfUserId = ""; String selfUserId = "";
ImUser _toUser; ImUser _toUser;
String conversation ; String conversation;
@override @override
void onMessage(txt) { void onMessage(txt) {
@ -124,7 +124,8 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
Future messageShowTime() async { Future messageShowTime() async {
List<Message> messagePages = await hxDatabase.queryTList(conversation); List<Message> messagePages = await hxDatabase.queryTList(conversation);
for (var value in messages) { for (var value in messages) {
Message message = messagePages.firstWhere((element) => value.id == element.id, orElse: () => null); Message message = messagePages
.firstWhere((element) => value.id == element.id, orElse: () => null);
value.showTime = message != null; value.showTime = message != null;
} }
} }
@ -142,8 +143,10 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
} }
} }
if (apiService == null) if (apiService == null)
apiService = ApiService(Dio(), context: context, token: value.getString("token")); apiService =
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {}); ApiService(Dio(), context: context, token: value.getString("token"));
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
userInfo = baseData.data; userInfo = baseData.data;
@ -1147,7 +1150,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
), ),
content: Container( content: Container(
width: 160.w, width: 160.w,
height:50.h, height: 50.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF2A2A2A), color: Color(0xFF2A2A2A),
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
@ -1215,8 +1218,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
) )
], ],
), ),
) ));
);
}); });
} }

Loading…
Cancel
Save