fix: send images as images, not files

This commit is contained in:
Sorunome 2020-10-05 16:41:29 +02:00
parent 1d5607f9c5
commit 751dcb7600
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
1 changed files with 3 additions and 3 deletions

View File

@ -227,7 +227,7 @@ class _ChatState extends State<_Chat> {
} }
void sendImageAction(BuildContext context) async { void sendImageAction(BuildContext context) async {
MatrixFile file; MatrixImageFile file;
if (PlatformInfos.isMobile) { if (PlatformInfos.isMobile) {
final result = await ImagePicker().getImage( final result = await ImagePicker().getImage(
source: ImageSource.gallery, source: ImageSource.gallery,
@ -235,7 +235,7 @@ class _ChatState extends State<_Chat> {
maxWidth: 1600, maxWidth: 1600,
maxHeight: 1600); maxHeight: 1600);
if (result == null) return; if (result == null) return;
file = MatrixFile( file = MatrixImageFile(
bytes: await result.readAsBytes(), bytes: await result.readAsBytes(),
name: result.path, name: result.path,
); );
@ -243,7 +243,7 @@ class _ChatState extends State<_Chat> {
final result = final result =
await FilePickerCross.importFromStorage(type: FileTypeCross.image); await FilePickerCross.importFromStorage(type: FileTypeCross.image);
if (result == null) return; if (result == null) return;
file = MatrixFile( file = MatrixImageFile(
bytes: result.toUint8List(), bytes: result.toUint8List(),
name: result.fileName, name: result.fileName,
); );