修改IM无法重复页面发消息

This commit is contained in:
CYH 2023-07-18 18:36:06 +08:00
parent 483e78002c
commit af2701f7f8
5 changed files with 30 additions and 19 deletions

View File

@ -231,7 +231,12 @@ class _TUIChatState extends TIMUIKitState<TIMChat> {
if (kProfileMode) {
Frame.destroy();
}
try {
model.dispose();
} catch (e) {
};
}
@override
@ -417,7 +422,7 @@ class _TUIChatState extends TIMUIKitState<TIMChat> {
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<TIMChat> {
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<TIMChat> {
: (widget.textFieldBuilder != null
? widget.textFieldBuilder!(context)
: TIMInputTextField(
key: inputTextFieldState,
// key: inputTextFieldState,
atMemberPanelScroll:
atMemberPanelScroll,
groupType:

View File

@ -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<ChatLogic>();
final state = Get.find<ChatLogic>().state;
class ChatPage extends StatefulWidget {
ChatPage({Key? key})
: super(key: key);
@override
State<ChatPage> createState() => _ChatPageState();
}
class _ChatPageState extends State<ChatPage> {
// final logic = Get.find<ChatLogic>();
//
// final state = Get.find<ChatLogic>().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),),
),

View File

@ -145,11 +145,9 @@ class _MyTabbedScreenState extends State<UserinfoPage>
onTap: () {
if (logic.userInfoBean != null) {
final chatLogic = Get.find<ChatLogic>();
if (chatLogic.selectedConversation!.userID == logic.imId) {
Get.back();
return;
}
pushChatPage(logic.userInfoBean!.id.toString(),logic.imId, logic.userInfoBean!.nickname);
}
},

View File

@ -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 {

View File

@ -167,7 +167,7 @@ class AppPages {
GetPage(
name: AppRoutes.Chat,
page: () => ChatPage(),
binding: ChatBinding(),
// binding: ChatBinding(),
),
GetPage(
name: AppRoutes.SelectCircleActivity,