profileNetworkImage static method

dynamic profileNetworkImage({
  1. dynamic height = 50.0,
  2. dynamic width = 50.0,
  3. dynamic isShowBorder = false,
  4. dynamic borderWidth = 1.5,
  5. dynamic showBoxShadow = false,
  6. dynamic borderRadius = 40.0,
  7. dynamic backgroundColor,
  8. dynamic placeHolder = ImageResource.profilePlaceHolder,
  9. dynamic imageUrl = "",
})

Implementation

static profileNetworkImage({
  height = 50.0,
  width = 50.0,
  isShowBorder = false,
  borderWidth = 1.5,
  showBoxShadow = false,
  borderRadius = 40.0,
  backgroundColor,
  placeHolder = ImageResource.profilePlaceHolder,
  imageUrl = "",
}) {
  return Container(
    height: height,
    width: width,
    decoration: BoxDecoration(
        color: backgroundColor ?? Colors.black12,
        shape: BoxShape.circle,
        border: Border.all(
            color: isShowBorder ? Colors.white : Colors.transparent,
            width: borderWidth),
        boxShadow: showBoxShadow
            ? [
                BoxShadow(
                  color: const Color(0xff000000).withOpacity(0.10),
                  blurRadius: 10.0,
                  spreadRadius: 1.0,
                )
              ]
            : []),
    child: ClipRRect(
      borderRadius: BorderRadius.circular(borderRadius),
      child: CachedNetworkImage(
        fadeInDuration: const Duration(milliseconds: 250),
        imageUrl: imageUrl == "" || imageUrl == null ? "" : imageUrl,
        errorWidget: (context, url, error) => Opacity(
          opacity: 0.9,
          child: ClipRRect(
            borderRadius: BorderRadius.circular(30.0),
            child: Image.asset(
              placeHolder,
              height: height,
              width: width,
              package: "aplus_chat",
            ),
          ),
        ),
        fit: BoxFit.cover,
        placeholder: ((context, String s) => Image.asset(
              placeHolder,
              height: height,
              width: width,
              package: "aplus_chat",
            )),
      ),
    ),
  );
}