showDeleteConfirmation method
Implementation
void showDeleteConfirmation(BuildContext context, String messageId) {
DocumentReference roomRef = _firestore.collection('ChatRooms').doc(
mergeStrings(senderMember?.userId ?? "", receiverMember?.userId ?? ""));
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: () {
roomRef.collection('Messages').doc(messageId).delete();
Navigator.of(context).pop();
},
),
],
);
},
);
}