added delete confirmation dialog for chat messages and refined deletion logic flow
This commit is contained in:
@@ -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()),
|
||||||
|
|||||||
Reference in New Issue
Block a user