DisposableCachedImage.network constructor
DisposableCachedImage.network({
- bool keepAlive = false,
- required String imageUrl,
- Map<
String, String> ? headers, - int? maxCacheWidth,
- int? maxCacheHeight,
- BoxFit? fit,
- Rect? centerSlice,
- double scale = 1.0,
- bool addRepaintBoundaries = true,
- OnImage? onImage,
- BoxShape shape = BoxShape.rectangle,
- Color? color,
- AlignmentGeometry alignment = Alignment.center,
- OnLoading? onLoading,
- bool isAntiAlias = false,
- bool invertColors = false,
- double? height,
- BlendMode? colorBlendMode,
- bool resizeImage = false,
- bool isDynamicHeight = false,
- bool matchTextDirection = false,
- BorderRadius? borderRadius,
- double? width,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- FilterQuality filterQuality = FilterQuality.none,
- OnError? onError,
- Duration fadeDuration = const Duration(milliseconds: 300),
- Key? key,
- bool keepBytesInMemory = true,
- Widget progressBuilder(
- BuildContext context,
- double progress
Create a widget that displays image from the network and cache it in cache directory.
Either the width and height arguments should be specified, or the widget should be placed in a context that sets tight layout constraints. Otherwise, the image dimensions will change as the image is loaded, which will result in ugly layout changes.
Implementation
DisposableCachedImage.network({
this.keepAlive = false,
required final String imageUrl,
final Map<String, String>? headers,
this.maxCacheWidth,
this.maxCacheHeight,
this.fit,
this.centerSlice,
this.scale = 1.0,
this.addRepaintBoundaries = true,
this.onImage,
this.shape = BoxShape.rectangle,
this.color,
this.alignment = Alignment.center,
this.onLoading,
this.isAntiAlias = false,
this.invertColors = false,
this.height,
this.colorBlendMode,
this.resizeImage = false,
this.isDynamicHeight = false,
this.matchTextDirection = false,
this.borderRadius,
this.width,
this.repeat = ImageRepeat.noRepeat,
this.filterQuality = FilterQuality.none,
this.onError,
this.fadeDuration = const Duration(milliseconds: 300),
final Key? key,
this.keepBytesInMemory = true,
this.progressBuilder,
}) : assert(
!isDynamicHeight || width != null,
'Image width must be specified for dynamic size',
),
assert(
!resizeImage || width != null || height != null,
'Either height or width must be specified when resizeImage is enabled',
),
_arguments = _ImageProviderArguments(
image: imageUrl,
maxCacheWidth: maxCacheWidth,
maxCacheHeight: maxCacheHeight,
keepAlive: keepAlive,
headers: headers,
resizeImage: resizeImage,
keepBytesInMemory: keepBytesInMemory,
widgetHeight: height?.toInt(),
widgetWidth: width?.toInt(),
),
_provider = _networkImageProvider,
super(key: key);