From af2701f7f81d5ccc6d14b20b03d84c9e8135ea73 Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Tue, 18 Jul 2023 18:36:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9IM=E6=97=A0=E6=B3=95=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E9=A1=B5=E9=9D=A2=E5=8F=91=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/chat/TIMUIKitChat/tim_uikit_chat.dart | 13 ++++++++---- circle_app/lib/app/chat/view.dart | 21 ++++++++++++------- circle_app/lib/app/userinfo/view.dart | 8 +++---- circle_app/lib/main.dart | 5 +++-- circle_app/lib/router/app_pages.dart | 2 +- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat.dart b/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat.dart index bd47020..7755ff6 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/tim_uikit_chat.dart @@ -231,7 +231,12 @@ class _TUIChatState extends TIMUIKitState { if (kProfileMode) { Frame.destroy(); } - model.dispose(); + try { + model.dispose(); + } catch (e) { + + }; + } @override @@ -417,7 +422,7 @@ class _TUIChatState extends TIMUIKitState { child: Container( color: theme.chatBgColor, child: Align( - key: alignKey, + // key: alignKey, alignment: Alignment.topCenter, child: Listener( onPointerMove: closePanel, @@ -428,7 +433,7 @@ class _TUIChatState extends TIMUIKitState { widget.customEmojiStickerList, isUseDefaultEmoji: widget.config!.isUseDefaultEmoji, - key: listContainerKey, + // key: listContainerKey, isAllowScroll: true, userAvatarBuilder: widget.userAvatarBuilder, toolTipsConfig: widget.toolTipsConfig, @@ -468,7 +473,7 @@ class _TUIChatState extends TIMUIKitState { : (widget.textFieldBuilder != null ? widget.textFieldBuilder!(context) : TIMInputTextField( - key: inputTextFieldState, + // key: inputTextFieldState, atMemberPanelScroll: atMemberPanelScroll, groupType: diff --git a/circle_app/lib/app/chat/view.dart b/circle_app/lib/app/chat/view.dart index 3e9c648..de779d4 100644 --- a/circle_app/lib/app/chat/view.dart +++ b/circle_app/lib/app/chat/view.dart @@ -10,14 +10,20 @@ import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; import 'logic.dart'; -class ChatPage extends StatelessWidget { - final logic = Get.find(); - final state = Get.find().state; - +class ChatPage extends StatefulWidget { ChatPage({Key? key}) : super(key: key); + @override + State createState() => _ChatPageState(); +} + +class _ChatPageState extends State { + // final logic = Get.find(); + // + // final state = Get.find().state; + Widget renderCustomStickerPanel({ sendTextMessage, sendFaceMessage, @@ -62,8 +68,9 @@ class ChatPage extends StatelessWidget { @override Widget build(BuildContext context) { + V2TimConversation con = Get.arguments; return TIMChat( - conversation: logic.selectedConversation!, + conversation: Get.arguments, customStickerPanel: renderCustomStickerPanel, config: const TIMUIKitChatConfig( // 仅供演示,非全部配置项,实际使用中,可只传和默认项不同的参数,无需传入所有开关 @@ -81,10 +88,10 @@ class ChatPage extends StatelessWidget { ], ), customAppBar: MyAppBar( - centerTitle: logic.selectedConversation!.showName!, + centerTitle: con.showName!, actionWdiget: GestureDetector( onTap: () { - Get.toNamed(AppRoutes.UserInfoActivity,arguments: logic.selectedConversation!.userID.toString().split('_').last); + Get.toNamed(AppRoutes.UserInfoActivity,arguments: con.userID.toString().split('_').last); }, child: Text('TA的主页',style: TextStyle(color: Color(0xFF00FFF4),fontSize:12.sp,fontWeight: FontWeight.w500),), ), diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart index 70e74ee..daec3e6 100644 --- a/circle_app/lib/app/userinfo/view.dart +++ b/circle_app/lib/app/userinfo/view.dart @@ -145,11 +145,9 @@ class _MyTabbedScreenState extends State onTap: () { if (logic.userInfoBean != null) { - final chatLogic = Get.find(); - if (chatLogic.selectedConversation!.userID == logic.imId) { - Get.back(); - return; - } + + + pushChatPage(logic.userInfoBean!.id.toString(),logic.imId, logic.userInfoBean!.nickname); } }, diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index e5fe5e5..4ce22ca 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'dart:convert'; +import 'package:circle_app/app/chat/logic.dart'; import 'package:circle_app/app/splash/binding.dart'; import 'package:circle_app/network/api.dart'; import 'package:circle_app/network/dio_manager.dart'; @@ -40,15 +41,15 @@ logoutIM() async { //跳转发消息页面 pushChatPage(String userId,String imId,String userName) async { - await createCustomMsg(userId,imId); - var con = V2TimConversation( conversationID: "c2c_$imId", userID: imId, showName: userName, type: 1); + await createCustomMsg(userId,imId); Get.toNamed(AppRoutes.Chat,arguments: con); + } createCustomMsg(String userId,String imId) async { diff --git a/circle_app/lib/router/app_pages.dart b/circle_app/lib/router/app_pages.dart index 9026328..2773d3f 100644 --- a/circle_app/lib/router/app_pages.dart +++ b/circle_app/lib/router/app_pages.dart @@ -167,7 +167,7 @@ class AppPages { GetPage( name: AppRoutes.Chat, page: () => ChatPage(), - binding: ChatBinding(), + // binding: ChatBinding(), ), GetPage( name: AppRoutes.SelectCircleActivity,