|
|
|
@ -156,10 +156,17 @@ class _MxcImageState extends State<MxcImage> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final data = _imageData;
|
|
|
|
|
|
|
|
|
|
return data == null || data.isEmpty
|
|
|
|
|
? placeholder(context)
|
|
|
|
|
: Image.memory(
|
|
|
|
|
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,
|
|
|
|
@ -171,6 +178,13 @@ class _MxcImageState extends State<MxcImage> {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback(_tryLoad);
|
|
|
|
|
return placeholder(context);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: SizedBox(
|
|
|
|
|
width: widget.width,
|
|
|
|
|
height: widget.height,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|