FadeInImage.memoryNetwork constructor
- Key? key,
- required Uint8List placeholder,
- ImageErrorWidgetBuilder? placeholderErrorBuilder,
- required String image,
- ImageErrorWidgetBuilder? imageErrorBuilder,
- double placeholderScale = 1.0,
- double imageScale = 1.0,
- bool excludeFromSemantics = false,
- String? imageSemanticLabel,
- Duration fadeOutDuration = const Duration(milliseconds: 300),
- Curve fadeOutCurve = Curves.easeOut,
- Duration fadeInDuration = const Duration(milliseconds: 700),
- Curve fadeInCurve = Curves.easeIn,
- double? width,
- double? height,
- BoxFit? fit,
- Color? color,
- BlendMode? colorBlendMode,
- Color? placeholderColor,
- BlendMode? placeholderColorBlendMode,
- BoxFit? placeholderFit,
- FilterQuality filterQuality = FilterQuality.medium,
- FilterQuality? placeholderFilterQuality,
- AlignmentGeometry alignment = Alignment.center,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- bool matchTextDirection = false,
- int? placeholderCacheWidth,
- int? placeholderCacheHeight,
- int? imageCacheWidth,
- int? imageCacheHeight,
Creates a widget that uses a placeholder image stored in memory while loading the final image from the network.
The placeholder
argument contains the bytes of the in-memory image.
The image
argument is the URL of the final image.
The placeholderScale
and imageScale
arguments are passed to their
respective ImageProviders (see also ImageInfo.scale).
If placeholderCacheWidth
, placeholderCacheHeight
, imageCacheWidth
,
or imageCacheHeight
are provided, it indicates to the
engine that the respective image should be decoded at the specified size.
The image will be rendered to the constraints of the layout or width
and height regardless of these parameters. These parameters are primarily
intended to reduce the memory usage of ImageCache.
The placeholder
, image
, placeholderScale
, imageScale
,
fadeOutDuration, fadeOutCurve, fadeInDuration, fadeInCurve,
alignment, repeat, and matchTextDirection arguments must not be
null.
See also:
- Image.memory, which has more details about loading images from memory.
- Image.network, which has more details about loading images from the network.
Implementation
FadeInImage.memoryNetwork({
super.key,
required Uint8List placeholder,
this.placeholderErrorBuilder,
required String image,
this.imageErrorBuilder,
double placeholderScale = 1.0,
double imageScale = 1.0,
this.excludeFromSemantics = false,
this.imageSemanticLabel,
this.fadeOutDuration = const Duration(milliseconds: 300),
this.fadeOutCurve = Curves.easeOut,
this.fadeInDuration = const Duration(milliseconds: 700),
this.fadeInCurve = Curves.easeIn,
this.width,
this.height,
this.fit,
this.color,
this.colorBlendMode,
this.placeholderColor,
this.placeholderColorBlendMode,
this.placeholderFit,
this.filterQuality = FilterQuality.medium,
this.placeholderFilterQuality,
this.alignment = Alignment.center,
this.repeat = ImageRepeat.noRepeat,
this.matchTextDirection = false,
int? placeholderCacheWidth,
int? placeholderCacheHeight,
int? imageCacheWidth,
int? imageCacheHeight,
}) : placeholder = ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, MemoryImage(placeholder, scale: placeholderScale)),
image = ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, NetworkImage(image, scale: imageScale));