Fix loose focus in web

This commit is contained in:
Christian Pauly 2020-01-24 10:51:23 +00:00
parent b1996bc10e
commit 328300e598

View file

@ -36,6 +36,8 @@ class _ChatState extends State<Chat> {
final ScrollController _scrollController = ScrollController(); final ScrollController _scrollController = ScrollController();
FocusNode inputFocus = FocusNode();
Timer typingCoolDown; Timer typingCoolDown;
Timer typingTimeout; Timer typingTimeout;
bool currentlyTyping = false; bool currentlyTyping = false;
@ -369,7 +371,11 @@ class _ChatState extends State<Chat> {
keyboardType: kIsWeb keyboardType: kIsWeb
? TextInputType.text ? TextInputType.text
: TextInputType.multiline, : TextInputType.multiline,
onSubmitted: (t) => send(), onSubmitted: (String text) {
send();
FocusScope.of(context).requestFocus(inputFocus);
},
focusNode: inputFocus,
controller: sendController, controller: sendController,
decoration: InputDecoration( decoration: InputDecoration(
hintText: I18n.of(context).writeAMessage, hintText: I18n.of(context).writeAMessage,