mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-02 16:14:21 +01:00
change: Do not compress very small images
This commit is contained in:
parent
12d82550e7
commit
073f6bbd7d
@ -26,9 +26,14 @@ class _SendFileDialogState extends State<SendFileDialog> {
|
|||||||
bool origImage = false;
|
bool origImage = false;
|
||||||
bool _isSending = false;
|
bool _isSending = false;
|
||||||
|
|
||||||
|
/// Images smaller than 20kb don't need compression.
|
||||||
|
static const int minSizeToCompress = 20 * 1024;
|
||||||
|
|
||||||
Future<void> _send() async {
|
Future<void> _send() async {
|
||||||
var file = widget.file;
|
var file = widget.file;
|
||||||
if (file is MatrixImageFile && !origImage) {
|
if (file is MatrixImageFile &&
|
||||||
|
!origImage &&
|
||||||
|
file.bytes.length > minSizeToCompress) {
|
||||||
file = await file.resizeImage(quality: 40, max: 1200);
|
file = await file.resizeImage(quality: 40, max: 1200);
|
||||||
}
|
}
|
||||||
await widget.room.sendFileEventWithThumbnail(file);
|
await widget.room.sendFileEventWithThumbnail(file);
|
||||||
@ -53,7 +58,6 @@ class _SendFileDialogState extends State<SendFileDialog> {
|
|||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(widget.file.name),
|
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Checkbox(
|
Checkbox(
|
||||||
|
Loading…
Reference in New Issue
Block a user