yokutango-mobile-reader/lib/screens/practise/kanji.dart

44 lines
965 B
Dart
Raw Normal View History

2022-01-29 19:16:13 +01:00
import 'package:flutter/material.dart';
import '../../models/data_entry.dart';
class KanjiPage extends StatefulWidget {
final KanjiEntry entry;
final Function() onNextCard;
final int? index;
const KanjiPage({
required this.entry,
required this.onNextCard,
this.index,
Key? key,
}) : super(key: key);
@override
_KanjiPageState createState() => _KanjiPageState();
}
class _KanjiPageState extends State<KanjiPage> {
bool isPressed = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (isPressed) widget.onNextCard();
setState(() => isPressed = !isPressed);
},
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(widget.entry.kanji),
const SizedBox(width: 40),
Text(widget.entry.kana.toString()),
],
),
),
);
}
}