I want to hide the emoji keyboard when tapped outside of it. But it doesn’t hide. (https://i.stack.imgur.com/XGqjV.png)
I have tried this code. It hides the text keyboard but not the emoji keyboard.
GestureDetector(
onTap: FocusScope.of(context).unfocus,
and for emoji keyboard
Offstage(
offstage: !_showEmoji,
child: SizedBox(
height: 300,
child: EmojiPicker(
textEditingController: _textController,
config: Config(
bgColor: Colors.grey.shade700,
columns: 8,
emojiSizeMax: 32 * (Platform.isIOS ? 1.30 : 1.0),
),
),
),
),
2
Answers
oops, sorry it was wrong.
did you use EmojiPicker widget on the modal window like showModalBottomSheet? If not, I recommend using a modal window.
I think if you use EmojiPicker widget using a modal window, then GestureDetector onTap will work.
For example,
}
}
There can be a round about to this. You can make a bool for example
isShowingEmoji = false
, then you can set it to true while openingEmojiPicker
, then in yourGestureDetector
you can use this code to unfocus it.Note: there can be a good approach to this, this is just a round about.