diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index c6a99807e..3fcd29ba6 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -428,16 +428,19 @@ class ChatController extends State { } void emojiPickerAction() { + if (showEmojiPicker) { + inputFocus.requestFocus(); + } else { + inputFocus.unfocus(); + } emojiPickerType = EmojiPickerType.keyboard; setState(() => showEmojiPicker = !showEmojiPicker); - _inputFocusListener(); } void _inputFocusListener() { - if (showEmojiPicker) { - inputFocus.unfocus(); - } else { - inputFocus.requestFocus(); + if (showEmojiPicker && inputFocus.hasFocus) { + emojiPickerType = EmojiPickerType.keyboard; + setState(() => showEmojiPicker = false); } } diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index 9a24b2d38..b2ffb156f 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -25,6 +25,7 @@ class InputBar extends StatelessWidget { final InputDecoration? decoration; final ValueChanged? onChanged; final bool? autofocus; + final bool readOnly; const InputBar({ required this.room, @@ -38,6 +39,7 @@ class InputBar extends StatelessWidget { this.onChanged, this.autofocus, this.textInputAction, + this.readOnly = false, Key? key, }) : super(key: key); @@ -374,6 +376,7 @@ class InputBar extends StatelessWidget { hideOnEmpty: true, hideOnLoading: true, keepSuggestionsOnSuggestionSelected: true, + debounceDuration: const Duration( milliseconds: 50), // show suggestions after 50ms idle time (default is 300) @@ -388,7 +391,6 @@ class InputBar extends StatelessWidget { // it sets the types for the callback incorrectly onSubmitted!(text); }, - //focusNode: focusNode, controller: controller, decoration: decoration!, focusNode: focusNode,