crossFade method
Wraps the widget for animated switching with cross-fade.
Example:
showFirst
? Text('First').crossFade(key: ValueKey('first'))
: Text('Second').crossFade(key: ValueKey('second'));
Implementation
Widget crossFade({
required Key key,
Duration duration = const Duration(milliseconds: 300),
Curve switchInCurve = Curves.easeIn,
Curve switchOutCurve = Curves.easeOut,
}) {
return AnimatedSwitcher(
duration: duration,
switchInCurve: switchInCurve,
switchOutCurve: switchOutCurve,
child: KeyedSubtree(
key: key,
child: this,
),
);
}