fix(ui): Fix a MessageInput bug.

This commit is contained in:
Jia-Han Wu
2021-08-13 18:05:46 +08:00
committed by Jia-Han Wu
parent 118ae8388f
commit 6c71350d39
@@ -1869,15 +1869,14 @@ class MessageInputState extends State<MessageInput> {
} else if (fileType == DefaultAttachmentTypes.video) { } else if (fileType == DefaultAttachmentTypes.video) {
pickedFile = await _imagePicker.pickVideo(source: ImageSource.camera); pickedFile = await _imagePicker.pickVideo(source: ImageSource.camera);
} }
if (pickedFile == null) { if (pickedFile != null) {
return; final bytes = await pickedFile.readAsBytes();
file = AttachmentFile(
size: bytes.length,
path: pickedFile.path,
bytes: bytes,
);
} }
final bytes = await pickedFile.readAsBytes();
file = AttachmentFile(
size: bytes.length,
path: pickedFile.path,
bytes: bytes,
);
} else { } else {
late FileType type; late FileType type;
if (fileType == DefaultAttachmentTypes.image) { if (fileType == DefaultAttachmentTypes.image) {