修改聊天页面文本框提示文本

This commit is contained in:
CYH 2023-07-21 12:03:04 +08:00
parent c6389adc2f
commit 7f4b634f31

View File

@ -830,43 +830,7 @@ class _InputTextFieldState extends TIMUIKitState<TIMInputTextField> {
widget.onChanged!(text); widget.onChanged!(text);
} }
if (!hintText!.contains('说些什么吧~') && text.isNotEmpty) { await resetHiText(text);
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(() {
});
}
}
}
}
}
}, },
backgroundColor: widget.backgroundColor, backgroundColor: widget.backgroundColor,
morePanelConfig: widget.morePanelConfig, morePanelConfig: widget.morePanelConfig,
@ -934,6 +898,46 @@ class _InputTextFieldState extends TIMUIKitState<TIMInputTextField> {
selector: (c, model) => model.repliedMessage); 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 { checkHintText() async {
if (hintText!.contains('说些')) { if (hintText!.contains('说些')) {
if ((widget.currentConversation.lastMessage?.customElem ?? null) != if ((widget.currentConversation.lastMessage?.customElem ?? null) !=