From ad44e44911a0d7441616051f9eda8f8a17a99cba Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Fri, 16 Oct 2020 17:47:05 +0530 Subject: [PATCH] feat: wip message input --- lib/src/message_input.dart | 77 ++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 32 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index b093de7f..5ba50a55 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -165,6 +165,7 @@ class MessageInputState extends State { bool _inputEnabled = true; bool _messageIsPresent = false; bool _typingStarted = false; + bool _giphyEnabled = false; OverlayEntry _commandsOverlay, _mentionsOverlay; /// The editing controller passed to the input TextField @@ -205,6 +206,7 @@ class MessageInputState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ if (!widget.disableAttachments) _buildAttachmentButton(), + _buildGiphyButton(), if (widget.actionsLocation == ActionsLocation.left) ...widget.actions ?? [], _buildTextInput(context), @@ -614,6 +616,31 @@ class MessageInputState extends State { } } + Widget _buildGiphyButton() { + return Center( + child: Material( + clipBehavior: Clip.hardEdge, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(32), + ), + color: Colors.transparent, + child: IconButton( + onPressed: () { + setState(() { + _giphyEnabled = true; + }); + }, + icon: Transform.rotate( + child: Icon( + StreamIcons.lightning, + ), + angle: 0.4, + ), + ), + ), + ); + } + Widget _buildAttachmentButton() { return Center( child: Material( @@ -856,22 +883,15 @@ class MessageInputState extends State { child: Padding( padding: const EdgeInsets.all(8.0), child: Center( - child: Material( - clipBehavior: Clip.hardEdge, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(32), - ), - color: Colors.grey, - child: IconButton( - key: Key('sendButton'), - onPressed: () { - sendMessage(); - }, - icon: Icon( - Icons.arrow_forward, - color: Colors.white, - size: 16.0, - ), + child: IconButton( + key: Key('sendButtonIdle'), + onPressed: () { + sendMessage(); + }, + icon: Icon( + StreamIcons.send_message, + color: Colors.grey, + size: 16.0, ), ), ), @@ -886,22 +906,15 @@ class MessageInputState extends State { child: Center( child: Padding( padding: const EdgeInsets.all(8.0), - child: Material( - clipBehavior: Clip.hardEdge, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(32), - ), - color: StreamChatTheme.of(context).accentColor, - child: IconButton( - key: Key('sendButton'), - onPressed: () { - sendMessage(); - }, - icon: Icon( - Icons.arrow_upward, - color: Colors.white, - size: 16.0, - ), + child: IconButton( + key: Key('sendButton'), + onPressed: () { + sendMessage(); + }, + icon: Icon( + StreamIcons.send_message, + color: StreamChatTheme.of(context).accentColor, + size: 16.0, ), ), ),