showNetImageCircle static method

Widget showNetImageCircle({
  1. String? url,
  2. String? asset,
  3. double radius = 30,
  4. BoxFit fit = BoxFit.contain,
})

Implementation

static Widget showNetImageCircle(
    {String? url,
    String? asset,
    double radius = 30,
    BoxFit fit = BoxFit.contain}) {
  if (url != null) {
    return CachedNetworkImage(
      width: radius * 2,
      height: radius * 2,
      // imageUrl:  HttpService.urlBase+url+"?${DateTime.now().millisecondsSinceEpoch}",
      imageUrl:  url,
      imageBuilder: (context, imageProvider) => Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(radius),
          image: DecorationImage(
              image: imageProvider,
              fit: fit,
              colorFilter: const ColorFilter.mode(
                  Colors.transparent, BlendMode.colorBurn)),
        ),
      ),
      placeholder: (context, url) => Center(
        child: Container(
          width: radius * 2,
          height: radius * 2,
          margin: const EdgeInsets.all(5),
          child: SkeletonBox(
            width: radius * 2,
            height: radius * 2,
            isCircle: true,
            raduis: radius*2,
            baseColor: Colors.grey.withOpacity(0.034),
            highlightColor:Colors.grey.withOpacity(0.033) ,
          ),
        ),
      ),
      errorWidget: (context, url, error) => Container(
        width: radius,
        height: radius,
        alignment: Alignment.center,
        decoration: BoxDecoration(
            shape: BoxShape.circle,
            // borderRadius: BorderRadius.circular(radius),
            image: DecorationImage(image: const AssetImage("assets/img/img_avatar.png"), fit: fit)),
      ),
    );
  } else {
    return Container(
      width: radius,
      height: radius,
      alignment: Alignment.center,
      decoration: BoxDecoration(
          shape: BoxShape.circle,
          // borderRadius: BorderRadius.circular(radius),
          image: DecorationImage(image: AssetImage(asset!), fit: fit)),
    );
  }
}