import 'package:tangocard_reader/components/flashcard.dart'; import 'package:flutter/material.dart'; import 'package:tangocard_reader/models/data_entry.dart'; class FlashcardPage extends StatefulWidget { final YokutangoEntry card; final Function() onNextCard; final bool languageFlipped; final int? index; const FlashcardPage({ required this.card, required this.onNextCard, this.languageFlipped = false, this.index, Key? key, }) : super(key: key); @override _FlashcardPageState createState() => _FlashcardPageState(); } class _FlashcardPageState extends State { bool isPressed = false; @override Widget build(BuildContext context) { return GestureDetector( onTap: () { if (isPressed) { widget.onNextCard(); } setState(() { isPressed = !isPressed; }); }, child: Center( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Flashcard( card: widget.card, cardIndex: widget.index, isLeftSide: true, languageFlipped: widget.languageFlipped, ), const SizedBox(width: 40), Flashcard( card: isPressed ? widget.card : null, cardIndex: widget.index, languageFlipped: widget.languageFlipped, ), ], ), ), ); } }