From 8a51fdf531b74d88a0c5f6e837d4bc2c266d2e0b Mon Sep 17 00:00:00 2001 From: Deven Joshi Date: Mon, 19 Oct 2020 18:06:45 +0530 Subject: [PATCH] feat: Fixed lightning button --- lib/src/message_input.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 191da65f..2bb38217 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -207,7 +207,7 @@ class MessageInputState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ if (!widget.disableAttachments) _buildAttachmentButton(), - if (widget.editMessage == null) _buildGiphyButton(), + if (widget.editMessage == null) _buildCommandButton(), ], ), if (widget.actionsLocation == ActionsLocation.left) @@ -519,6 +519,7 @@ class MessageInputState extends State { } void _setCommand(Command c) { + textEditingController.clear(); setState(() { chosenCommand = c; _commandEnabled = true; @@ -645,7 +646,7 @@ class MessageInputState extends State { } } - Widget _buildGiphyButton() { + Widget _buildCommandButton() { return Center( child: InkWell( child: Padding( @@ -654,9 +655,10 @@ class MessageInputState extends State { child: Icon(StreamIcons.lightning), ), onTap: () { - setState(() { - _commandEnabled = true; - }); + if(_commandsOverlay == null) { + _commandsOverlay = _buildCommandsOverlayEntry(); + Overlay.of(context).insert(_commandsOverlay); + } }, ), );