fix: Use animatedswitcher instead of crashing animatedcrossfade

This commit is contained in:
krille-chan 2025-08-17 08:34:25 +02:00
commit 85139f533c
No known key found for this signature in database
2 changed files with 172 additions and 170 deletions

View file

@ -140,12 +140,9 @@ class _MxcImageState extends State<MxcImage> {
final data = _imageData;
final hasData = data != null && data.isNotEmpty;
return AnimatedCrossFade(
crossFadeState:
hasData ? CrossFadeState.showSecond : CrossFadeState.showFirst,
return AnimatedSwitcher(
duration: const Duration(milliseconds: 128),
firstChild: placeholder(context),
secondChild: hasData
child: hasData
? Image.memory(
data,
width: widget.width,
@ -169,10 +166,7 @@ class _MxcImageState extends State<MxcImage> {
);
},
)
: SizedBox(
width: widget.width,
height: widget.height,
),
: placeholder(context),
);
}
}