diff --git a/lib/pages/chat/chat_emoji_picker.dart b/lib/pages/chat/chat_emoji_picker.dart index 15edbe1c8d..f1db4cc96d 100644 --- a/lib/pages/chat/chat_emoji_picker.dart +++ b/lib/pages/chat/chat_emoji_picker.dart @@ -18,14 +18,12 @@ class ChatEmojiPicker extends StatelessWidget { Widget build(BuildContext context) { return ValueListenableBuilder( valueListenable: showEmojiPickerNotifier, - builder: (context, showEmojiPicker, child) { - if (!showEmojiPicker) return child!; - + builder: (context, showEmojiPicker, _) { return AnimatedContainer( - decoration: BoxDecoration( + decoration: const BoxDecoration( border: Border( top: BorderSide( - color: Theme.of(context).colorScheme.primary, + color: Colors.transparent, width: 1, ), ), @@ -33,20 +31,21 @@ class ChatEmojiPicker extends StatelessWidget { duration: TwakeThemes.animationDuration, curve: TwakeThemes.animationCurve, width: MediaQuery.sizeOf(context).width, - height: MediaQuery.sizeOf(context).height / 3, - child: EmojiPicker( - onEmojiSelected: (_, emoji) => onEmojiSelected(emoji), - onBackspacePressed: emojiPickerBackspace, - config: Config( - backspaceColor: Theme.of(context).colorScheme.primary, - bgColor: Theme.of(context).colorScheme.surface, - indicatorColor: Theme.of(context).colorScheme.primary, - iconColorSelected: Theme.of(context).colorScheme.primary, - ), - ), + height: showEmojiPicker ? MediaQuery.sizeOf(context).height / 3 : 0, + child: showEmojiPicker + ? EmojiPicker( + onEmojiSelected: (_, emoji) => onEmojiSelected(emoji), + onBackspacePressed: emojiPickerBackspace, + config: Config( + backspaceColor: Theme.of(context).colorScheme.primary, + bgColor: Theme.of(context).colorScheme.surface, + indicatorColor: Theme.of(context).colorScheme.primary, + iconColorSelected: Theme.of(context).colorScheme.primary, + ), + ) + : null, ); }, - child: const SizedBox.shrink(), ); } } diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index 9eaa30626f..6bd9742bed 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -155,6 +155,7 @@ class ChatInputRow extends StatelessWidget { controller: controller.sendController, focusSuggestionController: controller.focusSuggestionController, suggestionScrollController: controller.suggestionScrollController, + showEmojiPickerNotifier: controller.showEmojiPickerNotifier, decoration: InputDecoration( hintText: L10n.of(context)!.chatMessage, hintMaxLines: 1, diff --git a/lib/pages/chat/input_bar/input_bar.dart b/lib/pages/chat/input_bar/input_bar.dart index 31b1298d60..013eec9678 100644 --- a/lib/pages/chat/input_bar/input_bar.dart +++ b/lib/pages/chat/input_bar/input_bar.dart @@ -36,6 +36,7 @@ class InputBar extends StatelessWidget with PasteImageMixin { final ValueChanged? onChanged; final bool autofocus; final ValueKey? typeAheadKey; + final ValueNotifier? showEmojiPickerNotifier; final SuggestionsController>? suggestionsController; InputBar({ @@ -55,6 +56,7 @@ class InputBar extends StatelessWidget with PasteImageMixin { this.typeAheadKey, this.rawKeyboardFocusNode, this.suggestionsController, + this.showEmojiPickerNotifier, Key? key, }) : super(key: key); @@ -387,7 +389,6 @@ class InputBar extends StatelessWidget with PasteImageMixin { suggestionsController: suggestionsController, controller: controller, focusNode: typeAheadFocusNode, - // show suggestions after 50ms idle time (default is 300) builder: (context, controller, focusNode) => TextField( minLines: minLines, maxLines: maxLines, @@ -429,7 +430,10 @@ class InputBar extends StatelessWidget with PasteImageMixin { suggestionsController?.open(); } else { suggestionsController?.close(); - typeAheadFocusNode?.requestFocus(); + if (PlatformInfos.isWeb || + showEmojiPickerNotifier?.value == false) { + typeAheadFocusNode?.requestFocus(); + } } focusSuggestionController.suggestions = suggestions; return suggestions; diff --git a/lib/pages/chat_draft/draft_chat.dart b/lib/pages/chat_draft/draft_chat.dart index 9486b2b4de..cddb3208ad 100644 --- a/lib/pages/chat_draft/draft_chat.dart +++ b/lib/pages/chat_draft/draft_chat.dart @@ -150,6 +150,8 @@ class DraftChatController extends State sendController.dispose(); forwardListController.dispose(); focusSuggestionController.dispose(); + inputText.dispose(); + showEmojiPickerNotifier.dispose(); super.dispose(); }