loadNetworkImage static method

Widget loadNetworkImage(
  1. String? imgPath, {
  2. Key? key,
  3. BorderRadius radius = BorderRadius.zero,
  4. String placeholder = "none",
  5. double? width,
  6. double? height,
  7. BoxFit fit = BoxFit.cover,
  8. String? package,
})

加载网络图片

Implementation

static Widget loadNetworkImage(String? imgPath, {Key? key,BorderRadius radius:BorderRadius.zero,
  String placeholder : "none", double? width, double? height, BoxFit fit: BoxFit.cover,String? package}){
  // LogUtil.e('loadImage loadNetworkImage-->imgPath==$imgPath');
  return Container(
    width: width,
    height: height,
    child: ClipRRect(
      borderRadius: radius,
      child: CachedNetworkImage(
        key: key,
        imageUrl: imgPath??'',
        placeholder: (context, url) => (placeholder=='none')?CupertinoActivityIndicator()
            :loadAssetImage(placeholder, height: height, width: width, fit: fit,package: package),
        errorWidget: (context, url, error) => (placeholder=='none')?Container(child: Icon(Icons.error),):
        loadAssetImage(placeholder, height: height, width: width, fit: fit,package: package),
        width: width,
        height: height,
        fit: fit,
      )
    ),
  );

}