|
|
|
@ -27,68 +27,48 @@ class MImage extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
Widget image = LayoutBuilder(builder: (context, constraints) { |
|
|
|
|
String imageUrl = "$src?imageMogr2/thumbnail/${constraints.constrainWidth() * 2}x${constraints.constrainHeight() * 2}/format/webp/blur/1x0/quality/75"; |
|
|
|
|
print("imageUrl: $imageUrl"); |
|
|
|
|
return CachedNetworkImage( |
|
|
|
|
imageUrl: imageUrl, |
|
|
|
|
cacheManager: DefaultCacheManager(), |
|
|
|
|
fadeInDuration: Duration(milliseconds: 300), |
|
|
|
|
fadeOutDuration: Duration(milliseconds: 300), |
|
|
|
|
imageBuilder: (context, provide) { |
|
|
|
|
return Image( |
|
|
|
|
image: provide, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
errorWidget: (context, error, stackTrace) { |
|
|
|
|
return Image.asset( |
|
|
|
|
errorSrc, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
placeholder: (context, placeholder) { |
|
|
|
|
print("object $placeholder"); |
|
|
|
|
return Image.asset( |
|
|
|
|
fadeSrc, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var clipRRect ; |
|
|
|
|
if (isCircle) { |
|
|
|
|
clipRRect = ClipOval( |
|
|
|
|
clipBehavior: Clip.antiAlias, |
|
|
|
|
child: CachedNetworkImage( |
|
|
|
|
imageUrl: "$src?imageMogr2/format/webp/blur/1x0/quality/75", |
|
|
|
|
cacheManager: DefaultCacheManager(), |
|
|
|
|
fadeInDuration: Duration(milliseconds: 300), |
|
|
|
|
fadeOutDuration: Duration(milliseconds: 300), |
|
|
|
|
imageBuilder: (context, provide) { |
|
|
|
|
return Image( |
|
|
|
|
image: provide, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
errorWidget: (context, error, stackTrace) { |
|
|
|
|
return Image.asset( |
|
|
|
|
errorSrc, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
placeholder: (context, placeholder) { |
|
|
|
|
print("object $placeholder"); |
|
|
|
|
return Image.asset( |
|
|
|
|
fadeSrc, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
child: image |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
clipRRect = ClipRRect( |
|
|
|
|
borderRadius: radius, |
|
|
|
|
child: CachedNetworkImage( |
|
|
|
|
imageUrl: "$src?imageMogr2/format/webp/blur/1x0/quality/75", |
|
|
|
|
cacheManager: DefaultCacheManager(), |
|
|
|
|
fadeInDuration: Duration(milliseconds: 300), |
|
|
|
|
fadeOutDuration: Duration(milliseconds: 300), |
|
|
|
|
imageBuilder: (context, provide) { |
|
|
|
|
return Image( |
|
|
|
|
image: provide, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
errorWidget: (context, error, stackTrace) { |
|
|
|
|
return Image.asset( |
|
|
|
|
errorSrc, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
placeholder: (context, placeholder) { |
|
|
|
|
print("object $placeholder"); |
|
|
|
|
return Image.asset( |
|
|
|
|
fadeSrc, |
|
|
|
|
fit: fit, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
child: image, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (aspectRatio != null && aspectRatio > 0) { |
|
|
|
|
return Container( |
|
|
|
|
child: AspectRatio( |
|
|
|
|