From 830076e2bd94cb636fe8add790967aada2c6eb40 Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Mon, 19 Oct 2020 13:16:04 +0530 Subject: [PATCH] feat: Added giphy for giphyEnabled mode --- lib/src/message_input.dart | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 5a35acc4..bdaf02ba 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -291,17 +291,20 @@ class MessageInputState extends State { ), contentPadding: EdgeInsets.all(4), prefixIcon: _giphyEnabled - ? Chip( - backgroundColor: StreamChatTheme.of(context).accentColor, - label: Text( - 'GIPHY', - style: TextStyle(color: Colors.white), + ? Padding( + padding: const EdgeInsets.symmetric(horizontal: 2.0), + child: Chip( + backgroundColor: StreamChatTheme.of(context).accentColor, + label: Text( + 'GIPHY', + style: TextStyle(color: Colors.white), + ), + avatar: Icon( + StreamIcons.lightning, + color: Colors.white, + ), ), - avatar: Icon( - StreamIcons.lightning, - color: Colors.white, - ), - ) + ) : null, suffixIcon: _giphyEnabled ? IconButton( @@ -932,11 +935,15 @@ class MessageInputState extends State { /// Sends the current message void sendMessage() async { - final text = textEditingController.text.trim(); + var text = textEditingController.text.trim(); if (text.isEmpty && _attachments.isEmpty) { return; } + if(_giphyEnabled) { + text = '/giphy' + text; + } + final attachments = List<_SendingAttachment>.from(_attachments); textEditingController.clear();