refactor: 将课程各步骤拆分到 features/lesson/steps/
lesson_flow.dart 保留流程状态、公共脚手架与小组件,预习/听/说/读/写/独立表达 六个步骤各自成为 part 文件。代码仅搬移并经 dart format 格式化,无用户可见变化。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
part of '../lesson_flow.dart';
|
||||
|
||||
class _PreviewStep extends StatelessWidget {
|
||||
const _PreviewStep({
|
||||
required this.state,
|
||||
required this.item,
|
||||
required this.position,
|
||||
required this.total,
|
||||
required this.onLookup,
|
||||
required this.onNext,
|
||||
required this.onSkip,
|
||||
});
|
||||
|
||||
final VocabularyItem item;
|
||||
final AppState state;
|
||||
final int position;
|
||||
final int total;
|
||||
final VoidCallback onLookup;
|
||||
final VoidCallback onNext;
|
||||
final VoidCallback onSkip;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => _LessonScaffold(
|
||||
step: 1,
|
||||
child: SpacedColumn(
|
||||
children: [
|
||||
Eyebrow('先认识今天的词 · $position / $total'),
|
||||
Text('后面会遇到这些词。', style: Theme.of(context).textTheme.headlineMedium),
|
||||
const Text('先听一遍、知道意思就够了,不用马上背会。'),
|
||||
SectionCard(
|
||||
tint: AppColors.softGreen,
|
||||
child: SpacedColumn(
|
||||
children: [
|
||||
Text(
|
||||
item.word,
|
||||
style: const TextStyle(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if (item.ipa != null)
|
||||
Text(item.ipa!, style: Theme.of(context).textTheme.bodyMedium),
|
||||
Text(item.meaning, style: const TextStyle(fontSize: 17)),
|
||||
_AudioRow(label: '播放示范音', speech: item.word),
|
||||
LexiconText(item.example, state: state),
|
||||
Text(item.exampleMeaning),
|
||||
],
|
||||
),
|
||||
),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
children: [ActionChip(label: const Text('查词'), onPressed: onLookup)],
|
||||
),
|
||||
PrimaryButton(
|
||||
label: position == total ? '进入课程' : '认识了,下一个',
|
||||
onPressed: onNext,
|
||||
),
|
||||
TextButton(onPressed: onSkip, child: const Text('跳过,直接进入课程')),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user