mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:39:37 -05: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>
		
			
				
	
	
		
			36 lines
		
	
	
		
			845 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			845 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
import 'package:flutter/material.dart';
 | 
						|
import 'package:immich_mobile/shared/ui/transparent_image.dart';
 | 
						|
 | 
						|
class FadeInPlaceholderImage extends StatelessWidget {
 | 
						|
  final Widget placeholder;
 | 
						|
  final ImageProvider image;
 | 
						|
  final Duration duration;
 | 
						|
  final BoxFit fit;
 | 
						|
 | 
						|
  const FadeInPlaceholderImage({
 | 
						|
    super.key,
 | 
						|
    required this.placeholder,
 | 
						|
    required this.image,
 | 
						|
    this.duration = const Duration(milliseconds: 100),
 | 
						|
    this.fit = BoxFit.cover,
 | 
						|
  });
 | 
						|
 | 
						|
  @override
 | 
						|
  Widget build(BuildContext context) {
 | 
						|
    return SizedBox.expand(
 | 
						|
      child: Stack(
 | 
						|
        fit: StackFit.expand,
 | 
						|
        children: [
 | 
						|
          placeholder,
 | 
						|
          FadeInImage(
 | 
						|
            fadeInDuration: duration,
 | 
						|
            image: image,
 | 
						|
            fit: fit,
 | 
						|
            placeholder: MemoryImage(kTransparentImage),
 | 
						|
          ),
 | 
						|
        ],
 | 
						|
      ),
 | 
						|
    );
 | 
						|
  }
 | 
						|
}
 |