loadImage static method

Widget loadImage(
  1. Map<String, dynamic> data,
  2. ReportElement element, {
  3. double? width,
  4. double? height,
  5. BoxFit? fit,
})

Loads an image based on the configured conditions

Implementation

static Widget loadImage(
  Map<String, dynamic> data,
  ReportElement element, {
  double? width,
  double? height,
  BoxFit? fit,
}) {
  final source = element.properties['source'] as String?;

  switch (source) {
    case 'conditional':
      return _loadConditionalImage(
        data,
        element,
        width: width,
        height: height,
        fit: fit,
      );
    case 'field':
      return _loadFieldImage(
        data,
        element,
        width: width,
        height: height,
        fit: fit,
      );
    case 'asset':
      return _loadAssetImage(element, width: width, height: height, fit: fit);
    case 'url':
      return _loadUrlImage(element, width: width, height: height, fit: fit);
    default:
      return _loadDefaultImage(width: width, height: height);
  }
}