From 328300e598b1bf259b5e57dc830d00f20c54aadb Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Fri, 24 Jan 2020 10:51:23 +0000 Subject: [PATCH] Fix loose focus in web --- lib/views/chat.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/views/chat.dart b/lib/views/chat.dart index c3f811f6..dab09f82 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -36,6 +36,8 @@ class _ChatState extends State { final ScrollController _scrollController = ScrollController(); + FocusNode inputFocus = FocusNode(); + Timer typingCoolDown; Timer typingTimeout; bool currentlyTyping = false; @@ -369,7 +371,11 @@ class _ChatState extends State { keyboardType: kIsWeb ? TextInputType.text : TextInputType.multiline, - onSubmitted: (t) => send(), + onSubmitted: (String text) { + send(); + FocusScope.of(context).requestFocus(inputFocus); + }, + focusNode: inputFocus, controller: sendController, decoration: InputDecoration( hintText: I18n.of(context).writeAMessage,