Lower the quality of local thumbnails that are loaded

This commit is contained in:
Vishnu Mohandas 2020-11-16 13:05:06 +05:30
parent 06f5db3fd7
commit 8448b9baef
3 changed files with 11 additions and 2 deletions

View file

@ -1,4 +1,5 @@
const int THUMBNAIL_SMALL_SIZE = 256;
const int THUMBNAIL_SMALL_SIZE_QUALITY = 80;
const int THUMBNAIL_LARGE_SIZE = 512;
const String SENTRY_DSN =
"http://96780dc0b00f4c69a16c02e90d379996@3.211.17.56/2";

View file

@ -90,7 +90,11 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
return;
}
asset
.thumbDataWithSize(THUMBNAIL_SMALL_SIZE, THUMBNAIL_SMALL_SIZE)
.thumbDataWithSize(
THUMBNAIL_SMALL_SIZE,
THUMBNAIL_SMALL_SIZE,
quality: THUMBNAIL_SMALL_SIZE_QUALITY,
)
.then((data) {
if (data != null && mounted) {
final imageProvider = Image.memory(data).image;

View file

@ -74,7 +74,11 @@ void preloadLocalFileThumbnail(File file) {
}
file.getAsset().then((asset) {
asset
.thumbDataWithSize(THUMBNAIL_SMALL_SIZE, THUMBNAIL_SMALL_SIZE)
.thumbDataWithSize(
THUMBNAIL_SMALL_SIZE,
THUMBNAIL_SMALL_SIZE,
quality: THUMBNAIL_SMALL_SIZE_QUALITY,
)
.then((data) {
ThumbnailLruCache.put(file, THUMBNAIL_SMALL_SIZE, data);
});