feat: 支持自定义@成员选择页面回调 atMemberPageBuilder
This commit is contained in:
parent
e473c935cd
commit
cbb39ca2e8
|
|
@ -683,17 +683,33 @@ class _InputTextFieldState extends TIMUIKitState<TIMUIKitInputTextField> {
|
||||||
isAddingAtSearchWords = false;
|
isAddingAtSearchWords = false;
|
||||||
}
|
}
|
||||||
} else if (textLength > 0 && text[textLength - 1] == "@" && lastText.length < textLength) {
|
} else if (textLength > 0 && text[textLength - 1] == "@" && lastText.length < textLength) {
|
||||||
List<V2TimGroupMemberFullInfo>? selectedAtMemberList = await Navigator.push(
|
List<V2TimGroupMemberFullInfo>? selectedAtMemberList;
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
// 使用自定义 atMemberPageBuilder 如果提供
|
||||||
builder: (context) => AtText(
|
final atBuilder = widget.chatConfig?.atMemberPageBuilder;
|
||||||
groupMemberList: model.groupMemberList,
|
if (atBuilder != null) {
|
||||||
groupInfo: model.groupInfo,
|
selectedAtMemberList = await atBuilder(
|
||||||
groupID: groupID,
|
context,
|
||||||
canAtAll: canAtAll,
|
model.groupMemberList,
|
||||||
groupType: widget.groupType),
|
model.groupInfo,
|
||||||
),
|
groupID,
|
||||||
);
|
canAtAll,
|
||||||
|
widget.groupType,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 使用默认的 AtText 页面
|
||||||
|
selectedAtMemberList = await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => AtText(
|
||||||
|
groupMemberList: model.groupMemberList,
|
||||||
|
groupInfo: model.groupInfo,
|
||||||
|
groupID: groupID,
|
||||||
|
canAtAll: canAtAll,
|
||||||
|
groupType: widget.groupType),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (selectedAtMemberList == null) return;
|
if (selectedAtMemberList == null) return;
|
||||||
for (int i = 0; i < selectedAtMemberList.length; ++i) {
|
for (int i = 0; i < selectedAtMemberList.length; ++i) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/enum/offlinePushInfo.dart';
|
import 'package:tencent_cloud_chat_sdk/enum/offlinePushInfo.dart';
|
||||||
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_group_info.dart'
|
||||||
|
if (dart.library.html) 'package:tencent_cloud_chat_sdk/web/compatible_models/v2_tim_group_info.dart';
|
||||||
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_group_member_full_info.dart'
|
||||||
|
if (dart.library.html) 'package:tencent_cloud_chat_sdk/web/compatible_models/v2_tim_group_member_full_info.dart';
|
||||||
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart'
|
import 'package:tencent_cloud_chat_sdk/models/v2_tim_message.dart'
|
||||||
if (dart.library.html) 'package:tencent_cloud_chat_sdk/web/compatible_models/v2_tim_message.dart';
|
if (dart.library.html) 'package:tencent_cloud_chat_sdk/web/compatible_models/v2_tim_message.dart';
|
||||||
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart';
|
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_global_model.dart';
|
||||||
|
|
@ -256,6 +261,18 @@ class TIMUIKitChatConfig {
|
||||||
/// [Default]: false
|
/// [Default]: false
|
||||||
final bool isMemberCanAtAll;
|
final bool isMemberCanAtAll;
|
||||||
|
|
||||||
|
/// Builder for custom @ member selection page.
|
||||||
|
/// If provided, will use this instead of the default AtText page.
|
||||||
|
/// Return null to cancel the @ operation.
|
||||||
|
final Future<List<V2TimGroupMemberFullInfo>?> Function(
|
||||||
|
BuildContext context,
|
||||||
|
List<V2TimGroupMemberFullInfo?>? groupMemberList,
|
||||||
|
V2TimGroupInfo? groupInfo,
|
||||||
|
String? groupID,
|
||||||
|
bool canAtAll,
|
||||||
|
String? groupType,
|
||||||
|
)? atMemberPageBuilder;
|
||||||
|
|
||||||
const TIMUIKitChatConfig(
|
const TIMUIKitChatConfig(
|
||||||
{this.onTapLink,
|
{this.onTapLink,
|
||||||
this.timeDividerConfig,
|
this.timeDividerConfig,
|
||||||
|
|
@ -302,5 +319,6 @@ class TIMUIKitChatConfig {
|
||||||
this.showC2cMessageEditStatus = true,
|
this.showC2cMessageEditStatus = true,
|
||||||
this.additionalDesktopControlBarItems,
|
this.additionalDesktopControlBarItems,
|
||||||
this.isAllowLongPressAvatarToAt = true,
|
this.isAllowLongPressAvatarToAt = true,
|
||||||
this.isMemberCanAtAll = false});
|
this.isMemberCanAtAll = false,
|
||||||
|
this.atMemberPageBuilder});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue