💄 Optimize cloud file rendering
This commit is contained in:
		| @@ -812,11 +812,16 @@ class _CloudFileListEntry extends HookConsumerWidget { | ||||
|     final lockedByDS = dataSaving && !showDataSaving.value; | ||||
|     final lockedByMature = file.sensitiveMarks.isNotEmpty && !showMature.value; | ||||
|     final meta = file.fileMeta is Map ? file.fileMeta as Map : const {}; | ||||
|     final hasRatio = | ||||
|         meta.containsKey('ratio') && | ||||
|         (meta['ratio'] is num && (meta['ratio'] as num) != 0); | ||||
|     final ratio = | ||||
|         (meta['ratio'] is num && (meta['ratio'] as num) != 0) | ||||
|             ? (meta['ratio'] as num).toDouble() | ||||
|             : 1.0; | ||||
|  | ||||
|     final fit = hasRatio ? BoxFit.cover : BoxFit.contain; | ||||
|  | ||||
|     Widget bg = const SizedBox.shrink(); | ||||
|     if (isImage) { | ||||
|       if (meta['blur'] is String) { | ||||
| @@ -825,6 +830,7 @@ class _CloudFileListEntry extends HookConsumerWidget { | ||||
|         bg = ImageFiltered( | ||||
|           imageFilter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), | ||||
|           child: CloudFileWidget( | ||||
|             fit: fit, | ||||
|             item: file, | ||||
|             noBlurhash: true, | ||||
|             useInternalGate: false, | ||||
| @@ -843,13 +849,13 @@ class _CloudFileListEntry extends HookConsumerWidget { | ||||
|                   item: file, | ||||
|                   heroTag: heroTag, | ||||
|                   noBlurhash: true, | ||||
|                   fit: BoxFit.contain, | ||||
|                   fit: fit, | ||||
|                   useInternalGate: false, | ||||
|                 ) | ||||
|                 : CloudFileWidget( | ||||
|                   item: file, | ||||
|                   heroTag: heroTag, | ||||
|                   fit: BoxFit.contain, | ||||
|                   fit: fit, | ||||
|                   useInternalGate: false, | ||||
|                 )) | ||||
|             : AspectRatio(aspectRatio: ratio, child: const SizedBox.shrink()); | ||||
|   | ||||
| @@ -31,10 +31,7 @@ class UniversalImage extends StatelessWidget { | ||||
|           height != null ? (height! * devicePixelRatio).round() : null; | ||||
|     } | ||||
|  | ||||
|     return SizedBox( | ||||
|       width: width, | ||||
|       height: height, | ||||
|       child: Stack( | ||||
|     return Stack( | ||||
|       fit: StackFit.expand, | ||||
|       children: [ | ||||
|         if (blurHash != null) BlurHash(hash: blurHash!), | ||||
| @@ -59,7 +56,6 @@ class UniversalImage extends StatelessWidget { | ||||
|           }, | ||||
|         ), | ||||
|       ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user