ImageWidget.asset constructor

ImageWidget.asset(
  1. String? assetUrl, {
  2. Key? key,
  3. AssetBundle? bundle,
  4. ImageFrameBuilder? frameBuilder,
  5. ImageErrorWidgetBuilder? errorBuilder,
  6. String? semanticLabel,
  7. bool excludeFromSemantics = false,
  8. double? scale,
  9. required double width,
  10. required double height,
  11. Color? color,
  12. Animation<double>? opacity,
  13. BlendMode? colorBlendMode,
  14. BoxFit fit = BoxFit.none,
  15. AlignmentGeometry alignment = Alignment.center,
  16. ImageRepeat repeat = ImageRepeat.noRepeat,
  17. Rect? centerSlice,
  18. bool matchTextDirection = false,
  19. bool gaplessPlayback = false,
  20. bool isAntiAlias = false,
  21. String? package,
  22. FilterQuality filterQuality = FilterQuality.low,
  23. int? cacheWidth,
  24. int? cacheHeight,
  25. String? src,
  26. Widget? errorWidget,
  27. Widget? loadingWidget,
})

Implementation

ImageWidget.asset(
  this.assetUrl, {
  Key? key,
  AssetBundle? bundle,
  this.frameBuilder,
  this.errorBuilder,
  this.semanticLabel,
  this.excludeFromSemantics = false,
  double? scale,
  required this.width,
  required this.height,
  this.color,
  this.opacity,
  this.colorBlendMode,
  this.fit = BoxFit.none,
  this.alignment = Alignment.center,
  this.repeat = ImageRepeat.noRepeat,
  this.centerSlice,
  this.matchTextDirection = false,
  this.gaplessPlayback = false,
  this.isAntiAlias = false,
  String? package,
  this.filterQuality = FilterQuality.low,
  this.cacheWidth,
  this.cacheHeight,
  this.src,
  this.errorWidget,
  this.loadingWidget,
})  : image = ResizeImage.resizeIfNeeded(
        cacheWidth,
        cacheHeight,
        scale != null
            ? ExactAssetImage(assetUrl ?? '', bundle: bundle, scale: scale, package: package)
            : AssetImage(assetUrl ?? '', bundle: bundle, package: package),
      ),
      loadingBuilder = null,
      assert(cacheWidth == null || cacheWidth > 0),
      assert(cacheHeight == null || cacheHeight > 0),
      super(key: key);