getDefaultOptionsWithCallback static method

List<CometChatOption>? getDefaultOptionsWithCallback({
  1. required Conversation conversation,
  2. required BuildContext context,
  3. required CometChatColorPalette colorPalette,
  4. required dynamic onDelete(
    1. Conversation
    )?,
})

Get default options for a conversation with custom delete callback

This is the new recommended way to get default conversation options. Provide a custom onDelete callback to handle deletion.

Implementation

static List<CometChatOption>? getDefaultOptionsWithCallback({
  required Conversation conversation,
  required BuildContext context,
  required CometChatColorPalette colorPalette,
  required Function(Conversation)? onDelete,
}) {
  return [
    CometChatOption(
        id: ConversationOptionConstants.delete,
        icon: AssetConstants.delete,
        packageName: UIConstants.packageName,
        backgroundColor: colorPalette.background1,
        iconTint: colorPalette.error,
        title: Translations.of(context).delete,
        onClick: () {
          if (onDelete != null) {
            onDelete(conversation);
          }
        },
    ),
  ];
}