From 7f4b634f314e28a40700196c398befcb4a6483e1 Mon Sep 17 00:00:00 2001 From: CYH <13923927013@163.com> Date: Fri, 21 Jul 2023 12:03:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=81=8A=E5=A4=A9=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=96=87=E6=9C=AC=E6=A1=86=E6=8F=90=E7=A4=BA=E6=96=87?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tim_uikit_text_field.dart | 78 ++++++++++--------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart index e796d2a..49bbc4b 100644 --- a/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart +++ b/circle_app/lib/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field.dart @@ -830,43 +830,7 @@ class _InputTextFieldState extends TIMUIKitState { widget.onChanged!(text); } - if (!hintText!.contains('说些什么吧~') && text.isNotEmpty) { - if ((widget.currentConversation.lastMessage - ?.customElem ?? - null) != - null) { - if (widget.currentConversation.lastMessage - ?.customElem!.extension == - 'cardData') { - hintText = '说些什么吧~'; - setState(() { - - }); - } - } else { - var result = await TencentImSDKPlugin.v2TIMManager - .getMessageManager() - .getC2CHistoryMessageList( - userID: widget.currentConversation.userID!, - count: 1, - lastMsgID: null, - ); - - if (result.code == 0 && - (result.data?.isNotEmpty ?? false)) { - V2TimMessage msg = result.data!.last!; - - if (msg.customElem != null) { - if (msg.customElem!.extension == 'cardData') { - hintText = '说些什么吧~'; - setState(() { - - }); - } - } - } - } - } + await resetHiText(text); }, backgroundColor: widget.backgroundColor, morePanelConfig: widget.morePanelConfig, @@ -934,6 +898,46 @@ class _InputTextFieldState extends TIMUIKitState { selector: (c, model) => model.repliedMessage); } + resetHiText(String text) async { + if (!hintText!.contains('说些什么吧~') && text.isNotEmpty) { + if ((widget.currentConversation.lastMessage + ?.customElem ?? + null) != + null) { + if (widget.currentConversation.lastMessage + ?.customElem!.extension == + 'cardData') { + hintText = '说些什么吧~'; + setState(() { + + }); + } + } else { + var result = await TencentImSDKPlugin.v2TIMManager + .getMessageManager() + .getC2CHistoryMessageList( + userID: widget.currentConversation.userID!, + count: 1, + lastMsgID: null, + ); + + if (result.code == 0 && + (result.data?.isNotEmpty ?? false)) { + V2TimMessage msg = result.data!.last!; + + if (msg.customElem != null) { + if (msg.customElem!.extension == 'cardData') { + hintText = '说些什么吧~'; + setState(() { + + }); + } + } + } + } + } + } + checkHintText() async { if (hintText!.contains('说些')) { if ((widget.currentConversation.lastMessage?.customElem ?? null) !=