From 1c3a61e59a80e21a1598eaeb42f8438e1a8167cd Mon Sep 17 00:00:00 2001 From: Ethan Presberg <1320941+zedatrix@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:20:27 -0500 Subject: [PATCH] Adding support to allow for sending a message with the enter key This has not yet been tested due to an issue with compiling on wsl. This was the fix suggested by Pwuts. --- frontend/lib/views/chat/chat_input_field.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/lib/views/chat/chat_input_field.dart b/frontend/lib/views/chat/chat_input_field.dart index b46badd61833..650e0eff792c 100644 --- a/frontend/lib/views/chat/chat_input_field.dart +++ b/frontend/lib/views/chat/chat_input_field.dart @@ -116,6 +116,12 @@ class _ChatInputFieldState extends State { child: TextField( controller: _controller, focusNode: _focusNode, + // Enable enter key stroke to send the message + // Untested but submitted at Pwuts recommendation + onSubmitted: () { + widget.onSendPressed(_controller.text); + _controller.clear(); + }, // Allowing the TextField to expand vertically and accommodate multiple lines maxLines: null, decoration: InputDecoration(