mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 10:49:11 -04:00 
			
		
		
		
	* Refactor to use ImmichThumbnail and local thumbnail image provider format * dart format linter errors linter * Adds blurhash format * Fixes image blur * uses hook instead of stateful widget to be more consistent * Uses blurhash hook state * Uses blurhash ref instead of state * Fixes fade in duration for fade in placeholder * Fixes an issue where thumbnails fail to load if too many thumbnail requests are made simultaenously --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
		
			
				
	
	
		
			18 lines
		
	
	
		
			462 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			462 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:convert';
 | |
| import 'dart:typed_data';
 | |
| import 'package:flutter_hooks/flutter_hooks.dart';
 | |
| import 'package:immich_mobile/shared/models/asset.dart';
 | |
| import 'package:thumbhash/thumbhash.dart' as thumbhash;
 | |
| 
 | |
| ObjectRef<Uint8List?> useBlurHashRef(Asset? asset) {
 | |
|   if (asset?.thumbhash == null) {
 | |
|     return useRef(null);
 | |
|   }
 | |
| 
 | |
|   final rbga = thumbhash.thumbHashToRGBA(
 | |
|     base64Decode(asset!.thumbhash!),
 | |
|   );
 | |
| 
 | |
|   return useRef(thumbhash.rgbaToBmp(rbga));
 | |
| }
 |