feat: Added remove image

This commit is contained in:
Deven Joshi
2020-11-09 14:38:25 +05:30
parent 812f702845
commit a06b7c2cd8
+8 -2
View File
@@ -668,8 +668,7 @@ class MessageInputState extends State<MessageInput> {
), ),
), ),
if (_attachments.any((element) => if (_attachments.any((element) =>
element.id == element.id == mediaData.data.item1[position].id))
mediaData.data.item1[position].id))
Container( Container(
color: Colors.black.withOpacity(0.5), color: Colors.black.withOpacity(0.5),
child: Center( child: Center(
@@ -683,7 +682,14 @@ class MessageInputState extends State<MessageInput> {
], ],
), ),
onTap: () { onTap: () {
if (!_attachments.any((element) =>
element.id == mediaData.data.item1[position].id)) {
_addAttachment(mediaData.data.item1[position]); _addAttachment(mediaData.data.item1[position]);
} else {
_attachments.removeWhere((element) =>
element.id == mediaData.data.item1[position].id);
setState(() {});
}
}, },
), ),
); );