tencent_cloud_chat_uikit source code update to version 4.0.1
This commit is contained in:
parent
7a2d31ea71
commit
eb2dd69ac9
|
|
@ -1,6 +1,10 @@
|
||||||
|
# 4.0.1
|
||||||
|
* Upgraded the plugin tim_ui_kit_sticker_plugin to 4.0.1.
|
||||||
|
* Use the 'useTencentCloudChatStickerPackageOldKeys' parameter in StickerPanelConfig to control whether the emoticon is compatible with version 3.x.
|
||||||
|
|
||||||
# 4.0.0
|
# 4.0.0
|
||||||
## Breaking changes
|
## Breaking changes
|
||||||
* Upgraded the plugin tim_ui_kit_sticker_plugin to 4.0.0, no longer supports QQ emoji and unicode emoji.
|
* Upgraded the plugin tim_ui_kit_sticker_plugin to 4.0.0.
|
||||||
* Delete the useQQStickerPackage and unicodeEmojiList parameters in StickerPanelConfig.
|
* Delete the useQQStickerPackage and unicodeEmojiList parameters in StickerPanelConfig.
|
||||||
* Delete the isUseDefaultEmoji parameter in TIMUIKitChatConfig.
|
* Delete the isUseDefaultEmoji parameter in TIMUIKitChatConfig.
|
||||||
* Delete the isUseDefaultEmoji parameter in each widget.
|
* Delete the isUseDefaultEmoji parameter in each widget.
|
||||||
|
|
|
||||||
|
|
@ -368,9 +368,15 @@ class _TIMUIKitReplyElemState extends TIMUIKitState<TIMUIKitReplyElem> {
|
||||||
widget.message.textElem?.text ?? "",
|
widget.message.textElem?.text ?? "",
|
||||||
widget.chatModel.chatConfig.isSupportMarkdownForTextMessage,
|
widget.chatModel.chatConfig.isSupportMarkdownForTextMessage,
|
||||||
onLinkTap: widget.chatModel.chatConfig.onTapLink,
|
onLinkTap: widget.chatModel.chatConfig.onTapLink,
|
||||||
|
isUseQQPackage: widget
|
||||||
|
.chatModel.chatConfig.stickerPanelConfig?.useQQStickerPackage ??
|
||||||
|
true,
|
||||||
isUseTencentCloudChatPackage: widget.chatModel.chatConfig
|
isUseTencentCloudChatPackage: widget.chatModel.chatConfig
|
||||||
.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
|
.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
|
||||||
true,
|
true,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: widget.chatModel.chatConfig
|
||||||
|
.stickerPanelConfig?.useTencentCloudChatStickerPackageOldKeys ??
|
||||||
|
false,
|
||||||
customEmojiStickerList: widget.customEmojiStickerList,
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
isEnableTextSelection:
|
isEnableTextSelection:
|
||||||
widget.chatModel.chatConfig.isEnableTextSelection ?? false);
|
widget.chatModel.chatConfig.isEnableTextSelection ?? false);
|
||||||
|
|
@ -434,12 +440,21 @@ class _TIMUIKitReplyElemState extends TIMUIKitState<TIMUIKitReplyElem> {
|
||||||
fontSize: isDesktopScreen ? 14 : 16,
|
fontSize: isDesktopScreen ? 14 : 16,
|
||||||
height: widget.chatModel.chatConfig.textHeight),
|
height: widget.chatModel.chatConfig.textHeight),
|
||||||
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
||||||
|
isUseQQPackage: widget.chatModel.chatConfig
|
||||||
|
.stickerPanelConfig?.useQQStickerPackage ??
|
||||||
|
true,
|
||||||
isUseTencentCloudChatPackage: widget
|
isUseTencentCloudChatPackage: widget
|
||||||
.chatModel
|
.chatModel
|
||||||
.chatConfig
|
.chatConfig
|
||||||
.stickerPanelConfig
|
.stickerPanelConfig
|
||||||
?.useTencentCloudChatStickerPackage ??
|
?.useTencentCloudChatStickerPackage ??
|
||||||
true,
|
true,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: widget
|
||||||
|
.chatModel
|
||||||
|
.chatConfig
|
||||||
|
.stickerPanelConfig
|
||||||
|
?.useTencentCloudChatStickerPackageOldKeys ??
|
||||||
|
false,
|
||||||
customEmojiStickerList: widget.customEmojiStickerList,
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
showAtBackground: true,
|
showAtBackground: true,
|
||||||
)),
|
)),
|
||||||
|
|
|
||||||
|
|
@ -165,9 +165,15 @@ class _TIMUIKitTextElemState extends TIMUIKitState<TIMUIKitTextElem> {
|
||||||
widget.message.textElem?.text ?? "",
|
widget.message.textElem?.text ?? "",
|
||||||
widget.chatModel.chatConfig.isSupportMarkdownForTextMessage,
|
widget.chatModel.chatConfig.isSupportMarkdownForTextMessage,
|
||||||
onLinkTap: widget.chatModel.chatConfig.onTapLink,
|
onLinkTap: widget.chatModel.chatConfig.onTapLink,
|
||||||
|
isUseQQPackage: widget
|
||||||
|
.chatModel.chatConfig.stickerPanelConfig?.useQQStickerPackage ??
|
||||||
|
true,
|
||||||
isUseTencentCloudChatPackage: widget.chatModel.chatConfig
|
isUseTencentCloudChatPackage: widget.chatModel.chatConfig
|
||||||
.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
|
.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
|
||||||
true,
|
true,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: widget.chatModel.chatConfig
|
||||||
|
.stickerPanelConfig?.useTencentCloudChatStickerPackageOldKeys ??
|
||||||
|
false,
|
||||||
customEmojiStickerList: widget.customEmojiStickerList,
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
isEnableTextSelection:
|
isEnableTextSelection:
|
||||||
widget.chatModel.chatConfig.isEnableTextSelection ?? false);
|
widget.chatModel.chatConfig.isEnableTextSelection ?? false);
|
||||||
|
|
@ -232,12 +238,21 @@ class _TIMUIKitTextElemState extends TIMUIKitState<TIMUIKitTextElem> {
|
||||||
fontSize: isDesktopScreen ? 14 : 16,
|
fontSize: isDesktopScreen ? 14 : 16,
|
||||||
height: widget.chatModel.chatConfig.textHeight),
|
height: widget.chatModel.chatConfig.textHeight),
|
||||||
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
||||||
|
isUseQQPackage: widget.chatModel.chatConfig
|
||||||
|
.stickerPanelConfig?.useQQStickerPackage ??
|
||||||
|
true,
|
||||||
isUseTencentCloudChatPackage: widget
|
isUseTencentCloudChatPackage: widget
|
||||||
.chatModel
|
.chatModel
|
||||||
.chatConfig
|
.chatConfig
|
||||||
.stickerPanelConfig
|
.stickerPanelConfig
|
||||||
?.useTencentCloudChatStickerPackage ??
|
?.useTencentCloudChatStickerPackage ??
|
||||||
true,
|
true,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: widget
|
||||||
|
.chatModel
|
||||||
|
.chatConfig
|
||||||
|
.stickerPanelConfig
|
||||||
|
?.useTencentCloudChatStickerPackageOldKeys ??
|
||||||
|
false,
|
||||||
customEmojiStickerList: widget.customEmojiStickerList,
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
showAtBackground: true,
|
showAtBackground: true,
|
||||||
checkHttpLink: true,
|
checkHttpLink: true,
|
||||||
|
|
|
||||||
|
|
@ -122,9 +122,15 @@ class _TIMUIKitTextTranslationElemState
|
||||||
final textWithLink = LinkPreviewEntry.getHyperlinksText(translateText ?? "",
|
final textWithLink = LinkPreviewEntry.getHyperlinksText(translateText ?? "",
|
||||||
widget.chatModel.chatConfig.isSupportMarkdownForTextMessage,
|
widget.chatModel.chatConfig.isSupportMarkdownForTextMessage,
|
||||||
onLinkTap: widget.chatModel.chatConfig.onTapLink,
|
onLinkTap: widget.chatModel.chatConfig.onTapLink,
|
||||||
|
isUseQQPackage: widget
|
||||||
|
.chatModel.chatConfig.stickerPanelConfig?.useQQStickerPackage ??
|
||||||
|
true,
|
||||||
isUseTencentCloudChatPackage: widget.chatModel.chatConfig
|
isUseTencentCloudChatPackage: widget.chatModel.chatConfig
|
||||||
.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
|
.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
|
||||||
true,
|
true,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: widget.chatModel.chatConfig
|
||||||
|
.stickerPanelConfig?.useTencentCloudChatStickerPackageOldKeys ??
|
||||||
|
false,
|
||||||
customEmojiStickerList: widget.customEmojiStickerList,
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
isEnableTextSelection:
|
isEnableTextSelection:
|
||||||
widget.chatModel.chatConfig.isEnableTextSelection ?? false);
|
widget.chatModel.chatConfig.isEnableTextSelection ?? false);
|
||||||
|
|
@ -160,12 +166,21 @@ class _TIMUIKitTextTranslationElemState
|
||||||
fontSize: isDesktopScreen ? 14 : 16,
|
fontSize: isDesktopScreen ? 14 : 16,
|
||||||
height: widget.chatModel.chatConfig.textHeight),
|
height: widget.chatModel.chatConfig.textHeight),
|
||||||
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
||||||
|
isUseQQPackage: widget.chatModel.chatConfig
|
||||||
|
.stickerPanelConfig?.useQQStickerPackage ??
|
||||||
|
true,
|
||||||
isUseTencentCloudChatPackage: widget
|
isUseTencentCloudChatPackage: widget
|
||||||
.chatModel
|
.chatModel
|
||||||
.chatConfig
|
.chatConfig
|
||||||
.stickerPanelConfig
|
.stickerPanelConfig
|
||||||
?.useTencentCloudChatStickerPackage ??
|
?.useTencentCloudChatStickerPackage ??
|
||||||
true,
|
true,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: widget
|
||||||
|
.chatModel
|
||||||
|
.chatConfig
|
||||||
|
.stickerPanelConfig
|
||||||
|
?.useTencentCloudChatStickerPackageOldKeys ??
|
||||||
|
false,
|
||||||
customEmojiStickerList: widget.customEmojiStickerList,
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
showAtBackground: true,
|
showAtBackground: true,
|
||||||
)),
|
)),
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ import 'emoji_text.dart';
|
||||||
|
|
||||||
class DefaultSpecialTextSpanBuilder extends SpecialTextSpanBuilder {
|
class DefaultSpecialTextSpanBuilder extends SpecialTextSpanBuilder {
|
||||||
DefaultSpecialTextSpanBuilder({
|
DefaultSpecialTextSpanBuilder({
|
||||||
|
this.isUseQQPackage = false,
|
||||||
this.isUseTencentCloudChatPackage = false,
|
this.isUseTencentCloudChatPackage = false,
|
||||||
|
this.isUseTencentCloudChatPackageOldKeys = false,
|
||||||
this.customEmojiStickerList = const [],
|
this.customEmojiStickerList = const [],
|
||||||
this.showAtBackground = false,
|
this.showAtBackground = false,
|
||||||
this.checkHttpLink = true,
|
this.checkHttpLink = true,
|
||||||
|
|
@ -18,8 +20,12 @@ class DefaultSpecialTextSpanBuilder extends SpecialTextSpanBuilder {
|
||||||
/// whether show background for @somebody
|
/// whether show background for @somebody
|
||||||
final bool showAtBackground;
|
final bool showAtBackground;
|
||||||
|
|
||||||
|
final bool isUseQQPackage;
|
||||||
|
|
||||||
final bool isUseTencentCloudChatPackage;
|
final bool isUseTencentCloudChatPackage;
|
||||||
|
|
||||||
|
final bool isUseTencentCloudChatPackageOldKeys;
|
||||||
|
|
||||||
final bool checkHttpLink;
|
final bool checkHttpLink;
|
||||||
|
|
||||||
final List<CustomEmojiFaceData> customEmojiStickerList;
|
final List<CustomEmojiFaceData> customEmojiStickerList;
|
||||||
|
|
@ -37,6 +43,9 @@ class DefaultSpecialTextSpanBuilder extends SpecialTextSpanBuilder {
|
||||||
if (isStart(flag, EmojiText.flag)) {
|
if (isStart(flag, EmojiText.flag)) {
|
||||||
return EmojiText(textStyle,
|
return EmojiText(textStyle,
|
||||||
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
||||||
|
isUseTencentCloudChatPackageOldKeys:
|
||||||
|
isUseTencentCloudChatPackageOldKeys,
|
||||||
|
isUseQQPackage: isUseQQPackage,
|
||||||
start: index! - (EmojiText.flag.length - 1),
|
start: index! - (EmojiText.flag.length - 1),
|
||||||
customEmojiStickerList: customEmojiStickerList);
|
customEmojiStickerList: customEmojiStickerList);
|
||||||
} else if (isStart(flag, HttpText.flag) && checkHttpLink) {
|
} else if (isStart(flag, HttpText.flag) && checkHttpLink) {
|
||||||
|
|
|
||||||
|
|
@ -7,19 +7,25 @@ import 'package:tim_ui_kit_sticker_plugin/utils/tim_custom_face_data.dart';
|
||||||
class EmojiText extends SpecialText {
|
class EmojiText extends SpecialText {
|
||||||
EmojiText(TextStyle? textStyle,
|
EmojiText(TextStyle? textStyle,
|
||||||
{this.start,
|
{this.start,
|
||||||
|
this.isUseQQPackage = false,
|
||||||
this.isUseTencentCloudChatPackage = false,
|
this.isUseTencentCloudChatPackage = false,
|
||||||
|
this.isUseTencentCloudChatPackageOldKeys = false,
|
||||||
this.customEmojiStickerList = const []})
|
this.customEmojiStickerList = const []})
|
||||||
: super(EmojiText.flag, ']', textStyle);
|
: super(EmojiText.flag, ']', textStyle);
|
||||||
static const String flag = '[';
|
static const String flag = '[';
|
||||||
final int? start;
|
final int? start;
|
||||||
|
final bool isUseQQPackage;
|
||||||
final bool isUseTencentCloudChatPackage;
|
final bool isUseTencentCloudChatPackage;
|
||||||
|
final bool isUseTencentCloudChatPackageOldKeys;
|
||||||
final List<CustomEmojiFaceData> customEmojiStickerList;
|
final List<CustomEmojiFaceData> customEmojiStickerList;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
InlineSpan finishText() {
|
InlineSpan finishText() {
|
||||||
final String key = toString();
|
final String key = toString();
|
||||||
final EmojiUtil emojiUtil = EmojiUtil(
|
final EmojiUtil emojiUtil = EmojiUtil(
|
||||||
|
isUseQQPackage: isUseQQPackage,
|
||||||
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: isUseTencentCloudChatPackageOldKeys,
|
||||||
customEmojiStickerList: customEmojiStickerList);
|
customEmojiStickerList: customEmojiStickerList);
|
||||||
|
|
||||||
if (emojiUtil.emojiMap.containsKey(key)) {
|
if (emojiUtil.emojiMap.containsKey(key)) {
|
||||||
|
|
@ -30,11 +36,17 @@ class EmojiText extends SpecialText {
|
||||||
size = ts.fontSize! * 1.44;
|
size = ts.fontSize! * 1.44;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isUseTencentCloudChatPackage == true &&
|
if (isUseQQPackage == true && (emojiUtil.emojiKeyCategoryMap["4349"]?.contains(key) ?? false)) {
|
||||||
|
return ImageSpan(AssetImage(emojiUtil.emojiMap[key]!, package: "tim_ui_kit_sticker_plugin"),
|
||||||
|
actualText: key,
|
||||||
|
imageWidth: size,
|
||||||
|
imageHeight: size,
|
||||||
|
start: start!,
|
||||||
|
// fit: BoxFit.cover,
|
||||||
|
margin: const EdgeInsets.all(0));
|
||||||
|
} else if (isUseTencentCloudChatPackage == true &&
|
||||||
(emojiUtil.emojiKeyCategoryMap["tcc1"]?.contains(key) ?? false)) {
|
(emojiUtil.emojiKeyCategoryMap["tcc1"]?.contains(key) ?? false)) {
|
||||||
return ImageSpan(
|
return ImageSpan(AssetImage(emojiUtil.emojiMap[key]!, package: "tim_ui_kit_sticker_plugin"),
|
||||||
AssetImage(emojiUtil.emojiMap[key]!,
|
|
||||||
package: "tim_ui_kit_sticker_plugin"),
|
|
||||||
actualText: key,
|
actualText: key,
|
||||||
imageWidth: size,
|
imageWidth: size,
|
||||||
imageHeight: size,
|
imageHeight: size,
|
||||||
|
|
@ -59,7 +71,9 @@ class EmojiText extends SpecialText {
|
||||||
class EmojiUtil {
|
class EmojiUtil {
|
||||||
// Private constructor initializing the emoji data
|
// Private constructor initializing the emoji data
|
||||||
EmojiUtil._internal(
|
EmojiUtil._internal(
|
||||||
{required this.isUseTencentCloudChatPackage,
|
{required this.isUseQQPackage,
|
||||||
|
required this.isUseTencentCloudChatPackage,
|
||||||
|
required this.isUseTencentCloudChatPackageOldKeys,
|
||||||
required this.customEmojiStickerList}) {
|
required this.customEmojiStickerList}) {
|
||||||
_emojiMap.addAll(loadDefaultEmojis());
|
_emojiMap.addAll(loadDefaultEmojis());
|
||||||
|
|
||||||
|
|
@ -68,7 +82,9 @@ class EmojiUtil {
|
||||||
_emojiKeyCategoryMap["custom"] = customEmojis.$2;
|
_emojiKeyCategoryMap["custom"] = customEmojis.$2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final bool isUseQQPackage;
|
||||||
final bool isUseTencentCloudChatPackage;
|
final bool isUseTencentCloudChatPackage;
|
||||||
|
final bool isUseTencentCloudChatPackageOldKeys;
|
||||||
final List<CustomEmojiFaceData> customEmojiStickerList;
|
final List<CustomEmojiFaceData> customEmojiStickerList;
|
||||||
|
|
||||||
// Load the default emojis into a Map
|
// Load the default emojis into a Map
|
||||||
|
|
@ -77,12 +93,30 @@ class EmojiUtil {
|
||||||
for (final emojiGroup in TUIKitStickerConstData.emojiList) {
|
for (final emojiGroup in TUIKitStickerConstData.emojiList) {
|
||||||
final groupName = emojiGroup.name;
|
final groupName = emojiGroup.name;
|
||||||
final keyList = [];
|
final keyList = [];
|
||||||
|
if (isUseQQPackage && groupName == "4349") {
|
||||||
|
for (final emoji in emojiGroup.list) {
|
||||||
|
String emojiName = emoji.split('.png')[0];
|
||||||
|
defaultEmojiMap['[$emojiName]'] = '$_emojiFilePath/$groupName/$emojiName.png';
|
||||||
|
keyList.add('[$emojiName]');
|
||||||
|
|
||||||
|
final zhKey = TUIKitStickerConstData.emoji4349ZhMapList[emojiName];
|
||||||
|
defaultEmojiMap['[$zhKey]'] = '$_emojiFilePath/$groupName/$emojiName.png';
|
||||||
|
keyList.add('[$zhKey]');
|
||||||
|
}
|
||||||
|
_emojiKeyCategoryMap[groupName] = keyList;
|
||||||
|
}
|
||||||
|
|
||||||
if (isUseTencentCloudChatPackage && groupName == "tcc1") {
|
if (isUseTencentCloudChatPackage && groupName == "tcc1") {
|
||||||
for (final emoji in emojiGroup.list) {
|
for (final emoji in emojiGroup.list) {
|
||||||
String emojiName = emoji.split('.png')[0];
|
String emojiName = emoji.split('.png')[0];
|
||||||
defaultEmojiMap['[$emojiName]'] =
|
String compatibleEmojiName = emojiName;
|
||||||
'$_emojiFilePath/$groupName/$emojiName.png';
|
if (isUseTencentCloudChatPackageOldKeys) {
|
||||||
keyList.add('[$emojiName]');
|
// 兼容旧版本的 key 值
|
||||||
|
compatibleEmojiName = getCompatibleEmojiName(emojiName);
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultEmojiMap['[$compatibleEmojiName]'] = '$_emojiFilePath/$groupName/$emojiName.png';
|
||||||
|
keyList.add('[$compatibleEmojiName]');
|
||||||
}
|
}
|
||||||
_emojiKeyCategoryMap[groupName] = keyList;
|
_emojiKeyCategoryMap[groupName] = keyList;
|
||||||
}
|
}
|
||||||
|
|
@ -97,8 +131,7 @@ class EmojiUtil {
|
||||||
for (final customEmojiGroup in customEmojiStickerList) {
|
for (final customEmojiGroup in customEmojiStickerList) {
|
||||||
for (final customEmoji in customEmojiGroup.list) {
|
for (final customEmoji in customEmojiGroup.list) {
|
||||||
String customEmojiName = customEmoji.split('.png')[0];
|
String customEmojiName = customEmoji.split('.png')[0];
|
||||||
customEmojiMap['[$customEmojiName]'] =
|
customEmojiMap['[$customEmojiName]'] = '$_emojiFilePath/${customEmojiGroup.name}/$customEmojiName.png';
|
||||||
'$_emojiFilePath/${customEmojiGroup.name}/$customEmojiName.png';
|
|
||||||
keyList.add('[$customEmojiName]');
|
keyList.add('[$customEmojiName]');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,10 +158,29 @@ class EmojiUtil {
|
||||||
|
|
||||||
// Factory constructor to return the singleton instance of EmojiUtil with custom parameters
|
// Factory constructor to return the singleton instance of EmojiUtil with custom parameters
|
||||||
factory EmojiUtil(
|
factory EmojiUtil(
|
||||||
{bool isUseTencentCloudChatPackage = false,
|
{bool isUseQQPackage = false,
|
||||||
|
bool isUseTencentCloudChatPackage = false,
|
||||||
|
bool isUseTencentCloudChatPackageOldKeys = false,
|
||||||
List<CustomEmojiFaceData> customEmojiStickerList = const []}) {
|
List<CustomEmojiFaceData> customEmojiStickerList = const []}) {
|
||||||
return _instance ??= EmojiUtil._internal(
|
return _instance ??= EmojiUtil._internal(
|
||||||
|
isUseQQPackage: isUseQQPackage,
|
||||||
customEmojiStickerList: customEmojiStickerList,
|
customEmojiStickerList: customEmojiStickerList,
|
||||||
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage);
|
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: isUseTencentCloudChatPackageOldKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getCompatibleEmojiName(String emojiName) {
|
||||||
|
String compatibleEmojiName = emojiName;
|
||||||
|
try {
|
||||||
|
compatibleEmojiName = emojiName.split('_')[1];
|
||||||
|
// 对特殊字符串 Ok 进行处理
|
||||||
|
if (compatibleEmojiName == 'Ok') {
|
||||||
|
compatibleEmojiName = 'OK';
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return compatibleEmojiName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import 'package:tencent_cloud_chat_uikit/ui/utils/optimize_utils.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/utils/permission.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/utils/permission.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart';
|
||||||
|
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/emoji_text.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart';
|
||||||
import 'package:tencent_keyboard_visibility/tencent_keyboard_visibility.dart';
|
import 'package:tencent_keyboard_visibility/tencent_keyboard_visibility.dart';
|
||||||
|
|
||||||
|
|
@ -37,6 +38,8 @@ class TIMUIKitTextFieldLayoutNarrow extends StatefulWidget {
|
||||||
/// Whether to use the default emoji
|
/// Whether to use the default emoji
|
||||||
final bool isUseDefaultEmoji;
|
final bool isUseDefaultEmoji;
|
||||||
|
|
||||||
|
final bool isUseTencentCloudChatPackageOldKeys;
|
||||||
|
|
||||||
final TUIChatSeparateViewModel model;
|
final TUIChatSeparateViewModel model;
|
||||||
|
|
||||||
/// background color
|
/// background color
|
||||||
|
|
@ -103,6 +106,7 @@ class TIMUIKitTextFieldLayoutNarrow extends StatefulWidget {
|
||||||
required this.backSpaceText,
|
required this.backSpaceText,
|
||||||
required this.addStickerToText,
|
required this.addStickerToText,
|
||||||
required this.isUseDefaultEmoji,
|
required this.isUseDefaultEmoji,
|
||||||
|
this.isUseTencentCloudChatPackageOldKeys = false,
|
||||||
required this.languageType,
|
required this.languageType,
|
||||||
required this.textEditingController,
|
required this.textEditingController,
|
||||||
this.morePanelConfig,
|
this.morePanelConfig,
|
||||||
|
|
@ -132,12 +136,10 @@ class TIMUIKitTextFieldLayoutNarrow extends StatefulWidget {
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TIMUIKitTextFieldLayoutNarrow> createState() =>
|
State<TIMUIKitTextFieldLayoutNarrow> createState() => _TIMUIKitTextFieldLayoutNarrowState();
|
||||||
_TIMUIKitTextFieldLayoutNarrowState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TIMUIKitTextFieldLayoutNarrowState
|
class _TIMUIKitTextFieldLayoutNarrowState extends TIMUIKitState<TIMUIKitTextFieldLayoutNarrow> {
|
||||||
extends TIMUIKitState<TIMUIKitTextFieldLayoutNarrow> {
|
|
||||||
final TUISettingModel settingModel = serviceLocator<TUISettingModel>();
|
final TUISettingModel settingModel = serviceLocator<TUISettingModel>();
|
||||||
|
|
||||||
bool showMore = false;
|
bool showMore = false;
|
||||||
|
|
@ -211,13 +213,16 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
},
|
},
|
||||||
addCustomEmojiText: ((String singleEmojiName) {
|
addCustomEmojiText: ((String singleEmojiName) {
|
||||||
String? emojiName = singleEmojiName.split('.png')[0];
|
String? emojiName = singleEmojiName.split('.png')[0];
|
||||||
final newText = TIM_t('[$emojiName]');
|
String compatibleEmojiName = emojiName;
|
||||||
|
if (widget.isUseTencentCloudChatPackageOldKeys) {
|
||||||
|
compatibleEmojiName = EmojiUtil.getCompatibleEmojiName(emojiName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String newText = '[$compatibleEmojiName]';
|
||||||
widget.addStickerToText(newText);
|
widget.addStickerToText(newText);
|
||||||
setSendButton();
|
setSendButton();
|
||||||
}),
|
}),
|
||||||
defaultCustomEmojiStickerList: widget.isUseDefaultEmoji
|
defaultCustomEmojiStickerList: widget.isUseDefaultEmoji ? TUIKitStickerConstData.emojiList : [])
|
||||||
? TUIKitStickerConstData.emojiList
|
|
||||||
: [])
|
|
||||||
: StickerPanel(
|
: StickerPanel(
|
||||||
isWideScreen: false,
|
isWideScreen: false,
|
||||||
sendTextMsg: () {
|
sendTextMsg: () {
|
||||||
|
|
@ -237,7 +242,12 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
},
|
},
|
||||||
addCustomEmojiText: ((String singleEmojiName) {
|
addCustomEmojiText: ((String singleEmojiName) {
|
||||||
String? emojiName = singleEmojiName.split('.png')[0];
|
String? emojiName = singleEmojiName.split('.png')[0];
|
||||||
final newText = TIM_t('[$emojiName]');
|
String compatibleEmojiName = emojiName;
|
||||||
|
if (widget.isUseTencentCloudChatPackageOldKeys) {
|
||||||
|
compatibleEmojiName = EmojiUtil.getCompatibleEmojiName(emojiName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String newText = '[$compatibleEmojiName]';
|
||||||
widget.addStickerToText(newText);
|
widget.addStickerToText(newText);
|
||||||
setSendButton();
|
setSendButton();
|
||||||
}),
|
}),
|
||||||
|
|
@ -246,10 +256,7 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showMore) {
|
if (showMore) {
|
||||||
return MorePanel(
|
return MorePanel(morePanelConfig: widget.morePanelConfig, conversationID: widget.conversationID, conversationType: widget.conversationType);
|
||||||
morePanelConfig: widget.morePanelConfig,
|
|
||||||
conversationID: widget.conversationID,
|
|
||||||
conversationType: widget.conversationType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return const SizedBox(height: 0);
|
return const SizedBox(height: 0);
|
||||||
|
|
@ -271,8 +278,7 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
return height;
|
return height;
|
||||||
} else if (showMore || showEmojiPanel) {
|
} else if (showMore || showEmojiPanel) {
|
||||||
return 248.0 + (bottomPadding ?? 0.0);
|
return 248.0 + (bottomPadding ?? 0.0);
|
||||||
} else if (widget.textEditingController.text.length >= 46 &&
|
} else if (widget.textEditingController.text.length >= 46 && showKeyboard == false) {
|
||||||
showKeyboard == false) {
|
|
||||||
return 25 + (bottomPadding ?? 0.0);
|
return 25 + (bottomPadding ?? 0.0);
|
||||||
} else {
|
} else {
|
||||||
return bottomPadding ?? 0;
|
return bottomPadding ?? 0;
|
||||||
|
|
@ -325,20 +331,14 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
}
|
}
|
||||||
|
|
||||||
String getAbstractMessage(V2TimMessage message) {
|
String getAbstractMessage(V2TimMessage message) {
|
||||||
final String? customAbstractMessage =
|
final String? customAbstractMessage = widget.model.abstractMessageBuilder != null ? widget.model.abstractMessageBuilder!(message) : null;
|
||||||
widget.model.abstractMessageBuilder != null
|
return customAbstractMessage ?? MessageUtils.getAbstractMessageAsync(message, widget.model.groupMemberList ?? []);
|
||||||
? widget.model.abstractMessageBuilder!(message)
|
|
||||||
: null;
|
|
||||||
return customAbstractMessage ??
|
|
||||||
MessageUtils.getAbstractMessageAsync(
|
|
||||||
message, widget.model.groupMemberList ?? []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildRepliedMessage(V2TimMessage? repliedMessage) {
|
_buildRepliedMessage(V2TimMessage? repliedMessage) {
|
||||||
final haveRepliedMessage = repliedMessage != null;
|
final haveRepliedMessage = repliedMessage != null;
|
||||||
if (haveRepliedMessage) {
|
if (haveRepliedMessage) {
|
||||||
final String text =
|
final String text = "${MessageUtils.getDisplayName(repliedMessage)}:${getAbstractMessage(repliedMessage)}";
|
||||||
"${MessageUtils.getDisplayName(repliedMessage)}:${getAbstractMessage(repliedMessage)}";
|
|
||||||
return Container(
|
return Container(
|
||||||
color: widget.backgroundColor ?? hexToColor("f5f5f6"),
|
color: widget.backgroundColor ?? hexToColor("f5f5f6"),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
|
|
@ -419,8 +419,7 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
||||||
constraints: const BoxConstraints(minHeight: 50),
|
constraints: const BoxConstraints(minHeight: 50),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -444,28 +443,24 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
showSendSoundText
|
showSendSoundText ? 'images/keyboard.svg' : 'images/voice.svg',
|
||||||
? 'images/keyboard.svg'
|
|
||||||
: 'images/voice.svg',
|
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
color: const Color.fromRGBO(68, 68, 68, 1),
|
color: const Color.fromRGBO(68, 68, 68, 1),
|
||||||
height: 28,
|
height: 28,
|
||||||
width: 28,
|
width: 28,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: showSendSoundText
|
child: showSendSoundText
|
||||||
? SendSoundMessage(
|
? SendSoundMessage(onDownBottom: widget.goDownBottom, conversationID: widget.conversationID, conversationType: widget.conversationType)
|
||||||
onDownBottom: widget.goDownBottom,
|
: Stack(
|
||||||
conversationID: widget.conversationID,
|
children: [
|
||||||
conversationType: widget.conversationType)
|
Center(
|
||||||
: Stack(children: [
|
child: KeyboardVisibility(
|
||||||
Center(
|
child: ExtendedTextField(
|
||||||
child: KeyboardVisibility(
|
|
||||||
child: ExtendedTextField(
|
|
||||||
maxLines: 4,
|
maxLines: 4,
|
||||||
minLines: 1,
|
minLines: 1,
|
||||||
focusNode: widget.focusNode,
|
focusNode: widget.focusNode,
|
||||||
|
|
@ -479,24 +474,19 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
keyboardType: TextInputType.multiline,
|
keyboardType: TextInputType.multiline,
|
||||||
textInputAction:
|
textInputAction: PlatformUtils().isAndroid ? TextInputAction.newline : TextInputAction.send,
|
||||||
PlatformUtils().isAndroid
|
|
||||||
? TextInputAction.newline
|
|
||||||
: TextInputAction.send,
|
|
||||||
onEditingComplete: () {
|
onEditingComplete: () {
|
||||||
widget.onSubmitted();
|
widget.onSubmitted();
|
||||||
if (showKeyboard) {
|
if (showKeyboard) {
|
||||||
widget.focusNode.requestFocus();
|
widget.focusNode.requestFocus();
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
if (widget.textEditingController
|
if (widget.textEditingController.text.isEmpty) {
|
||||||
.text.isEmpty) {
|
|
||||||
showMoreButton = true;
|
showMoreButton = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
textAlignVertical:
|
textAlignVertical: TextAlignVertical.top,
|
||||||
TextAlignVertical.top,
|
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintStyle: const TextStyle(
|
hintStyle: const TextStyle(
|
||||||
|
|
@ -507,52 +497,42 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
filled: true,
|
filled: true,
|
||||||
isDense: true,
|
isDense: true,
|
||||||
hintText: widget.hintText ?? ''),
|
hintText: widget.hintText ?? ''),
|
||||||
controller:
|
controller: widget.textEditingController,
|
||||||
widget.textEditingController,
|
specialTextSpanBuilder: PlatformUtils().isWeb
|
||||||
specialTextSpanBuilder: PlatformUtils()
|
|
||||||
.isWeb
|
|
||||||
? null
|
? null
|
||||||
: DefaultSpecialTextSpanBuilder(
|
: DefaultSpecialTextSpanBuilder(
|
||||||
isUseTencentCloudChatPackage:
|
isUseQQPackage: widget.model.chatConfig.stickerPanelConfig?.useQQStickerPackage ?? true,
|
||||||
widget
|
isUseTencentCloudChatPackage: widget.model.chatConfig.stickerPanelConfig?.useTencentCloudChatStickerPackage ?? true,
|
||||||
.model
|
isUseTencentCloudChatPackageOldKeys: widget.model.chatConfig.stickerPanelConfig?.useTencentCloudChatStickerPackageOldKeys ?? false,
|
||||||
.chatConfig
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
.stickerPanelConfig
|
|
||||||
?.useTencentCloudChatStickerPackage ??
|
|
||||||
true,
|
|
||||||
customEmojiStickerList: widget
|
|
||||||
.customEmojiStickerList,
|
|
||||||
showAtBackground: true,
|
showAtBackground: true,
|
||||||
checkHttpLink: false,
|
checkHttpLink: false,
|
||||||
)),
|
)),
|
||||||
onChanged: (bool visibility) {
|
onChanged: (bool visibility) {
|
||||||
if (showKeyboard != visibility) {
|
if (showKeyboard != visibility) {
|
||||||
setState(() {
|
setState(() {
|
||||||
showKeyboard = visibility;
|
showKeyboard = visibility;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
),
|
||||||
|
RawKeyboardListener(
|
||||||
|
autofocus: true,
|
||||||
|
focusNode: FocusNode(),
|
||||||
|
onKey: (key) {
|
||||||
|
if (key is RawKeyDownEvent && key.logicalKey == LogicalKeyboardKey.backspace) {
|
||||||
|
if (widget.onDeleteText != null) {
|
||||||
|
widget.onDeleteText!(widget.textEditingController.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, child: Container(),
|
||||||
|
),
|
||||||
|
]
|
||||||
),
|
),
|
||||||
RawKeyboardListener(
|
),
|
||||||
autofocus: true,
|
const SizedBox(
|
||||||
focusNode: FocusNode(),
|
width: 10,
|
||||||
onKey: (key) {
|
),
|
||||||
if (key is RawKeyDownEvent &&
|
|
||||||
key.logicalKey ==
|
|
||||||
LogicalKeyboardKey.backspace) {
|
|
||||||
if (widget.onDeleteText != null) {
|
|
||||||
widget.onDeleteText!(
|
|
||||||
widget.textEditingController.text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Container(),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
if (widget.showSendEmoji)
|
if (widget.showSendEmoji)
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
@ -560,25 +540,18 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
widget.goDownBottom();
|
widget.goDownBottom();
|
||||||
},
|
},
|
||||||
child: PlatformUtils().isWeb
|
child: PlatformUtils().isWeb
|
||||||
? Icon(
|
? Icon(showEmojiPanel ? Icons.keyboard_alt_outlined : Icons.mood_outlined, color: hexToColor("5c6168"), size: 32)
|
||||||
showEmojiPanel
|
|
||||||
? Icons.keyboard_alt_outlined
|
|
||||||
: Icons.mood_outlined,
|
|
||||||
color: hexToColor("5c6168"),
|
|
||||||
size: 32)
|
|
||||||
: SvgPicture.asset(
|
: SvgPicture.asset(
|
||||||
showEmojiPanel
|
showEmojiPanel ? 'images/keyboard.svg' : 'images/face.svg',
|
||||||
? 'images/keyboard.svg'
|
|
||||||
: 'images/face.svg',
|
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
color: const Color.fromRGBO(68, 68, 68, 1),
|
color: const Color.fromRGBO(68, 68, 68, 1),
|
||||||
height: 28,
|
height: 28,
|
||||||
width: 28,
|
width: 28,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
if (widget.showMorePanel && showMoreButton)
|
if (widget.showMorePanel && showMoreButton)
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
@ -587,8 +560,7 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
widget.goDownBottom();
|
widget.goDownBottom();
|
||||||
},
|
},
|
||||||
child: PlatformUtils().isWeb
|
child: PlatformUtils().isWeb
|
||||||
? Icon(Icons.add_circle_outline_outlined,
|
? Icon(Icons.add_circle_outline_outlined, color: hexToColor("5c6168"), size: 32)
|
||||||
color: hexToColor("5c6168"), size: 32)
|
|
||||||
: SvgPicture.asset(
|
: SvgPicture.asset(
|
||||||
'images/add.svg',
|
'images/add.svg',
|
||||||
package: 'tencent_cloud_chat_uikit',
|
package: 'tencent_cloud_chat_uikit',
|
||||||
|
|
@ -597,8 +569,7 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
width: 28,
|
width: 28,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if ((isAndroidDevice() || isWebDevice()) &&
|
if ((isAndroidDevice() || isWebDevice()) && !showMoreButton)
|
||||||
!showMoreButton)
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 32.0,
|
height: 32.0,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
|
@ -620,10 +591,7 @@ class _TIMUIKitTextFieldLayoutNarrowState
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AnimatedContainer(
|
AnimatedContainer(
|
||||||
duration: Duration(
|
duration: Duration(milliseconds: (showKeyboard && PlatformUtils().isAndroid) ? 200 : 340),
|
||||||
milliseconds: (showKeyboard && PlatformUtils().isAndroid)
|
|
||||||
? 200
|
|
||||||
: 340),
|
|
||||||
curve: Curves.fastOutSlowIn,
|
curve: Curves.fastOutSlowIn,
|
||||||
height: max(_getBottomHeight(), 0.0),
|
height: max(_getBottomHeight(), 0.0),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import 'package:tencent_cloud_chat_uikit/ui/utils/optimize_utils.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/utils/screen_shot.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/utils/screen_shot.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/DefaultSpecialTextSpanBuilder.dart';
|
||||||
|
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/special_text/emoji_text.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/widgets/drag_widget.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/widgets/drag_widget.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart';
|
import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart';
|
||||||
import 'package:universal_html/html.dart' as html;
|
import 'package:universal_html/html.dart' as html;
|
||||||
|
|
@ -56,9 +57,7 @@ class DesktopControlBarItem {
|
||||||
required this.onClick,
|
required this.onClick,
|
||||||
this.showName,
|
this.showName,
|
||||||
this.size})
|
this.size})
|
||||||
: assert(icon != null ||
|
: assert(icon != null || TencentUtils.checkString(imgPath) != null || TencentUtils.checkString(svgPath) != null);
|
||||||
TencentUtils.checkString(imgPath) != null ||
|
|
||||||
TencentUtils.checkString(svgPath) != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class DesktopControlBarConfig {
|
class DesktopControlBarConfig {
|
||||||
|
|
@ -93,6 +92,8 @@ class TIMUIKitTextFieldLayoutWide extends StatefulWidget {
|
||||||
/// Whether to use the default emoji
|
/// Whether to use the default emoji
|
||||||
final bool isUseDefaultEmoji;
|
final bool isUseDefaultEmoji;
|
||||||
|
|
||||||
|
final bool isCompatibleWithTencentCloudChatPackageOldKeys;
|
||||||
|
|
||||||
final TUIChatSeparateViewModel model;
|
final TUIChatSeparateViewModel model;
|
||||||
|
|
||||||
/// background color
|
/// background color
|
||||||
|
|
@ -160,6 +161,7 @@ class TIMUIKitTextFieldLayoutWide extends StatefulWidget {
|
||||||
required this.backSpaceText,
|
required this.backSpaceText,
|
||||||
required this.addStickerToText,
|
required this.addStickerToText,
|
||||||
required this.isUseDefaultEmoji,
|
required this.isUseDefaultEmoji,
|
||||||
|
this.isCompatibleWithTencentCloudChatPackageOldKeys = false,
|
||||||
required this.languageType,
|
required this.languageType,
|
||||||
required this.textEditingController,
|
required this.textEditingController,
|
||||||
this.morePanelConfig,
|
this.morePanelConfig,
|
||||||
|
|
@ -190,12 +192,10 @@ class TIMUIKitTextFieldLayoutWide extends StatefulWidget {
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TIMUIKitTextFieldLayoutWide> createState() =>
|
State<TIMUIKitTextFieldLayoutWide> createState() => _TIMUIKitTextFieldLayoutWideState();
|
||||||
_TIMUIKitTextFieldLayoutWideState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TIMUIKitTextFieldLayoutWideState
|
class _TIMUIKitTextFieldLayoutWideState extends TIMUIKitState<TIMUIKitTextFieldLayoutWide> {
|
||||||
extends TIMUIKitState<TIMUIKitTextFieldLayoutWide> {
|
|
||||||
final TUISettingModel settingModel = serviceLocator<TUISettingModel>();
|
final TUISettingModel settingModel = serviceLocator<TUISettingModel>();
|
||||||
OverlayEntry? entry;
|
OverlayEntry? entry;
|
||||||
final ImagePicker _picker = ImagePicker();
|
final ImagePicker _picker = ImagePicker();
|
||||||
|
|
@ -269,13 +269,11 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
}
|
}
|
||||||
|
|
||||||
String getAbstractMessage(V2TimMessage message) {
|
String getAbstractMessage(V2TimMessage message) {
|
||||||
final String? customAbstractMessage =
|
final String? customAbstractMessage = widget.model.abstractMessageBuilder != null
|
||||||
widget.model.abstractMessageBuilder != null
|
? widget.model.abstractMessageBuilder!(widget.model.repliedMessage!)
|
||||||
? widget.model.abstractMessageBuilder!(widget.model.repliedMessage!)
|
: null;
|
||||||
: null;
|
|
||||||
return customAbstractMessage ??
|
return customAbstractMessage ??
|
||||||
MessageUtils.getAbstractMessageAsync(
|
MessageUtils.getAbstractMessageAsync(widget.model.repliedMessage!, widget.model.groupMemberList ?? []);
|
||||||
widget.model.repliedMessage!, widget.model.groupMemberList ?? []);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildRepliedMessage(V2TimMessage? repliedMessage) {
|
_buildRepliedMessage(V2TimMessage? repliedMessage) {
|
||||||
|
|
@ -298,10 +296,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(color: hexToColor("8f959e"), fontSize: 14, fontWeight: FontWeight.bold),
|
||||||
color: hexToColor("8f959e"),
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
@ -346,8 +341,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
},
|
},
|
||||||
initOffset: offset != null
|
initOffset: offset != null
|
||||||
? Offset(offset.dx, max(offset.dy, 16))
|
? Offset(offset.dx, max(offset.dy, 16))
|
||||||
: Offset(MediaQuery.of(context).size.height * 0.5 + 20,
|
: Offset(MediaQuery.of(context).size.height * 0.5 + 20, MediaQuery.of(context).size.height * 0.5 - 100),
|
||||||
MediaQuery.of(context).size.height * 0.5 - 100),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
|
|
@ -385,14 +379,17 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
},
|
},
|
||||||
addCustomEmojiText: ((String singleEmojiName) {
|
addCustomEmojiText: ((String singleEmojiName) {
|
||||||
String? emojiName = singleEmojiName.split('.png')[0];
|
String? emojiName = singleEmojiName.split('.png')[0];
|
||||||
final newText = TIM_t('[$emojiName]');
|
String compatibleEmojiName = emojiName;
|
||||||
|
if (widget.isCompatibleWithTencentCloudChatPackageOldKeys) {
|
||||||
|
compatibleEmojiName = EmojiUtil.getCompatibleEmojiName(emojiName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String newText = '[$compatibleEmojiName]';
|
||||||
widget.addStickerToText(newText);
|
widget.addStickerToText(newText);
|
||||||
entry?.remove();
|
entry?.remove();
|
||||||
entry = null;
|
entry = null;
|
||||||
}),
|
}),
|
||||||
defaultCustomEmojiStickerList: widget.isUseDefaultEmoji
|
defaultCustomEmojiStickerList: widget.isUseDefaultEmoji ? TUIKitStickerConstData.emojiList : [])
|
||||||
? TUIKitStickerConstData.emojiList
|
|
||||||
: [])
|
|
||||||
: Material(
|
: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: StickerPanel(
|
child: StickerPanel(
|
||||||
|
|
@ -415,9 +412,13 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
entry = null;
|
entry = null;
|
||||||
},
|
},
|
||||||
addCustomEmojiText: ((String singleEmojiName) {
|
addCustomEmojiText: ((String singleEmojiName) {
|
||||||
String? emojiName =
|
String? emojiName = singleEmojiName.split('.png')[0];
|
||||||
singleEmojiName.split('.png')[0];
|
String compatibleEmojiName = emojiName;
|
||||||
final newText = TIM_t('[$emojiName]');
|
if (widget.isCompatibleWithTencentCloudChatPackageOldKeys) {
|
||||||
|
compatibleEmojiName = EmojiUtil.getCompatibleEmojiName(emojiName);
|
||||||
|
}
|
||||||
|
|
||||||
|
String newText = '[$compatibleEmojiName]';
|
||||||
widget.addStickerToText(newText);
|
widget.addStickerToText(newText);
|
||||||
entry?.remove();
|
entry?.remove();
|
||||||
entry = null;
|
entry = null;
|
||||||
|
|
@ -468,17 +469,11 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
if (result != null && result.files.isNotEmpty) {
|
if (result != null && result.files.isNotEmpty) {
|
||||||
if (PlatformUtils().isWeb) {
|
if (PlatformUtils().isWeb) {
|
||||||
html.Node? inputElem;
|
html.Node? inputElem;
|
||||||
inputElem = html.document
|
inputElem = html.document.getElementById("__file_picker_web-file-input")?.querySelector("input");
|
||||||
.getElementById("__file_picker_web-file-input")
|
|
||||||
?.querySelector("input");
|
|
||||||
fileName = result.files.single.name;
|
fileName = result.files.single.name;
|
||||||
|
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendFileMessage(
|
model.sendFileMessage(inputElement: inputElem, fileName: fileName, convID: convID, convType: convType),
|
||||||
inputElement: inputElem,
|
|
||||||
fileName: fileName,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
} else {
|
} else {
|
||||||
File file = File(result.files.single.path!);
|
File file = File(result.files.single.path!);
|
||||||
|
|
@ -486,12 +481,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
final String savePath = file.path;
|
final String savePath = file.path;
|
||||||
|
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendFileMessage(
|
model.sendFileMessage(filePath: savePath, size: size, convID: convID, convType: convType), context);
|
||||||
filePath: savePath,
|
|
||||||
size: size,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw TypeError();
|
throw TypeError();
|
||||||
|
|
@ -502,8 +492,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> generateBarIcons(
|
List<Widget> generateBarIcons(List<DesktopControlBarItem> items, TUITheme theme) {
|
||||||
List<DesktopControlBarItem> items, TUITheme theme) {
|
|
||||||
final defaultItems = defaultControlBarItems.map((e) => e.item);
|
final defaultItems = defaultControlBarItems.map((e) => e.item);
|
||||||
return items.map((e) {
|
return items.map((e) {
|
||||||
final GlobalKey key = GlobalKey();
|
final GlobalKey key = GlobalKey();
|
||||||
|
|
@ -511,15 +500,12 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
margin: const EdgeInsets.only(right: 10),
|
margin: const EdgeInsets.only(right: 10),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final alignBox =
|
final alignBox = key.currentContext?.findRenderObject() as RenderBox?;
|
||||||
key.currentContext?.findRenderObject() as RenderBox?;
|
|
||||||
var offset = alignBox?.localToGlobal(Offset.zero);
|
var offset = alignBox?.localToGlobal(Offset.zero);
|
||||||
final double? dx = (offset?.dx != null) ? offset!.dx : null;
|
final double? dx = (offset?.dx != null) ? offset!.dx : null;
|
||||||
final double? dy =
|
final double? dy = (offset?.dy != null && alignBox?.size.height != null)
|
||||||
(offset?.dy != null && alignBox?.size.height != null)
|
? offset!.dy - (widget.chatConfig.desktopStickerPanelHeight + 20)
|
||||||
? offset!.dy -
|
: null;
|
||||||
(widget.chatConfig.desktopStickerPanelHeight + 20)
|
|
||||||
: null;
|
|
||||||
e.onClick((dx != null && dy != null) ? Offset(dx, dy) : null);
|
e.onClick((dx != null && dy != null) ? Offset(dx, dy) : null);
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
|
|
@ -533,9 +519,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
if (TencentUtils.checkString(e.svgPath) != null) {
|
if (TencentUtils.checkString(e.svgPath) != null) {
|
||||||
return SvgPicture.asset(
|
return SvgPicture.asset(
|
||||||
e.svgPath!,
|
e.svgPath!,
|
||||||
package: defaultItems.contains(e.item)
|
package: defaultItems.contains(e.item) ? 'tencent_cloud_chat_uikit' : null,
|
||||||
? 'tencent_cloud_chat_uikit'
|
|
||||||
: null,
|
|
||||||
key: key,
|
key: key,
|
||||||
width: e.size ?? 16,
|
width: e.size ?? 16,
|
||||||
height: e.size ?? 16,
|
height: e.size ?? 16,
|
||||||
|
|
@ -544,9 +528,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
if (TencentUtils.checkString(e.imgPath) != null) {
|
if (TencentUtils.checkString(e.imgPath) != null) {
|
||||||
return Image.asset(
|
return Image.asset(
|
||||||
e.imgPath!,
|
e.imgPath!,
|
||||||
package: defaultItems.contains(e.item)
|
package: defaultItems.contains(e.item) ? 'tencent_cloud_chat_uikit' : null,
|
||||||
? 'tencent_cloud_chat_uikit'
|
|
||||||
: null,
|
|
||||||
key: key,
|
key: key,
|
||||||
width: e.size ?? 16,
|
width: e.size ?? 16,
|
||||||
height: e.size ?? 16,
|
height: e.size ?? 16,
|
||||||
|
|
@ -575,17 +557,12 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
fileContent = imageContent;
|
fileContent = imageContent;
|
||||||
|
|
||||||
html.Node? inputElem;
|
html.Node? inputElem;
|
||||||
inputElem = html.document
|
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
|
||||||
.getElementById("__image_picker_web-file-input")
|
|
||||||
?.querySelector("input");
|
|
||||||
final convID = widget.conversationID;
|
final convID = widget.conversationID;
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendImageMessage(
|
model.sendImageMessage(
|
||||||
inputElement: inputElem,
|
inputElement: inputElem, imagePath: tempFile?.path, convID: convID, convType: convType),
|
||||||
imagePath: tempFile?.path,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
|
|
@ -602,25 +579,18 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
fileContent = videoContent;
|
fileContent = videoContent;
|
||||||
|
|
||||||
if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") {
|
if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(
|
||||||
type: TIMCallbackType.INFO,
|
TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频消息仅限 mp4 格式"), infoCode: 6660412));
|
||||||
infoRecommendText: TIM_t("视频消息仅限 mp4 格式"),
|
|
||||||
infoCode: 6660412));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.Node? inputElem;
|
html.Node? inputElem;
|
||||||
inputElem = html.document
|
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
|
||||||
.getElementById("__image_picker_web-file-input")
|
|
||||||
?.querySelector("input");
|
|
||||||
final convID = widget.conversationID;
|
final convID = widget.conversationID;
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendVideoMessage(
|
model.sendVideoMessage(
|
||||||
inputElement: inputElem,
|
inputElement: inputElem, videoPath: tempFile?.path, convID: convID, convType: convType),
|
||||||
videoPath: tempFile?.path,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
|
|
@ -634,10 +604,8 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
final originFile = await asset.originFile;
|
final originFile = await asset.originFile;
|
||||||
final size = await originFile!.length();
|
final size = await originFile!.length();
|
||||||
if (size >= 104857600) {
|
if (size >= 104857600) {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(
|
||||||
type: TIMCallbackType.INFO,
|
TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("发送失败,视频不能大于100MB"), infoCode: 6660405));
|
||||||
infoRecommendText: TIM_t("发送失败,视频不能大于100MB"),
|
|
||||||
infoCode: 6660405));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -646,9 +614,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
final convID = widget.conversationID;
|
final convID = widget.conversationID;
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
|
|
||||||
String tempPath = (await getTemporaryDirectory()).path +
|
String tempPath = (await getTemporaryDirectory()).path + p.extension(originFile.path, 3) + ".jpeg";
|
||||||
p.extension(originFile.path, 3) +
|
|
||||||
".jpeg";
|
|
||||||
|
|
||||||
await plugin.getVideoThumbnail(
|
await plugin.getVideoThumbnail(
|
||||||
srcFile: originFile.path,
|
srcFile: originFile.path,
|
||||||
|
|
@ -660,22 +626,14 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
);
|
);
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendVideoMessage(
|
model.sendVideoMessage(
|
||||||
videoPath: filePath,
|
videoPath: filePath, duration: duration, snapshotPath: tempPath, convID: convID, convType: convType),
|
||||||
duration: duration,
|
|
||||||
snapshotPath: tempPath,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
context);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频文件异常"), infoCode: 6660415));
|
||||||
type: TIMCallbackType.INFO,
|
|
||||||
infoRecommendText: TIM_t("视频文件异常"),
|
|
||||||
infoCode: 6660415));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendMediaMessage(
|
_sendMediaMessage(TUIChatSeparateViewModel model, TUITheme theme, FileType fileType) async {
|
||||||
TUIChatSeparateViewModel model, TUITheme theme, FileType fileType) async {
|
|
||||||
try {
|
try {
|
||||||
final convID = widget.conversationID;
|
final convID = widget.conversationID;
|
||||||
final convType = widget.conversationType;
|
final convType = widget.conversationType;
|
||||||
|
|
@ -691,11 +649,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
if (filePath != null) {
|
if (filePath != null) {
|
||||||
if (type == AssetType.image) {
|
if (type == AssetType.image) {
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendImageMessage(
|
model.sendImageMessage(imagePath: filePath, convID: convID, convType: convType), context);
|
||||||
imagePath: filePath,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType),
|
|
||||||
context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == AssetType.video) {
|
if (type == AssetType.video) {
|
||||||
|
|
@ -707,26 +661,20 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
} else {
|
} else {
|
||||||
final plugin = FcNativeVideoThumbnail();
|
final plugin = FcNativeVideoThumbnail();
|
||||||
_addGreyOverlay();
|
_addGreyOverlay();
|
||||||
FilePickerResult? result =
|
FilePickerResult? result = await FilePicker.platform.pickFiles(type: fileType);
|
||||||
await FilePicker.platform.pickFiles(type: fileType);
|
|
||||||
_removeOverlay();
|
_removeOverlay();
|
||||||
if (result != null && result.files.isNotEmpty) {
|
if (result != null && result.files.isNotEmpty) {
|
||||||
File file = File(result.files.single.path!);
|
File file = File(result.files.single.path!);
|
||||||
final String savePath = file.path;
|
final String savePath = file.path;
|
||||||
final String type = TencentUtils.getFileType(
|
final String type =
|
||||||
(savePath.split(".")[savePath.split(".").length - 1])
|
TencentUtils.getFileType((savePath.split(".")[savePath.split(".").length - 1]).toLowerCase())
|
||||||
.toLowerCase())
|
.split("/")[0];
|
||||||
.split("/")[0];
|
|
||||||
|
|
||||||
if (type == "image") {
|
if (type == "image") {
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendImageMessage(
|
model.sendImageMessage(imagePath: savePath, convID: convID, convType: convType), context);
|
||||||
imagePath: savePath, convID: convID, convType: convType),
|
|
||||||
context);
|
|
||||||
} else if (type == "video") {
|
} else if (type == "video") {
|
||||||
String tempPath = (await getTemporaryDirectory()).path +
|
String tempPath = (await getTemporaryDirectory()).path + p.basename(savePath) + ".jpeg";
|
||||||
p.basename(savePath) +
|
|
||||||
".jpeg";
|
|
||||||
await plugin.getVideoThumbnail(
|
await plugin.getVideoThumbnail(
|
||||||
srcFile: savePath,
|
srcFile: savePath,
|
||||||
destFile: tempPath,
|
destFile: tempPath,
|
||||||
|
|
@ -736,11 +684,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
height: 128,
|
height: 128,
|
||||||
);
|
);
|
||||||
MessageUtils.handleMessageError(
|
MessageUtils.handleMessageError(
|
||||||
model.sendVideoMessage(
|
model.sendVideoMessage(videoPath: savePath, convID: convID, convType: convType, snapshotPath: tempPath),
|
||||||
videoPath: savePath,
|
|
||||||
convID: convID,
|
|
||||||
convType: convType,
|
|
||||||
snapshotPath: tempPath),
|
|
||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -750,17 +694,13 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
outputLogger.i("send media err: $err");
|
outputLogger.i("send media err: $err");
|
||||||
onTIMCallback(TIMCallback(
|
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频文件异常"), infoCode: 6660415));
|
||||||
type: TIMCallbackType.INFO,
|
|
||||||
infoRecommendText: TIM_t("视频文件异常"),
|
|
||||||
infoCode: 6660415));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendImageWithConfirmation(
|
_sendImageWithConfirmation({String? fileName, Size? fileSize, required String filePath}) async {
|
||||||
{String? fileName, Size? fileSize, required String filePath}) async {
|
final option1 =
|
||||||
final option1 = widget.currentConversation.showName ??
|
widget.currentConversation.showName ?? (widget.conversationType == ConvType.group ? TIM_t("群聊") : TIM_t("对方"));
|
||||||
(widget.conversationType == ConvType.group ? TIM_t("群聊") : TIM_t("对方"));
|
|
||||||
final size = fileSize ?? await ScreenshotHelper.getImageSize(filePath);
|
final size = fileSize ?? await ScreenshotHelper.getImageSize(filePath);
|
||||||
|
|
||||||
TUIKitWidePopup.showPopupWindow(
|
TUIKitWidePopup.showPopupWindow(
|
||||||
|
|
@ -779,9 +719,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
height: min(360, size.height / 2),
|
height: min(360, size.height / 2),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
launchUrl(PlatformUtils().isWeb
|
launchUrl(PlatformUtils().isWeb ? Uri.parse(filePath) : Uri.file(filePath));
|
||||||
? Uri.parse(filePath)
|
|
||||||
: Uri.file(filePath));
|
|
||||||
},
|
},
|
||||||
child: PlatformUtils().isWeb
|
child: PlatformUtils().isWeb
|
||||||
? Image.network(
|
? Image.network(
|
||||||
|
|
@ -834,8 +772,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
}
|
}
|
||||||
|
|
||||||
generateDefaultControlBarItems() {
|
generateDefaultControlBarItems() {
|
||||||
final DesktopControlBarConfig config =
|
final DesktopControlBarConfig config = widget.chatConfig.desktopControlBarConfig ?? DesktopControlBarConfig();
|
||||||
widget.chatConfig.desktopControlBarConfig ?? DesktopControlBarConfig();
|
|
||||||
final List<DesktopControlBarItem> itemsList = [
|
final List<DesktopControlBarItem> itemsList = [
|
||||||
if (config.showStickerPanel)
|
if (config.showStickerPanel)
|
||||||
DesktopControlBarItem(
|
DesktopControlBarItem(
|
||||||
|
|
@ -900,13 +837,9 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
keyword: '',
|
keyword: '',
|
||||||
initMessageList: widget.model
|
initMessageList: widget.model
|
||||||
.getOriginMessageList()
|
.getOriginMessageList()
|
||||||
.getRange(
|
.getRange(0, min(widget.model.getOriginMessageList().length, 100))
|
||||||
0,
|
|
||||||
min(widget.model.getOriginMessageList().length,
|
|
||||||
100))
|
|
||||||
.toList(),
|
.toList(),
|
||||||
onTapConversation: (V2TimConversation conversation,
|
onTapConversation: (V2TimConversation conversation, V2TimMessage? message) {},
|
||||||
V2TimMessage? message) {},
|
|
||||||
),
|
),
|
||||||
theme: widget.theme);
|
theme: widget.theme);
|
||||||
},
|
},
|
||||||
|
|
@ -915,8 +848,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
defaultControlBarItems = itemsList;
|
defaultControlBarItems = itemsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> generateControlBar(
|
List<Widget> generateControlBar(TUIChatSeparateViewModel model, TUITheme theme) {
|
||||||
TUIChatSeparateViewModel model, TUITheme theme) {
|
|
||||||
final List<DesktopControlBarItem> itemsList = [
|
final List<DesktopControlBarItem> itemsList = [
|
||||||
...defaultControlBarItems,
|
...defaultControlBarItems,
|
||||||
...(widget.chatConfig.additionalDesktopControlBarItems ?? [])
|
...(widget.chatConfig.additionalDesktopControlBarItems ?? [])
|
||||||
|
|
@ -930,29 +862,22 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
final type = mimeType[0];
|
final type = mimeType[0];
|
||||||
final blobUrl = html.Url.createObjectUrl(file);
|
final blobUrl = html.Url.createObjectUrl(file);
|
||||||
if (type == 'image') {
|
if (type == 'image') {
|
||||||
_sendImageWithConfirmation(
|
_sendImageWithConfirmation(filePath: blobUrl, fileName: file.name, fileSize: const Size(500, 500));
|
||||||
filePath: blobUrl,
|
|
||||||
fileName: file.name,
|
|
||||||
fileSize: const Size(500, 500));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _handleKeyEvent(RawKeyEvent event) async {
|
Future<void> _handleKeyEvent(RawKeyEvent event) async {
|
||||||
if (PlatformUtils().isDesktop &&
|
if (PlatformUtils().isDesktop &&
|
||||||
((event.isKeyPressed(LogicalKeyboardKey.controlLeft) &&
|
((event.isKeyPressed(LogicalKeyboardKey.controlLeft) && event.logicalKey == LogicalKeyboardKey.keyV) ||
|
||||||
event.logicalKey == LogicalKeyboardKey.keyV) ||
|
(event.isMetaPressed && event.logicalKey == LogicalKeyboardKey.keyV))) {
|
||||||
(event.isMetaPressed &&
|
|
||||||
event.logicalKey == LogicalKeyboardKey.keyV))) {
|
|
||||||
final bytes = await Pasteboard.image;
|
final bytes = await Pasteboard.image;
|
||||||
if (bytes != null) {
|
if (bytes != null) {
|
||||||
String directory;
|
String directory;
|
||||||
if (PlatformUtils().isWindows) {
|
if (PlatformUtils().isWindows) {
|
||||||
final String documentsDirectoryPath =
|
final String documentsDirectoryPath = "${Platform.environment['USERPROFILE']}";
|
||||||
"${Platform.environment['USERPROFILE']}";
|
|
||||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
String pkgName = packageInfo.packageName;
|
String pkgName = packageInfo.packageName;
|
||||||
directory = p.join(documentsDirectoryPath, "Documents",
|
directory = p.join(documentsDirectoryPath, "Documents", ".TencentCloudChat", pkgName, "screenshots");
|
||||||
".TencentCloudChat", pkgName, "screenshots");
|
|
||||||
} else {
|
} else {
|
||||||
final dic = await getApplicationSupportDirectory();
|
final dic = await getApplicationSupportDirectory();
|
||||||
directory = dic.path;
|
directory = dic.path;
|
||||||
|
|
@ -960,8 +885,7 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
const uuid = Uuid();
|
const uuid = Uuid();
|
||||||
final fileName = 'paste_image_${uuid.v4()}.png';
|
final fileName = 'paste_image_${uuid.v4()}.png';
|
||||||
final scDirectory = Directory(directory);
|
final scDirectory = Directory(directory);
|
||||||
final filePath =
|
final filePath = '${scDirectory.path}${PlatformUtils().isWindows ? "\\" : "/"}$fileName';
|
||||||
'${scDirectory.path}${PlatformUtils().isWindows ? "\\" : "/"}$fileName';
|
|
||||||
final file = File(filePath);
|
final file = File(filePath);
|
||||||
if (!await scDirectory.exists()) {
|
if (!await scDirectory.exists()) {
|
||||||
await scDirectory.create(recursive: true);
|
await scDirectory.create(recursive: true);
|
||||||
|
|
@ -1002,67 +926,57 @@ class _TIMUIKitTextFieldLayoutWideState
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildRepliedMessage(widget.repliedMessage),
|
_buildRepliedMessage(widget.repliedMessage),
|
||||||
SizedBox(
|
SizedBox(height: 1, child: Container(color: theme.weakDividerColor ?? Colors.black12)),
|
||||||
height: 1,
|
Container(
|
||||||
child: Container(
|
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
||||||
color: theme.weakDividerColor ?? Colors.black12)),
|
child: Row(
|
||||||
Container(
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
padding:
|
children: generateControlBar(widget.model, theme),
|
||||||
const EdgeInsets.symmetric(vertical: 4, horizontal: 12),
|
),
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: generateControlBar(widget.model, theme),
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
|
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
|
||||||
constraints: const BoxConstraints(minHeight: 50),
|
constraints: const BoxConstraints(minHeight: 50),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ExtendedTextField(
|
child: ExtendedTextField(
|
||||||
scrollController: _scrollController,
|
scrollController: _scrollController,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
maxLines:
|
maxLines: widget.chatConfig.desktopMessageInputFieldLines,
|
||||||
widget.chatConfig.desktopMessageInputFieldLines,
|
minLines: widget.chatConfig.desktopMessageInputFieldLines,
|
||||||
minLines:
|
focusNode: widget.focusNode,
|
||||||
widget.chatConfig.desktopMessageInputFieldLines,
|
onChanged: debounceFunc,
|
||||||
focusNode: widget.focusNode,
|
keyboardType: TextInputType.multiline,
|
||||||
onChanged: debounceFunc,
|
onEditingComplete: () {
|
||||||
keyboardType: TextInputType.multiline,
|
// // widget.onSubmitted();
|
||||||
onEditingComplete: () {
|
},
|
||||||
// // widget.onSubmitted();
|
textAlignVertical: TextAlignVertical.top,
|
||||||
},
|
style: const TextStyle(fontSize: 14),
|
||||||
textAlignVertical: TextAlignVertical.top,
|
decoration: InputDecoration(
|
||||||
style: const TextStyle(fontSize: 14),
|
hoverColor: Colors.transparent,
|
||||||
decoration: InputDecoration(
|
border: InputBorder.none,
|
||||||
hoverColor: Colors.transparent,
|
hintStyle: const TextStyle(
|
||||||
border: InputBorder.none,
|
color: Color(0xffAEA4A3),
|
||||||
hintStyle: const TextStyle(
|
),
|
||||||
color: Color(0xffAEA4A3),
|
fillColor: widget.backgroundColor ??
|
||||||
|
theme.desktopChatMessageInputBgColor ??
|
||||||
|
hexToColor("fafafa"),
|
||||||
|
filled: true,
|
||||||
|
isDense: true,
|
||||||
|
hintText: widget.hintText ?? '',
|
||||||
),
|
),
|
||||||
fillColor: widget.backgroundColor ??
|
controller: widget.textEditingController,
|
||||||
theme.desktopChatMessageInputBgColor ??
|
specialTextSpanBuilder: PlatformUtils().isWeb
|
||||||
hexToColor("fafafa"),
|
? null
|
||||||
filled: true,
|
: DefaultSpecialTextSpanBuilder(
|
||||||
isDense: true,
|
isUseTencentCloudChatPackage:
|
||||||
hintText: widget.hintText ?? '',
|
widget.model.chatConfig.stickerPanelConfig?.useTencentCloudChatStickerPackage ??
|
||||||
),
|
true,
|
||||||
controller: widget.textEditingController,
|
customEmojiStickerList: widget.customEmojiStickerList,
|
||||||
specialTextSpanBuilder: PlatformUtils().isWeb
|
showAtBackground: true,
|
||||||
? null
|
)),
|
||||||
: DefaultSpecialTextSpanBuilder(
|
),
|
||||||
isUseTencentCloudChatPackage: widget
|
|
||||||
.model
|
|
||||||
.chatConfig
|
|
||||||
.stickerPanelConfig
|
|
||||||
?.useTencentCloudChatStickerPackage ??
|
|
||||||
true,
|
|
||||||
customEmojiStickerList:
|
|
||||||
widget.customEmojiStickerList,
|
|
||||||
showAtBackground: true,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,34 @@ class TimeDividerConfig {
|
||||||
|
|
||||||
/// StickerPanelConfig is a configuration class for the sticker panel component.
|
/// StickerPanelConfig is a configuration class for the sticker panel component.
|
||||||
/// It allows customization of specific features such as display options for the
|
/// It allows customization of specific features such as display options for the
|
||||||
/// message area, sticker packages, and custom sticker packages.
|
/// message area, sticker packages, unicode emoji lists, and custom sticker packages.
|
||||||
class StickerPanelConfig {
|
class StickerPanelConfig {
|
||||||
|
/// Determines whether to use the QQ Sticker Package.
|
||||||
|
/// Default value: true
|
||||||
|
final bool useQQStickerPackage;
|
||||||
|
|
||||||
/// Determines whether to use the Tencent Cloud Chat Sticker Package.
|
/// Determines whether to use the Tencent Cloud Chat Sticker Package.
|
||||||
/// Default value: true
|
/// Default value: true
|
||||||
final bool useTencentCloudChatStickerPackage;
|
final bool useTencentCloudChatStickerPackage;
|
||||||
|
|
||||||
|
/// Determines whether to compatible with the Tencent Cloud Chat Sticker Package 3.x version.
|
||||||
|
/// Default value : false
|
||||||
|
final bool useTencentCloudChatStickerPackageOldKeys;
|
||||||
|
|
||||||
|
/// A list of unicode emoji, represented as integers.
|
||||||
|
/// Default value: a list of common Unicode Emojis.
|
||||||
|
/// To exclude Unicode Emoji from the display, pass an empty list.
|
||||||
|
final List<int> unicodeEmojiList;
|
||||||
|
|
||||||
/// A list of CustomStickerPackage instances, where each instance represents a sticker package.
|
/// A list of CustomStickerPackage instances, where each instance represents a sticker package.
|
||||||
/// Default value: an empty list.
|
/// Default value: an empty list.
|
||||||
final List<CustomStickerPackage> customStickerPackages;
|
final List<CustomStickerPackage> customStickerPackages;
|
||||||
|
|
||||||
StickerPanelConfig({
|
StickerPanelConfig({
|
||||||
|
this.useQQStickerPackage = true,
|
||||||
this.useTencentCloudChatStickerPackage = true,
|
this.useTencentCloudChatStickerPackage = true,
|
||||||
|
this.useTencentCloudChatStickerPackageOldKeys = false,
|
||||||
|
this.unicodeEmojiList = TUIKitStickerConstData.defaultUnicodeEmojiList,
|
||||||
this.customStickerPackages = const [],
|
this.customStickerPackages = const [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,17 +95,11 @@ class _TIMUIKitLastMsgState extends TIMUIKitState<TIMUIKitLastMsg> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String originalText =
|
String msgShowText =
|
||||||
await _getLastMsgShowText(widget.lastMsg, widget.context) ?? "";
|
await _getLastMsgShowText(widget.lastMsg, widget.context) ?? "";
|
||||||
String replaceText = TUIKitStickerConstData.emojiZhNameMap.keys
|
|
||||||
.fold(originalText, (previousValue, key) {
|
|
||||||
return previousValue.replaceAll(
|
|
||||||
key, TIM_t(TUIKitStickerConstData.emojiZhNameMap[key]!));
|
|
||||||
});
|
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
groupTipsAbstractText = replaceText;
|
groupTipsAbstractText = msgShowText;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -228,31 +222,37 @@ class _TIMUIKitLastMsgState extends TIMUIKitState<TIMUIKitLastMsg> {
|
||||||
color: theme.weakTextColor, fontSize: widget.fontSize)),
|
color: theme.weakTextColor, fontSize: widget.fontSize)),
|
||||||
if (widget.draftText != null && widget.draftText != "")
|
if (widget.draftText != null && widget.draftText != "")
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ExtendedText(
|
child: ExtendedText(groupTipsAbstractText,
|
||||||
groupTipsAbstractText,
|
softWrap: true,
|
||||||
softWrap: true,
|
maxLines: 1,
|
||||||
maxLines: 1,
|
overflow: TextOverflow.ellipsis,
|
||||||
overflow: TextOverflow.ellipsis,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
height: 1,
|
||||||
height: 1,
|
color: theme.weakTextColor,
|
||||||
color: theme.weakTextColor,
|
fontSize: widget.fontSize),
|
||||||
fontSize: widget.fontSize),
|
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
||||||
),
|
isUseQQPackage: true,
|
||||||
|
isUseTencentCloudChatPackage: true,
|
||||||
|
showAtBackground: true,
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
if (widget.draftText == null ||
|
if (widget.draftText == null ||
|
||||||
widget.draftText == "" &&
|
widget.draftText == "" &&
|
||||||
TencentUtils.checkString(groupTipsAbstractText) != null)
|
TencentUtils.checkString(groupTipsAbstractText) != null)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ExtendedText(
|
child: ExtendedText(groupTipsAbstractText,
|
||||||
groupTipsAbstractText,
|
softWrap: true,
|
||||||
softWrap: true,
|
maxLines: 1,
|
||||||
maxLines: 1,
|
overflow: TextOverflow.ellipsis,
|
||||||
overflow: TextOverflow.ellipsis,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
height: 1,
|
||||||
height: 1,
|
color: theme.weakTextColor,
|
||||||
color: theme.weakTextColor,
|
fontSize: widget.fontSize),
|
||||||
fontSize: widget.fontSize),
|
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
||||||
),
|
isUseQQPackage: true,
|
||||||
|
isUseTencentCloudChatPackage: true,
|
||||||
|
showAtBackground: true,
|
||||||
|
)),
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,17 @@ import 'package:tim_ui_kit_sticker_plugin/utils/tim_custom_face_data.dart';
|
||||||
|
|
||||||
RegExp emojiExp = RegExp(r'\[([\u4e00-\u9fa5A-Za-z0-9]+)\]');
|
RegExp emojiExp = RegExp(r'\[([\u4e00-\u9fa5A-Za-z0-9]+)\]');
|
||||||
|
|
||||||
String mdTextCompiler(
|
String mdTextCompiler(String originalText, {
|
||||||
String originalText, {
|
bool isUseQQPackage = false,
|
||||||
bool isUseTencentCloudChatPackage = false,
|
bool isUseTencentCloudChatPackage = false,
|
||||||
|
bool isUseTencentCloudChatPackageOldKeys = false,
|
||||||
List<CustomEmojiFaceData> customEmojiStickerList = const [],
|
List<CustomEmojiFaceData> customEmojiStickerList = const [],
|
||||||
}) {
|
}) {
|
||||||
String text = originalText;
|
String text = originalText;
|
||||||
final EmojiUtil emojiUtil = EmojiUtil(
|
final EmojiUtil emojiUtil = EmojiUtil(
|
||||||
|
isUseQQPackage: isUseQQPackage,
|
||||||
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
||||||
|
isUseTencentCloudChatPackageOldKeys: isUseTencentCloudChatPackageOldKeys,
|
||||||
customEmojiStickerList: customEmojiStickerList);
|
customEmojiStickerList: customEmojiStickerList);
|
||||||
|
|
||||||
text = text.replaceAllMapped(emojiExp, (match) {
|
text = text.replaceAllMapped(emojiExp, (match) {
|
||||||
|
|
@ -25,4 +28,4 @@ String mdTextCompiler(
|
||||||
});
|
});
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
@ -12,12 +12,17 @@ class LinkPreviewEntry {
|
||||||
static LinkPreviewText? getHyperlinksText(String messageText, bool isMarkdown,
|
static LinkPreviewText? getHyperlinksText(String messageText, bool isMarkdown,
|
||||||
{Function(String)? onLinkTap,
|
{Function(String)? onLinkTap,
|
||||||
bool isEnableTextSelection = false,
|
bool isEnableTextSelection = false,
|
||||||
|
bool isUseQQPackage = false,
|
||||||
bool isUseTencentCloudChatPackage = false,
|
bool isUseTencentCloudChatPackage = false,
|
||||||
|
bool isUseTencentCloudChatPackageOldKeys = false,
|
||||||
List<CustomEmojiFaceData> customEmojiStickerList = const []}) {
|
List<CustomEmojiFaceData> customEmojiStickerList = const []}) {
|
||||||
return ({TextStyle? style}) {
|
return ({TextStyle? style}) {
|
||||||
return isMarkdown
|
return isMarkdown
|
||||||
? LinkTextMarkdown(
|
? LinkTextMarkdown(
|
||||||
|
isUseQQPackage: isUseQQPackage,
|
||||||
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
||||||
|
isUseTencentCloudChatPackageOldKeys:
|
||||||
|
isUseTencentCloudChatPackageOldKeys,
|
||||||
customEmojiStickerList: customEmojiStickerList,
|
customEmojiStickerList: customEmojiStickerList,
|
||||||
isEnableTextSelection: isEnableTextSelection,
|
isEnableTextSelection: isEnableTextSelection,
|
||||||
messageText: addSpaceAfterLeftBracket(
|
messageText: addSpaceAfterLeftBracket(
|
||||||
|
|
@ -29,7 +34,10 @@ class LinkPreviewEntry {
|
||||||
messageText: messageText,
|
messageText: messageText,
|
||||||
style: style,
|
style: style,
|
||||||
onLinkTap: onLinkTap,
|
onLinkTap: onLinkTap,
|
||||||
|
isUseQQPackage: isUseQQPackage,
|
||||||
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
||||||
|
isUseTencentCloudChatPackageOldKeys:
|
||||||
|
isUseTencentCloudChatPackageOldKeys,
|
||||||
customEmojiStickerList: customEmojiStickerList);
|
customEmojiStickerList: customEmojiStickerList);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,20 @@ class LinkTextMarkdown extends TIMStatelessWidget {
|
||||||
|
|
||||||
final bool? isEnableTextSelection;
|
final bool? isEnableTextSelection;
|
||||||
|
|
||||||
|
final bool isUseQQPackage;
|
||||||
|
|
||||||
final bool isUseTencentCloudChatPackage;
|
final bool isUseTencentCloudChatPackage;
|
||||||
|
|
||||||
|
final bool isUseTencentCloudChatPackageOldKeys;
|
||||||
|
|
||||||
final List<CustomEmojiFaceData> customEmojiStickerList;
|
final List<CustomEmojiFaceData> customEmojiStickerList;
|
||||||
|
|
||||||
const LinkTextMarkdown(
|
const LinkTextMarkdown(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
required this.messageText,
|
required this.messageText,
|
||||||
|
this.isUseQQPackage = false,
|
||||||
this.isUseTencentCloudChatPackage = false,
|
this.isUseTencentCloudChatPackage = false,
|
||||||
|
this.isUseTencentCloudChatPackageOldKeys = false,
|
||||||
this.customEmojiStickerList = const [],
|
this.customEmojiStickerList = const [],
|
||||||
this.isEnableTextSelection,
|
this.isEnableTextSelection,
|
||||||
this.onLinkTap,
|
this.onLinkTap,
|
||||||
|
|
@ -81,8 +87,12 @@ class LinkText extends TIMStatelessWidget {
|
||||||
/// text style for default words
|
/// text style for default words
|
||||||
final TextStyle? style;
|
final TextStyle? style;
|
||||||
|
|
||||||
|
final bool isUseQQPackage;
|
||||||
|
|
||||||
final bool isUseTencentCloudChatPackage;
|
final bool isUseTencentCloudChatPackage;
|
||||||
|
|
||||||
|
final bool isUseTencentCloudChatPackageOldKeys;
|
||||||
|
|
||||||
final List<CustomEmojiFaceData> customEmojiStickerList;
|
final List<CustomEmojiFaceData> customEmojiStickerList;
|
||||||
|
|
||||||
final bool? isEnableTextSelection;
|
final bool? isEnableTextSelection;
|
||||||
|
|
@ -93,7 +103,9 @@ class LinkText extends TIMStatelessWidget {
|
||||||
this.onLinkTap,
|
this.onLinkTap,
|
||||||
this.isEnableTextSelection,
|
this.isEnableTextSelection,
|
||||||
this.style,
|
this.style,
|
||||||
|
this.isUseQQPackage = false,
|
||||||
this.isUseTencentCloudChatPackage = false,
|
this.isUseTencentCloudChatPackage = false,
|
||||||
|
this.isUseTencentCloudChatPackageOldKeys = false,
|
||||||
this.customEmojiStickerList = const []})
|
this.customEmojiStickerList = const []})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
|
|
@ -165,7 +177,10 @@ class LinkText extends TIMStatelessWidget {
|
||||||
},
|
},
|
||||||
style: style ?? const TextStyle(fontSize: 16.0),
|
style: style ?? const TextStyle(fontSize: 16.0),
|
||||||
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
specialTextSpanBuilder: DefaultSpecialTextSpanBuilder(
|
||||||
|
isUseQQPackage: isUseQQPackage,
|
||||||
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
isUseTencentCloudChatPackage: isUseTencentCloudChatPackage,
|
||||||
|
isUseTencentCloudChatPackageOldKeys:
|
||||||
|
isUseTencentCloudChatPackageOldKeys,
|
||||||
customEmojiStickerList: customEmojiStickerList,
|
customEmojiStickerList: customEmojiStickerList,
|
||||||
showAtBackground: true,
|
showAtBackground: true,
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
name: tencent_cloud_chat_uikit
|
name: tencent_cloud_chat_uikit
|
||||||
description: A powerful chat UI component library and business logic for Tencent Cloud Chat, creating seamless in-app chat modules for delightful user experiences.
|
description: A powerful chat UI component library and business logic for Tencent Cloud Chat, creating seamless in-app chat modules for delightful user experiences.
|
||||||
version: 4.0.0
|
version: 4.0.1
|
||||||
homepage: https://trtc.io/products/chat?utm_source=gfs&utm_medium=link&utm_campaign=%E6%B8%A0%E9%81%93&_channel_track_key=k6WgfCKn
|
homepage: https://trtc.io/products/chat?utm_source=gfs&utm_medium=link&utm_campaign=%E6%B8%A0%E9%81%93&_channel_track_key=k6WgfCKn
|
||||||
repository: https://github.com/TencentCloud/chat-uikit-flutter
|
repository: https://github.com/TencentCloud/chat-uikit-flutter
|
||||||
documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html
|
documentation: https://comm.qq.com/im/doc/flutter/en/TUIKit/readme.html
|
||||||
|
|
@ -61,7 +61,7 @@ dependencies:
|
||||||
uuid: ^3.0.6
|
uuid: ^3.0.6
|
||||||
open_file: ^3.3.2
|
open_file: ^3.3.2
|
||||||
tencent_keyboard_visibility: ^1.0.1
|
tencent_keyboard_visibility: ^1.0.1
|
||||||
tim_ui_kit_sticker_plugin: ^3.2.0
|
tim_ui_kit_sticker_plugin: ^4.0.1
|
||||||
tencent_im_base: ^8.0.0
|
tencent_im_base: ^8.0.0
|
||||||
fc_native_video_thumbnail: ^0.16.0
|
fc_native_video_thumbnail: ^0.16.0
|
||||||
path: ^1.8.1
|
path: ^1.8.1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue