remove useless native code

This commit is contained in:
Salvatore Giordano
2020-10-29 10:02:22 +01:00
parent dcff11e188
commit 145351846d
+45 -41
View File
@@ -664,22 +664,24 @@ class MessageInputState extends State<MessageInput> {
Navigator.pop(context); Navigator.pop(context);
}, },
), ),
ListTile( if (!kIsWeb)
leading: Icon(Icons.camera_alt), ListTile(
title: Text('Photo from camera'), leading: Icon(Icons.camera_alt),
onTap: () { title: Text('Photo from camera'),
pickFile(DefaultAttachmentTypes.image, true); onTap: () {
Navigator.pop(context); pickFile(DefaultAttachmentTypes.image, true);
}, Navigator.pop(context);
), },
ListTile( ),
leading: Icon(Icons.videocam), if (!kIsWeb)
title: Text('Video from camera'), ListTile(
onTap: () { leading: Icon(Icons.videocam),
pickFile(DefaultAttachmentTypes.video, true); title: Text('Video from camera'),
Navigator.pop(context); onTap: () {
}, pickFile(DefaultAttachmentTypes.video, true);
), Navigator.pop(context);
},
),
ListTile( ListTile(
leading: Icon(Icons.insert_drive_file), leading: Icon(Icons.insert_drive_file),
title: Text('Upload a file'), title: Text('Upload a file'),
@@ -943,34 +945,36 @@ class MessageInputState extends State<MessageInput> {
void initState() { void initState() {
super.initState(); super.initState();
_keyboardListener = KeyboardVisibility.onChange.listen((visible) { if (!kIsWeb) {
if (visible) { _keyboardListener = KeyboardVisibility.onChange.listen((visible) {
if (_commandsOverlay != null) { if (visible) {
if (textEditingController.text.startsWith('/')) { if (_commandsOverlay != null) {
WidgetsBinding.instance.addPostFrameCallback((_) { if (textEditingController.text.startsWith('/')) {
_commandsOverlay = _buildCommandsOverlayEntry(); WidgetsBinding.instance.addPostFrameCallback((_) {
Overlay.of(context).insert(_commandsOverlay); _commandsOverlay = _buildCommandsOverlayEntry();
}); Overlay.of(context).insert(_commandsOverlay);
});
}
} }
}
if (_mentionsOverlay != null) { if (_mentionsOverlay != null) {
if (textEditingController.text.contains('@')) { if (textEditingController.text.contains('@')) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_mentionsOverlay = _buildCommandsOverlayEntry(); _mentionsOverlay = _buildCommandsOverlayEntry();
Overlay.of(context).insert(_mentionsOverlay); Overlay.of(context).insert(_mentionsOverlay);
}); });
}
}
} else {
if (_commandsOverlay != null) {
_commandsOverlay.remove();
}
if (_mentionsOverlay != null) {
_mentionsOverlay.remove();
} }
} }
} else { });
if (_commandsOverlay != null) { }
_commandsOverlay.remove();
}
if (_mentionsOverlay != null) {
_mentionsOverlay.remove();
}
}
});
textEditingController = textEditingController =
widget.textEditingController ?? TextEditingController(); widget.textEditingController ?? TextEditingController();
@@ -997,7 +1001,7 @@ class MessageInputState extends State<MessageInput> {
void dispose() { void dispose() {
_commandsOverlay?.remove(); _commandsOverlay?.remove();
_mentionsOverlay?.remove(); _mentionsOverlay?.remove();
_keyboardListener.cancel(); _keyboardListener?.cancel();
super.dispose(); super.dispose();
} }