DisposableCachedImage.local constructor
DisposableCachedImage.local({
- required String imagePath,
- bool keepAlive = false,
- BoxFit? fit,
- Rect? centerSlice,
- Duration fadeDuration = const Duration(milliseconds: 300),
- OnLoading? onLoading,
- OnError? onError,
- double scale = 1.0,
- double? height,
- BlendMode? colorBlendMode,
- Color? color,
- bool resizeImage = false,
- BoxShape shape = BoxShape.rectangle,
- AlignmentGeometry alignment = Alignment.center,
- bool addRepaintBoundaries = true,
- FilterQuality filterQuality = FilterQuality.none,
- double? width,
- OnImage? onImage,
- ImageRepeat repeat = ImageRepeat.noRepeat,
- bool isAntiAlias = false,
- bool invertColors = false,
- bool isDynamicHeight = false,
- bool matchTextDirection = false,
- bool keepBytesInMemory = true,
- BorderRadius? borderRadius,
- Key? key,
Create a widget that displays a local image from device storage by providing the image path.
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.local({
required final String imagePath,
this.keepAlive = false,
this.fit,
this.centerSlice,
this.fadeDuration = const Duration(milliseconds: 300),
this.onLoading,
this.onError,
this.scale = 1.0,
this.height,
this.colorBlendMode,
this.color,
this.resizeImage = false,
this.shape = BoxShape.rectangle,
this.alignment = Alignment.center,
this.addRepaintBoundaries = true,
this.filterQuality = FilterQuality.none,
this.width,
this.onImage,
this.repeat = ImageRepeat.noRepeat,
this.isAntiAlias = false,
this.invertColors = false,
this.isDynamicHeight = false,
this.matchTextDirection = false,
this.keepBytesInMemory = true,
this.borderRadius,
final Key? key,
}) : assert(
!isDynamicHeight || width != null,
'Image width must be specified for dynamic height images',
),
assert(
!resizeImage || width != null || height != null,
'Either height or width must be specified when resizeImage is enabled',
),
maxCacheWidth = null,
maxCacheHeight = null,
_arguments = _ImageProviderArguments(
image: imagePath,
keepAlive: keepAlive,
resizeImage: resizeImage,
keepBytesInMemory: keepBytesInMemory,
widgetHeight: height?.toInt(),
widgetWidth: width?.toInt(),
),
_provider = _localImageProvider,
progressBuilder = null,
super(key: key);