fix: Use animatedswitcher instead of crashing animatedcrossfade
This commit is contained in:
parent
565926809d
commit
85139f533c
2 changed files with 172 additions and 170 deletions
|
|
@ -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),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue