diff --git a/lib/widgets/mxc_image.dart b/lib/widgets/mxc_image.dart index a0148229b..1021328d1 100644 --- a/lib/widgets/mxc_image.dart +++ b/lib/widgets/mxc_image.dart @@ -156,21 +156,35 @@ class _MxcImageState extends State { @override Widget build(BuildContext context) { final data = _imageData; - - return data == null || data.isEmpty - ? placeholder(context) - : Image.memory( - data, - width: widget.width, - height: widget.height, - fit: widget.fit, - filterQuality: FilterQuality.medium, - errorBuilder: (context, __, ___) { - _isCached = false; - _imageData = null; - WidgetsBinding.instance.addPostFrameCallback(_tryLoad); - return placeholder(context); - }, - ); + final hasData = data != null && data.isNotEmpty; + + return Stack( + children: [ + if (!hasData) placeholder(context), + AnimatedOpacity( + opacity: hasData ? 1 : 0, + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + child: hasData + ? Image.memory( + data, + width: widget.width, + height: widget.height, + fit: widget.fit, + filterQuality: FilterQuality.medium, + errorBuilder: (context, __, ___) { + _isCached = false; + _imageData = null; + WidgetsBinding.instance.addPostFrameCallback(_tryLoad); + return placeholder(context); + }, + ) + : SizedBox( + width: widget.width, + height: widget.height, + ), + ), + ], + ); } }