整个课程和数据UI重新设计版本
This commit is contained in:
@@ -21,6 +21,9 @@ class _ReadingStepState extends State<_ReadingStep> {
|
||||
int? selectedOptionIndex;
|
||||
bool showAnswer = false;
|
||||
|
||||
/// Typed answers are judged on tap, not on every keystroke.
|
||||
bool typedAnswerChecked = false;
|
||||
|
||||
/// 打乱后的选项:答案不再固定排在第一位,但同一道题顺序保持稳定。
|
||||
late final List<String> options = shuffledOptions(
|
||||
widget.activity.readingOptions,
|
||||
@@ -332,7 +335,7 @@ class _ReadingStepState extends State<_ReadingStep> {
|
||||
] else ...[
|
||||
TextField(
|
||||
controller: controller,
|
||||
onChanged: (_) => setState(() {}),
|
||||
onChanged: (_) => setState(() => typedAnswerChecked = false),
|
||||
decoration: InputDecoration(
|
||||
hintText: '用英文输入答案',
|
||||
filled: true,
|
||||
@@ -340,6 +343,14 @@ class _ReadingStepState extends State<_ReadingStep> {
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
if (typedAnswerChecked && !answeredCorrectly && !showAnswer)
|
||||
SectionCard(
|
||||
tint: AppColors.warm,
|
||||
child: Text(
|
||||
'不对哦:答案需要写全对话里的关键词。再读一遍对话,或查看答案后继续。',
|
||||
style: TextStyle(color: AppColors.warmInk),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (showAnswer)
|
||||
SectionCard(
|
||||
@@ -351,9 +362,7 @@ class _ReadingStepState extends State<_ReadingStep> {
|
||||
),
|
||||
if (!showAnswer &&
|
||||
((isOptionMode && hasSelected && !answeredCorrectly) ||
|
||||
(!isOptionMode &&
|
||||
controller.text.isNotEmpty &&
|
||||
!answeredCorrectly)))
|
||||
(!isOptionMode && typedAnswerChecked && !answeredCorrectly)))
|
||||
TextButton(
|
||||
onPressed: () => setState(() => showAnswer = true),
|
||||
child: const Text('查看答案后继续学习'),
|
||||
@@ -364,6 +373,8 @@ class _ReadingStepState extends State<_ReadingStep> {
|
||||
: (isOptionMode ? '请选择答案' : '检查并继续'),
|
||||
onPressed: showAnswer || answeredCorrectly
|
||||
? widget.onContinue
|
||||
: !isOptionMode && controller.text.trim().isNotEmpty
|
||||
? () => setState(() => typedAnswerChecked = true)
|
||||
: null,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user