mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-17 16:37:17 +02:00
fix: avoid disk resizing cover cache by default
This commit is contained in:
@@ -16,6 +16,7 @@ class CachedCoverImage extends StatelessWidget {
|
|||||||
final Widget Function(BuildContext, String, Object)? errorWidget;
|
final Widget Function(BuildContext, String, Object)? errorWidget;
|
||||||
final Widget Function(BuildContext, String)? placeholder;
|
final Widget Function(BuildContext, String)? placeholder;
|
||||||
final BorderRadius? borderRadius;
|
final BorderRadius? borderRadius;
|
||||||
|
final bool resizeDiskCache;
|
||||||
|
|
||||||
const CachedCoverImage({
|
const CachedCoverImage({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -29,6 +30,7 @@ class CachedCoverImage extends StatelessWidget {
|
|||||||
this.errorWidget,
|
this.errorWidget,
|
||||||
this.placeholder,
|
this.placeholder,
|
||||||
this.borderRadius,
|
this.borderRadius,
|
||||||
|
this.resizeDiskCache = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -37,6 +39,8 @@ class CachedCoverImage extends StatelessWidget {
|
|||||||
memCacheWidth ?? _cacheExtentForLogicalSize(context, width);
|
memCacheWidth ?? _cacheExtentForLogicalSize(context, width);
|
||||||
final autoMemCacheHeight =
|
final autoMemCacheHeight =
|
||||||
memCacheHeight ?? _cacheExtentForLogicalSize(context, height);
|
memCacheHeight ?? _cacheExtentForLogicalSize(context, height);
|
||||||
|
final diskCacheWidth = resizeDiskCache ? autoMemCacheWidth : null;
|
||||||
|
final diskCacheHeight = resizeDiskCache ? autoMemCacheHeight : null;
|
||||||
final image = CachedNetworkImage(
|
final image = CachedNetworkImage(
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
width: width,
|
width: width,
|
||||||
@@ -45,11 +49,9 @@ class CachedCoverImage extends StatelessWidget {
|
|||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
memCacheWidth: autoMemCacheWidth,
|
memCacheWidth: autoMemCacheWidth,
|
||||||
memCacheHeight: autoMemCacheHeight,
|
memCacheHeight: autoMemCacheHeight,
|
||||||
maxWidthDiskCache: autoMemCacheWidth,
|
maxWidthDiskCache: diskCacheWidth,
|
||||||
maxHeightDiskCache: autoMemCacheHeight,
|
maxHeightDiskCache: diskCacheHeight,
|
||||||
cacheManager: CoverCacheManager.isInitialized
|
cacheManager: CoverCacheManager.instance,
|
||||||
? CoverCacheManager.instance
|
|
||||||
: null,
|
|
||||||
fadeInDuration: Duration.zero,
|
fadeInDuration: Duration.zero,
|
||||||
fadeOutDuration: Duration.zero,
|
fadeOutDuration: Duration.zero,
|
||||||
useOldImageOnUrlChange: true,
|
useOldImageOnUrlChange: true,
|
||||||
@@ -80,9 +82,7 @@ class CachedCoverImage extends StatelessWidget {
|
|||||||
CachedNetworkImageProvider cachedCoverImageProvider(String url) {
|
CachedNetworkImageProvider cachedCoverImageProvider(String url) {
|
||||||
return CachedNetworkImageProvider(
|
return CachedNetworkImageProvider(
|
||||||
url,
|
url,
|
||||||
cacheManager: CoverCacheManager.isInitialized
|
cacheManager: CoverCacheManager.instance,
|
||||||
? CoverCacheManager.instance
|
|
||||||
: null,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user