getDefaultItem method
Widget
getDefaultItem(
- GroupMember member,
- CometChatGroupMembersController controller,
- CometChatTheme theme,
- BuildContext context,
Implementation
Widget getDefaultItem(
GroupMember member,
CometChatGroupMembersController controller,
CometChatTheme theme,
BuildContext context) {
Widget? subtitle;
Widget? tail;
Color? backgroundColor;
Widget? icon;
if (subtitleView != null) {
subtitle = subtitleView!(context, member);
}
if (tailView != null) {
tail = tailView!(context, member);
} else {
tail = _getTail(member, theme, controller);
}
StatusIndicatorUtils statusIndicatorUtils =
StatusIndicatorUtils.getStatusIndicatorFromParams(
isSelected: controller.selectionMap[member.uid] != null,
theme: theme,
groupMember: member,
onlineStatusIndicatorColor:
groupMemberStyle.onlineStatusColor ?? theme.palette.getSuccess(),
disableUsersPresence: disableUsersPresence,
selectIcon: selectIcon,
);
backgroundColor = statusIndicatorUtils.statusIndicatorColor;
icon = statusIndicatorUtils.icon;
return GestureDetector(
onLongPress: () {
if (activateSelection == ActivateSelection.onLongClick &&
controller.selectionMap.isEmpty &&
!(selectionMode == null || selectionMode == SelectionMode.none)) {
controller.onTap(member);
_isSelectionOn.value = true;
} else if (onItemLongPress != null) {
onItemLongPress!(member);
}
},
onTap: () {
if (activateSelection == ActivateSelection.onClick ||
(activateSelection == ActivateSelection.onLongClick &&
controller.selectionMap.isNotEmpty) &&
!(selectionMode == null ||
selectionMode == SelectionMode.none)) {
controller.onTap(member);
if (controller.selectionMap.isEmpty) {
_isSelectionOn.value = false;
} else if (activateSelection == ActivateSelection.onClick &&
controller.selectionMap.isNotEmpty &&
_isSelectionOn.value == false) {
_isSelectionOn.value = true;
}
} else if (onItemTap != null) {
onItemTap!(member);
}
},
child: CometChatListItem(
id: member.uid,
avatarName: member.name,
avatarURL: member.avatar,
title: member.name,
key: UniqueKey(),
subtitleView: subtitle,
tailView: tail,
avatarStyle: avatarStyle ?? const AvatarStyle(),
statusIndicatorColor: backgroundColor,
statusIndicatorIcon: icon,
statusIndicatorStyle:
statusIndicatorStyle ?? const StatusIndicatorStyle(),
theme: theme,
hideSeparator: hideSeparator ?? false,
options: options != null
? options!(group, member, controller, context)
: controller.defaultFunction(group, member),
style:
ListItemStyle(
background: Colors.transparent,
titleStyle: TextStyle(
fontSize: theme.typography.name.fontSize,
fontWeight: theme.typography.name.fontWeight,
fontFamily: theme.typography.name.fontFamily,
color: theme.palette.getAccent()),
).merge(listItemStyle)),
);
}