44 lines
965 B
Dart
44 lines
965 B
Dart
|
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()),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|