loadImageWidthSize method

Widget loadImageWidthSize(
  1. String url,
  2. double width,
  3. double height, {
  4. Map<String, String>? header,
  5. Color backgroundColor = Colors.black,
  6. TextStyle? textStyle,
})

Implementation

Widget loadImageWidthSize(String url, double width, double height,
    {Map<String, String>? header,
    Color backgroundColor = Colors.black,
    TextStyle? textStyle}) {
  return CachedNetworkImage(
      imageUrl: url,
      httpHeaders: header ?? {"Content-Type": "application/json"},
      imageBuilder: (context, imageProvider) => SizedBox(
            child: Container(
              decoration: BoxDecoration(
                image:
                    DecorationImage(image: imageProvider, fit: BoxFit.cover),
              ),
            ),
            width: width,
            height: height,
          ),
      placeholder: (context, url) => loadDefaultImage(width, height,
          ext: "Loading",
          backgroundColor: backgroundColor,
          textStyle: textStyle),
      errorWidget: (context, url, error) => loadDefaultImage(width, height,
          backgroundColor: backgroundColor, textStyle: textStyle));
}