fetchImage function
Implementation
Widget fetchImage(String url,
{double width = 48,
double height = 48,
Color? color,
String? defaultImagePath}) {
return CachedNetworkImage(
height: height,
width: width,
imageUrl: url,
color: color,
fit: BoxFit.cover,
placeholder: (BuildContext context, String url) => Image.asset(
Utils.getImgPath(defaultImagePath ?? commonConfig.defaultImgRes),
width: width,
height: height,
fit: BoxFit.cover,
),
errorWidget: (BuildContext context, String url, dynamic error) =>
Image.asset(
Utils.getImgPath(defaultImagePath ?? commonConfig.defaultImgRes),
width: width,
height: height,
fit: BoxFit.cover,
),
);
}