fix: Delete now deletes a single image

This commit is contained in:
Deven Joshi
2021-02-25 14:55:15 +05:30
parent 0e89971b35
commit 59c8dca60e
@@ -103,11 +103,20 @@ class ImageActionsModal extends StatelessWidget {
color: StreamChatTheme.of(context).colorTheme.accentRed, color: StreamChatTheme.of(context).colorTheme.accentRed,
), ),
() { () {
Navigator.pop(context); if (message.attachments.length > 1 ||
Navigator.pop(context); message.text.isNotEmpty) {
StreamChannel.of(context) var channel = StreamChannel.of(context).channel;
.channel channel.updateMessage(
.deleteMessage(message); message..attachments.removeAt(currentIndex));
Navigator.pop(context);
Navigator.pop(context);
} else {
var channel = StreamChannel.of(context).channel;
channel.deleteMessage(message).then((value) {
Navigator.pop(context);
Navigator.pop(context);
});
}
}, },
color: StreamChatTheme.of(context).colorTheme.accentRed, color: StreamChatTheme.of(context).colorTheme.accentRed,
), ),