From 4b122a7e5460f16ee671fad205caa505c135e533 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Fri, 11 Dec 2020 17:01:00 +0530 Subject: [PATCH] feat: Added new picker implementation --- lib/src/message_input.dart | 47 +++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index dd9e2718..b6a74f11 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -839,22 +839,37 @@ class MessageInputState extends State { } if (snapshot.data) { - return IgnorePointer( - ignoring: _attachmentContainsFile, - child: MediaListView( - selectedIds: _attachments.map((e) => e.id).toList(), - onSelect: (media) async { - if (!_attachments - .any((element) => element.id == media.id)) { - _addAttachment(media); - } else { - setState(() { - _attachments - .removeWhere((element) => element.id == media.id); - }); - } - }, - ), + if (_attachmentContainsFile) { + return Container( + color: Color(0xfff2f2f2), + child: InkWell( + onTap: () { + pickFile(DefaultAttachmentTypes.file); + }, + child: Text( + 'Add more files', + style: TextStyle( + color: StreamChatTheme.of(context).accentColor, + fontWeight: FontWeight.bold, + ), + ), + ), + alignment: Alignment.center, + ); + } + return MediaListView( + selectedIds: _attachments.map((e) => e.id).toList(), + onSelect: (media) async { + if (!_attachments + .any((element) => element.id == media.id)) { + _addAttachment(media); + } else { + setState(() { + _attachments + .removeWhere((element) => element.id == media.id); + }); + } + }, ); }