toJPGImage method
Implementation
Widget toJPGImage({
double? width,
double? height,
double? square,
BoxFit? fit,
BorderRadius? borderRadius,
bool isNetwork = false,
}) =>
ClipRRect(
clipBehavior: borderRadius != null ? Clip.hardEdge : Clip.none,
borderRadius: borderRadius ?? BorderRadius.zero,
child: isNetwork
? CachedNetworkImage(
imageUrl: this,
placeholder: (context, url) =>
const Icon(Icons.image, color: Colors.white, size: 30),
errorWidget: (context, url, error) =>
const Icon(Icons.error, color: Colors.white, size: 30),
width: square ?? width,
height: square ?? height,
fit: fit ?? BoxFit.cover,
maxWidthDiskCache: GlobalConfig.networkImageCachedWidth,
maxHeightDiskCache: GlobalConfig.networkImageCachedHeight)
: Image.asset(
'assets/images/$this',
width: square ?? width,
height: square ?? height,
fit: fit ?? BoxFit.cover,
),
);