added delete confirmation dialog for chat messages and refined deletion logic flow

This commit is contained in:
2026-05-09 22:32:45 +02:00
parent 79a6d9a594
commit 9accb488f2
@@ -140,12 +140,22 @@ void showChatMessageOptionsDialog(
}, },
), ),
if (canDelete) if (canDelete)
AsyncListTile( ListTile(
leading: const Icon(Icons.delete_outline), leading: const Icon(Icons.delete_outline),
title: const Text('Nachricht löschen'), title: const Text('Nachricht löschen'),
onPressed: () async { onTap: () {
await DeleteMessage(chatData.token, bubbleData.id).run(); ConfirmDialog(
if (sheetCtx.mounted) sheetCtx.read<ChatBloc>().refresh(); title: 'Nachricht löschen?',
content: 'Die Nachricht wird für alle Teilnehmer gelöscht.',
confirmButton: 'Löschen',
onConfirmAsync: () async {
await DeleteMessage(chatData.token, bubbleData.id).run();
if (!sheetCtx.mounted) return;
final bloc = sheetCtx.read<ChatBloc>();
Navigator.of(sheetCtx).pop();
bloc.refresh();
},
).asDialog(sheetCtx);
}, },
), ),
DebugTile(sheetCtx).jsonData(bubbleData.toJson()), DebugTile(sheetCtx).jsonData(bubbleData.toJson()),