toggleCard method
Implementation
Future<void> toggleCard() async {
widget.onFlip?.call();
final bool isFrontBefore = isFront;
controller!.duration = Duration(milliseconds: widget.speed);
final TickerFuture animation = isFront ? controller!.forward() : controller!.reverse();
await animation.whenComplete(() {
widget.onFlipDone?.call(isFront);
if (!mounted) return;
setState(() => isFront = !isFrontBefore);
});
}