feat: Added giphy for giphyEnabled mode

This commit is contained in:
Deven Joshi
2020-10-19 13:16:04 +05:30
parent 7e55c98cb2
commit 830076e2bd
+9 -2
View File
@@ -291,7 +291,9 @@ class MessageInputState extends State<MessageInput> {
), ),
contentPadding: EdgeInsets.all(4), contentPadding: EdgeInsets.all(4),
prefixIcon: _giphyEnabled prefixIcon: _giphyEnabled
? Chip( ? Padding(
padding: const EdgeInsets.symmetric(horizontal: 2.0),
child: Chip(
backgroundColor: StreamChatTheme.of(context).accentColor, backgroundColor: StreamChatTheme.of(context).accentColor,
label: Text( label: Text(
'GIPHY', 'GIPHY',
@@ -301,6 +303,7 @@ class MessageInputState extends State<MessageInput> {
StreamIcons.lightning, StreamIcons.lightning,
color: Colors.white, color: Colors.white,
), ),
),
) )
: null, : null,
suffixIcon: _giphyEnabled suffixIcon: _giphyEnabled
@@ -932,11 +935,15 @@ class MessageInputState extends State<MessageInput> {
/// Sends the current message /// Sends the current message
void sendMessage() async { void sendMessage() async {
final text = textEditingController.text.trim(); var text = textEditingController.text.trim();
if (text.isEmpty && _attachments.isEmpty) { if (text.isEmpty && _attachments.isEmpty) {
return; return;
} }
if(_giphyEnabled) {
text = '/giphy' + text;
}
final attachments = List<_SendingAttachment>.from(_attachments); final attachments = List<_SendingAttachment>.from(_attachments);
textEditingController.clear(); textEditingController.clear();