fix overlay issues

This commit is contained in:
Salvatore Giordano
2020-11-09 13:33:29 +01:00
parent 0867d7a4db
commit 58e66ee28f
+6 -38
View File
@@ -377,7 +377,7 @@ class MessageInputState extends State<MessageInput> {
_emojiOverlay?.remove(); _emojiOverlay?.remove();
_emojiOverlay = null; _emojiOverlay = null;
_checkCommands(s.trimLeft(), context); _checkCommands(s, context);
_checkMentions(s, context); _checkMentions(s, context);
@@ -829,7 +829,8 @@ class MessageInputState extends State<MessageInput> {
void _getAllMedia() async { void _getAllMedia() async {
var allAlbums = await PhotoGallery.listAlbums(mediumType: MediumType.image); var allAlbums = await PhotoGallery.listAlbums(mediumType: MediumType.image);
var allVideoAlbums = await PhotoGallery.listAlbums(mediumType: MediumType.video); var allVideoAlbums =
await PhotoGallery.listAlbums(mediumType: MediumType.video);
List<Medium> resultList = []; List<Medium> resultList = [];
List<List<dynamic>> resultThumbnailList = []; List<List<dynamic>> resultThumbnailList = [];
@@ -1659,42 +1660,9 @@ class MessageInputState extends State<MessageInput> {
if (!kIsWeb) { if (!kIsWeb) {
_keyboardListener = KeyboardVisibility.onChange.listen((visible) { _keyboardListener = KeyboardVisibility.onChange.listen((visible) {
if (visible) { if (visible) {
if (_commandsOverlay != null) { _checkCommands(textEditingController.text, context);
if (textEditingController.text.trimLeft().startsWith('/')) { _checkMentions(textEditingController.text, context);
WidgetsBinding.instance.addPostFrameCallback((_) { _checkEmoji(textEditingController.text, context);
_commandsOverlay = _buildCommandsOverlayEntry();
Overlay.of(context).insert(_commandsOverlay);
});
}
}
if (_mentionsOverlay != null) {
if (textEditingController.text.contains('@')) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_mentionsOverlay = _buildCommandsOverlayEntry();
Overlay.of(context).insert(_mentionsOverlay);
});
}
}
if (_emojiOverlay != null) {
if (textEditingController.text.contains(':')) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_emojiOverlay = _buildEmojiOverlay();
Overlay.of(context).insert(_emojiOverlay);
});
}
}
} else {
if (_commandsOverlay != null) {
_commandsOverlay.remove();
}
if (_mentionsOverlay != null) {
_mentionsOverlay.remove();
}
if (_emojiOverlay != null) {
_emojiOverlay.remove();
}
} }
}); });
} }