CachedNetworkImage constructor
CachedNetworkImage({
- Key? key,
- required String imageUrl,
- Map<
String, String> ? httpHeaders, - ImageWidgetBuilder? imageBuilder,
- PlaceholderWidgetBuilder? placeholder,
- ProgressIndicatorBuilder? progressIndicatorBuilder,
- LoadingErrorWidgetBuilder? errorWidget,
- Duration? fadeOutDuration = const Duration(milliseconds: 1000),
- Curve fadeOutCurve = Curves.easeOut,
- Duration fadeInDuration = const Duration(milliseconds: 500),
- Curve fadeInCurve = Curves.easeIn,
- double? width,
- double? height,
- BoxFit? fit,
- Alignment alignment = Alignment.center,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- bool matchTextDirection = false,
- BaseCacheManager? cacheManager,
- bool useOldImageOnUrlChange = false,
- Color? color,
- FilterQuality filterQuality = FilterQuality.low,
- BlendMode? colorBlendMode,
- Duration? placeholderFadeInDuration,
- int? memCacheWidth,
- int? memCacheHeight,
- String? cacheKey,
- int? maxWidthDiskCache,
- int? maxHeightDiskCache,
- ValueChanged<
Object> ? errorListener, - ImageRenderMethodForWeb imageRenderMethodForWeb = ImageRenderMethodForWeb.HtmlImage,
- double scale = 1.0,
CachedNetworkImage shows a network image using a caching mechanism. It also provides support for a placeholder, showing an error and fading into the loaded image. Next to that it supports most features of a default Image widget.
Implementation
CachedNetworkImage({
super.key,
required this.imageUrl,
this.httpHeaders,
this.imageBuilder,
this.placeholder,
this.progressIndicatorBuilder,
this.errorWidget,
this.fadeOutDuration = const Duration(milliseconds: 1000),
this.fadeOutCurve = Curves.easeOut,
this.fadeInDuration = const Duration(milliseconds: 500),
this.fadeInCurve = Curves.easeIn,
this.width,
this.height,
this.fit,
this.alignment = Alignment.center,
this.repeat = ImageRepeat.noRepeat,
this.matchTextDirection = false,
this.cacheManager,
this.useOldImageOnUrlChange = false,
this.color,
this.filterQuality = FilterQuality.low,
this.colorBlendMode,
this.placeholderFadeInDuration,
this.memCacheWidth,
this.memCacheHeight,
this.cacheKey,
this.maxWidthDiskCache,
this.maxHeightDiskCache,
this.errorListener,
ImageRenderMethodForWeb imageRenderMethodForWeb =
ImageRenderMethodForWeb.HtmlImage,
double scale = 1.0,
}) : _image = CachedNetworkImageProvider(
imageUrl,
headers: httpHeaders,
cacheManager: cacheManager,
cacheKey: cacheKey,
imageRenderMethodForWeb: imageRenderMethodForWeb,
maxWidth: maxWidthDiskCache,
maxHeight: maxHeightDiskCache,
errorListener: errorListener,
scale: scale,
);