showDeleteConfirmation method

void showDeleteConfirmation(
  1. BuildContext context,
  2. String messageId
)

Implementation

void showDeleteConfirmation(BuildContext context, String messageId) {
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return AlertDialog(
        title: const Text("Delete Message"),
        content: const Text("Are you sure you want to delete this message?"),
        actions: [
          TextButton(
            child: const Text("Cancel"),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
          TextButton(
            child: const Text("Delete"),
            onPressed: () {
              _chatRoomCollection.doc(messageId).delete();
              Navigator.of(context).pop();
            },
          ),
        ],
      );
    },
  );
}