From d36228348497fefb354d575150be5030edf7832f Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Fri, 16 Oct 2020 18:44:54 +0530 Subject: [PATCH] feat: wip message input --- lib/src/message_input.dart | 56 +++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 8fd077e1..9cae092c 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -206,13 +206,14 @@ class MessageInputState extends State { direction: Axis.horizontal, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - if (!widget.disableAttachments) _buildAttachmentButton(), - _buildGiphyButton(), - ], - ), + if (_giphyEnabled) + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + if (!widget.disableAttachments) _buildAttachmentButton(), + _buildGiphyButton(), + ], + ), if (widget.actionsLocation == ActionsLocation.left) ...widget.actions ?? [], _buildTextInput(context), @@ -293,7 +294,25 @@ class MessageInputState extends State { border: OutlineInputBorder( borderRadius: BorderRadius.circular(32), ), - contentPadding: EdgeInsets.all(4) + contentPadding: EdgeInsets.all(4), + prefix: Chip( + backgroundColor: StreamChatTheme.of(context).accentColor, + label: Row( + children: [ + Icon(StreamIcons.lightning, color: Colors.white,), + SizedBox(width: 2,), + Text('GIPHY', style: TextStyle(color: Colors.white),), + ], + ) + ), + suffixIcon: IconButton( + icon: Icon(Icons.cancel_outlined), + onPressed: () { + setState(() { + _giphyEnabled = false; + }); + }, + ) ), textCapitalization: TextCapitalization.sentences, ), @@ -872,16 +891,15 @@ class MessageInputState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: InkWell( - onTap: () { - sendMessage(); - }, - child: Icon( - StreamIcons.send_message, - color: Colors.grey, - ), - ) - ), + child: InkWell( + onTap: () { + sendMessage(); + }, + child: Icon( + StreamIcons.send_message, + color: Colors.grey, + ), + )), ), ); } @@ -898,7 +916,7 @@ class MessageInputState extends State { sendMessage(); }, child: Transform.rotate( - angle: - pi / 2, + angle: -pi / 2, child: Icon( StreamIcons.send_message, color: StreamChatTheme.of(context).accentColor,