buildImage method

Widget buildImage()

Implementation

Widget buildImage() {
  return ClipRRect(
    borderRadius: BorderRadius.circular(circle ? (width ?? 0) / 2 : radius),
    child: uri.isEmpty
        ? const SizedBox()
        : ImageFiltered(
            imageFilter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
            enabled: blur,
            child: uri.startsWith("http")
                ? CachedNetworkImage(
                    width: width,
                    height: height,
                    imageUrl: uri,
                    fit: fit,
                    fadeOutDuration:
                        Duration(milliseconds: animated ? 300 : 0),
                    fadeInDuration:
                        Duration(milliseconds: animated ? 300 : 0),
                    placeholder: (context, url) => Container(
                      color: bgColor,
                      alignment: Alignment.center,
                      child: placeholder,
                    ),
                    errorWidget: (context, url, _) => Container(
                      color: bgColor,
                      alignment: Alignment.center,
                      child: placeholder,
                    ),
                  )
                : Image.asset(uri, fit: fit, errorBuilder: (c,e,s)=>Container(
                  color: bgColor,
                  alignment: Alignment.center,
                  child: placeholder,
                )),
          ),
  );
}