DisposableCachedImage.local constructor

DisposableCachedImage.local({
  1. required String imagePath,
  2. bool keepAlive = false,
  3. BoxFit? fit,
  4. Rect? centerSlice,
  5. Duration fadeDuration = const Duration(milliseconds: 300),
  6. OnLoading? onLoading,
  7. OnError? onError,
  8. double scale = 1.0,
  9. double? height,
  10. BlendMode? colorBlendMode,
  11. Color? color,
  12. bool resizeImage = false,
  13. BoxShape shape = BoxShape.rectangle,
  14. AlignmentGeometry alignment = Alignment.center,
  15. bool addRepaintBoundaries = true,
  16. FilterQuality filterQuality = FilterQuality.none,
  17. double? width,
  18. OnImage? onImage,
  19. ImageRepeat repeat = ImageRepeat.noRepeat,
  20. bool isAntiAlias = false,
  21. bool invertColors = false,
  22. bool isDynamicHeight = false,
  23. bool matchTextDirection = false,
  24. bool keepBytesInMemory = true,
  25. BorderRadius? borderRadius,
  26. 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);