loadImage static method

Widget loadImage(
  1. String imageUrl, {
  2. BoxFit fit = BoxFit.cover,
  3. double? width,
  4. double? height,
  5. Widget? placeHolder,
  6. Widget? errorWidget,
})

Implementation

static Widget loadImage(String imageUrl, {BoxFit fit: BoxFit.cover, double? width, double? height, Widget? placeHolder, Widget? errorWidget}){
  final targetPlaceHolder = placeHolder ?? Center(child: SizedBox(height: 30.0, width: 30.0, child: CircularProgressIndicator(strokeWidth: 1.5, valueColor: new AlwaysStoppedAnimation<Color>(NUIColors.NUIDarkGrayOutline), backgroundColor: NUIColors.NUISkeletalGray)));
  return CachedNetworkImage(
    imageUrl: imageUrl,
    width: width,
    height: height,
    fit: fit,
    placeholder: (context, url) => targetPlaceHolder,
    errorWidget: (context, url, error) => errorWidget ?? Center(child: Icon(LineAwesomeIcons.exclamation, color: NUIColors.NUISkeletalGray, size: 24,)),
  );
}