part of 'image.dart'; class AppNetworkImage extends StatelessWidget { final String? url; final double? height; final double? width; final double? borderRadius; final BoxFit? fit; final bool? isCanZoom; final VoidCallback? onTap; const AppNetworkImage({ super.key, this.url, this.height, this.width, this.borderRadius = 0, this.fit = BoxFit.cover, this.isCanZoom = false, this.onTap, }); @override Widget build(BuildContext context) { Widget customPhoto( double? heightx, double? widthx, BoxFit? fitx, double? radius, ) { return CachedNetworkImage( imageUrl: url.toString(), memCacheHeight: 120, memCacheWidth: 120, placeholder: (context, url) => Shimmer.fromColors( baseColor: Colors.grey[300]!, highlightColor: Colors.grey[100]!, child: Container( height: height, width: width, decoration: BoxDecoration( color: Colors.grey.shade300, borderRadius: BorderRadius.circular(radius ?? 0), ), ), ), errorWidget: (context, url, error) { FirebaseCrashlytics.instance.recordError( error, StackTrace.current, reason: 'Failed to load image from: $url', fatal: false, ); return Container( width: double.infinity, height: 120, decoration: BoxDecoration( color: AppColor.disabled.withOpacity(0.4), ), child: const Icon(Icons.image, color: AppColor.disabled), ); }, height: heightx, width: widthx, fit: fitx, ); } return GestureDetector( onTap: onTap, child: ClipRRect( borderRadius: BorderRadius.circular(borderRadius!), child: customPhoto(height, width, BoxFit.fill, borderRadius), ), ); } }