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)
|
||||
AsyncListTile(
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete_outline),
|
||||
title: const Text('Nachricht löschen'),
|
||||
onPressed: () async {
|
||||
onTap: () {
|
||||
ConfirmDialog(
|
||||
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) sheetCtx.read<ChatBloc>().refresh();
|
||||
if (!sheetCtx.mounted) return;
|
||||
final bloc = sheetCtx.read<ChatBloc>();
|
||||
Navigator.of(sheetCtx).pop();
|
||||
bloc.refresh();
|
||||
},
|
||||
).asDialog(sheetCtx);
|
||||
},
|
||||
),
|
||||
DebugTile(sheetCtx).jsonData(bubbleData.toJson()),
|
||||
|
||||
Reference in New Issue
Block a user