loadNetImage static method

Widget loadNetImage(
  1. String? url, {
  2. String? domain,
  3. ImageTransformerType type = ImageTransformerType.rect,
  4. double? width,
  5. double? height,
  6. BoxFit fit = BoxFit.cover,
})

加载网络图片widget

Implementation

static Widget loadNetImage(
  String? url, {
  String? domain,
  ImageTransformerType type = ImageTransformerType.rect,
  double? width,
  double? height,
  BoxFit fit = BoxFit.cover,
}) {
  var domainUrl = domain ?? ImageWidget.domain;
  if (url != null && !url.startsWith("http")) {
    url = domainUrl + url;
  }

  return OctoImage(
    image: CachedNetworkImageProvider(url ?? ""),
    imageBuilder: type == ImageTransformerType.rect
        ? MyOctoImageTransformer.radiusAvatar()
        : MyOctoImageTransformer.circleAvatar(),
    errorBuilder: OctoError.icon(color: Colors.red),
    fit: fit,
    width: width,
    height: height,
  );
}