feat: Better image sending experience
This commit is contained in:
parent
63563a245d
commit
cc0eba83fd
6 changed files with 17 additions and 18 deletions
|
|
@ -31,20 +31,16 @@ class _SendFileDialogState extends State<SendFileDialog> {
|
|||
Future<void> _send() async {
|
||||
var file = widget.file;
|
||||
MatrixImageFile? thumbnail;
|
||||
if (file is MatrixImageFile &&
|
||||
!origImage &&
|
||||
file.bytes.length > minSizeToCompress) {
|
||||
file = await MatrixImageFile.shrink(
|
||||
bytes: file.bytes,
|
||||
name: file.name,
|
||||
compute: widget.room.client.runInBackground,
|
||||
);
|
||||
}
|
||||
if (file is MatrixVideoFile && file.bytes.length > minSizeToCompress) {
|
||||
file = await file.resizeVideo();
|
||||
thumbnail = await file.getVideoThumbnail();
|
||||
}
|
||||
await widget.room.sendFileEvent(file, thumbnail: thumbnail);
|
||||
widget.room.sendFileEvent(
|
||||
file,
|
||||
thumbnail: thumbnail,
|
||||
shrinkImageMaxDimension: origImage ? null : 1600,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue