feat: 增加AI配置文件与TTS自动朗读,修复二级页面返回按钮与音频播放
This commit is contained in:
@@ -46,7 +46,14 @@ class _AssessmentPreparationPageState extends State<AssessmentPreparationPage> {
|
||||
final canResume = draft != null && draft.packId == widget.pack.id;
|
||||
final pack = widget.pack;
|
||||
return AppPage(
|
||||
appBar: AppBar(title: const Text('评估准备')),
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
tooltip: "返回",
|
||||
onPressed: widget.onBack,
|
||||
),
|
||||
title: const Text('评估准备'),
|
||||
),
|
||||
child: SpacedColumn(
|
||||
children: [
|
||||
Eyebrow('A0 阶段评估 · ${pack.id}'),
|
||||
@@ -152,7 +159,9 @@ class _AssessmentPageState extends State<AssessmentPage> {
|
||||
}
|
||||
|
||||
Future<void> _play() async {
|
||||
await VoiceService.instance.speak(task.audio!);
|
||||
try {
|
||||
await VoiceService.instance.speak(task.audio!);
|
||||
} catch (_) {}
|
||||
if (mounted) setState(() => audioPlayed = true);
|
||||
}
|
||||
|
||||
@@ -285,6 +294,14 @@ class _AssessmentPageState extends State<AssessmentPage> {
|
||||
final record = completedRecord;
|
||||
if (record != null) {
|
||||
return AppPage(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
tooltip: "返回",
|
||||
onPressed: widget.onFinished,
|
||||
),
|
||||
title: Text(record.passed ? "阶段评估通过" : "阶段评估结果"),
|
||||
),
|
||||
child: SpacedColumn(
|
||||
children: [
|
||||
const Eyebrow('评估结果已保存'),
|
||||
@@ -325,6 +342,11 @@ class _AssessmentPageState extends State<AssessmentPage> {
|
||||
}
|
||||
return AppPage(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
tooltip: "退出评估",
|
||||
onPressed: widget.onFinished,
|
||||
),
|
||||
title: Text(
|
||||
'A0 评估 ${widget.pack.id} · ${index + 1}/${widget.pack.tasks.length}',
|
||||
),
|
||||
@@ -344,7 +366,12 @@ class _AssessmentPageState extends State<AssessmentPage> {
|
||||
const Text('请根据听到的内容选择答案。'),
|
||||
for (var i = 0; i < task.choices.length; i++)
|
||||
SectionCard(
|
||||
onTap: audioPlayed ? () => _submit(i) : null,
|
||||
onTap: () {
|
||||
if (!audioPlayed) {
|
||||
_play();
|
||||
}
|
||||
_submit(i);
|
||||
},
|
||||
child: Text(task.choices[i]),
|
||||
),
|
||||
] else if (task.skill == AssessmentSkill.reading) ...[
|
||||
|
||||
Reference in New Issue
Block a user