itemMoreActions method

  1. @override
List<ChatEventItemAction>? itemMoreActions(
  1. BuildContext context,
  2. String? userId,
  3. String? roomId,
  4. String? ownerId,
)
override

Implementation

@override
List<ChatEventItemAction>? itemMoreActions(
  BuildContext context,
  final String? userId,
  String? roomId,
  String? ownerId,
) {
  if (Client.getInstance.currentUserId != ownerId) return null;
  return [
    ChatEventItemAction(
      title: ChatroomLocal.bottomSheetUnmute.getString(context),
      onPressed: (context, roomId, userId, user) async {
        try {
          await ChatroomUIKitClient.instance.operatingUser(
            roomId: roomId,
            userId: userId,
            type: ChatroomUserOperationType.unmute,
          );
          // ignore: empty_catches
        } catch (e) {}
      },
    ),
    ChatEventItemAction(
      title: ChatroomLocal.bottomSheetRemove.getString(context),
      highlight: true,
      onPressed: (context, roomId, userId, user) async {
        showDialog(
          context: context,
          builder: (context) {
            return ChatDialog(
              title:
                  "${ChatroomLocal.wantRemove.getString(context)} '@${user?.nickname ?? userId}'",
              items: [
                ChatDialogItem.cancel(
                  onTap: () async {
                    Navigator.of(context).pop();
                  },
                ),
                ChatDialogItem.confirm(
                  onTap: () async {
                    Navigator.of(context).pop();
                    try {
                      await ChatroomUIKitClient.instance.roomService
                          .operatingUser(
                        roomId: roomId,
                        userId: userId,
                        type: ChatroomUserOperationType.kick,
                      );
                      // ignore: empty_catches
                    } catch (e) {}
                  },
                ),
              ],
            );
          },
        );
      },
    ),
  ];
}