always answer
This commit is contained in:
parent
78e5db6775
commit
c0eb133c0a
@ -202,16 +202,9 @@ class _SpellingQuestionTileState extends State<SpellingQuestionTile> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_answerCorrect = correct;
|
_answerCorrect = correct;
|
||||||
_showingFeedback = true;
|
_showingFeedback = true;
|
||||||
|
_awaitingNext = true;
|
||||||
});
|
});
|
||||||
|
_tileFocusNode.requestFocus();
|
||||||
await Future<void>.delayed(const Duration(seconds: 1));
|
|
||||||
if (mounted) {
|
|
||||||
setState(() {
|
|
||||||
_showingFeedback = false;
|
|
||||||
_awaitingNext = true;
|
|
||||||
});
|
|
||||||
_tileFocusNode.requestFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _triggerNextQuestion() async {
|
Future<void> _triggerNextQuestion() async {
|
||||||
@ -296,20 +289,20 @@ class _SpellingQuestionTileState extends State<SpellingQuestionTile> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 28),
|
const SizedBox(height: 28),
|
||||||
if (feedbackWord != null && feedbackColor != null)
|
if (_awaitingNext) ...<Widget>[
|
||||||
Padding(
|
if (feedbackWord != null && feedbackColor != null)
|
||||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
Padding(
|
||||||
child: Text(
|
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||||
feedbackWord,
|
child: Text(
|
||||||
key: const Key('spelling-feedback-word'),
|
feedbackWord,
|
||||||
textAlign: TextAlign.center,
|
key: const Key('spelling-feedback-word'),
|
||||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
textAlign: TextAlign.center,
|
||||||
color: feedbackColor,
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||||
fontWeight: FontWeight.w700,
|
color: feedbackColor,
|
||||||
),
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
|
||||||
else if (_awaitingNext) ...<Widget>[
|
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
FilledButton(
|
FilledButton(
|
||||||
key: const Key('spelling-next-question'),
|
key: const Key('spelling-next-question'),
|
||||||
|
|||||||
@ -36,11 +36,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(feedback.data, 'colour');
|
expect(feedback.data, 'colour');
|
||||||
expect(feedback.style?.color, AppColors.success);
|
expect(feedback.style?.color, AppColors.success);
|
||||||
|
|
||||||
await tester.pump(const Duration(seconds: 1));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
expect(find.byKey(const Key('spelling-feedback-word')), findsNothing);
|
|
||||||
expect(find.byKey(const Key('spelling-next-question')), findsOneWidget);
|
expect(find.byKey(const Key('spelling-next-question')), findsOneWidget);
|
||||||
expect(submitCount, 0);
|
expect(submitCount, 0);
|
||||||
|
|
||||||
@ -76,10 +71,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(feedback.data, 'colour');
|
expect(feedback.data, 'colour');
|
||||||
expect(feedback.style?.color, AppColors.error);
|
expect(feedback.style?.color, AppColors.error);
|
||||||
|
|
||||||
await tester.pump(const Duration(seconds: 1));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
expect(find.byKey(const Key('spelling-next-question')), findsOneWidget);
|
expect(find.byKey(const Key('spelling-next-question')), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -111,10 +102,6 @@ void main() {
|
|||||||
|
|
||||||
expect(submitCount, 0);
|
expect(submitCount, 0);
|
||||||
expect(find.byKey(const Key('spelling-feedback-word')), findsOneWidget);
|
expect(find.byKey(const Key('spelling-feedback-word')), findsOneWidget);
|
||||||
|
|
||||||
await tester.pump(const Duration(seconds: 1));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
expect(find.byKey(const Key('spelling-next-question')), findsOneWidget);
|
expect(find.byKey(const Key('spelling-next-question')), findsOneWidget);
|
||||||
|
|
||||||
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
|
await tester.sendKeyEvent(LogicalKeyboardKey.enter);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user