Merge pull request #284 from GetStream/fix/image-delete
fix: Delete now deletes a single image
This commit is contained in:
@@ -103,11 +103,25 @@ class ImageActionsModal extends StatelessWidget {
|
|||||||
color: StreamChatTheme.of(context).colorTheme.accentRed,
|
color: StreamChatTheme.of(context).colorTheme.accentRed,
|
||||||
),
|
),
|
||||||
() {
|
() {
|
||||||
Navigator.pop(context);
|
final channel = StreamChannel.of(context).channel;
|
||||||
Navigator.pop(context);
|
if (message.attachments.length > 1 ||
|
||||||
StreamChannel.of(context)
|
message.text.isNotEmpty) {
|
||||||
.channel
|
final remainingAttachments = [...message.attachments]
|
||||||
.deleteMessage(message);
|
..removeAt(currentIndex);
|
||||||
|
channel.updateMessage(message.copyWith(
|
||||||
|
attachments: remainingAttachments.map((e) {
|
||||||
|
return e.copyWith(
|
||||||
|
uploadState: UploadState.success());
|
||||||
|
}).toList(),
|
||||||
|
));
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
} else {
|
||||||
|
channel.deleteMessage(message).then((value) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
Navigator.pop(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
color: StreamChatTheme.of(context).colorTheme.accentRed,
|
color: StreamChatTheme.of(context).colorTheme.accentRed,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user