Skip to content

Commit aa6dbf8

Browse files
committed
FEAT: 学习计划页卡片显示描述与难度,点击进入文件详情页
- 副标题改为文件描述(弱化样式,最多两行省略),为空时不显示 - 元信息行前置 CEFR 难度徽章;卡片内边距收紧 - 整卡可点击进入 audio-detail 嵌套子路由(§7.17 防塌栈) - 新增文件详情页:名称、难度、时长/句数/词数图标标签、完整描述 - 抽出公共 AudioInfoChip,卡片与详情页共用
1 parent 3a9d6f9 commit aa6dbf8

14 files changed

Lines changed: 570 additions & 136 deletions

‎CLAUDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ flutter test integration_test -d macos
270270
新增全屏页统一走 `AppRoutes.pushNested(context, segment)`(相对当前 matchedLocation 追加),
271271
漏声明子路由会即时抛「no route」而非静默塌栈。子页 extra 在重解析后会丢失(不可序列化),
272272
builder 需兜底(见 `_RestoredRoutePopper`:extra 为空时首帧 pop 回已重建的入口页)。
273-
- 已覆盖:plan/player/blind/retell 等 7 条音频页(1.0.21)、sentence-detail、pdf-preview。
273+
- 已覆盖:plan/player/blind/retell 等 7 条音频页(1.0.21)、sentence-detail、pdf-preview、audio-detail(学习计划卡片进入的音频详情)。
274274
回归测试见 `test/router/app_router_test.dart`。
275275

276276
### 7.18 统一 TTS:嵌入式发音组件不可在 provider build 期触碰平台/数据库(惰性化)

‎TASKS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
- [x] 字幕句子列表增加复制能力:移动端长按、桌面端右键,同时支持收藏切换与 AI 讲解(ECH-34)。**完成时间**: 2026-10-30
5555
- [x] 社区合集文件描述落库:`audio_items.community_description`(schema v62),同步/入库/下载时写入,供以后使用。**完成时间**: 2026-11-01
5656
- [x] 播客简介并入通用 `audio_items.description`,删除 `podcast_description` 列(schema v63)。**完成时间**: 2026-11-01
57+
- [x] 学习计划页进度卡片:副标题改为文件描述(最多两行省略)、元信息行显示难度、整卡点击进入音频详情页(`audio-detail` 嵌套子路由)。**完成时间**: 2026-11-01
5758
- [ ] 支持自定义背景和背景音。
5859
- [ ] 增加播放完成音效、任务完成动画与音效。
5960
- [ ] 埋点能力按中国大陆 / 全球环境拆分落地。

‎lib/l10n/app_en.arb‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2748,5 +2748,9 @@
27482748
"pronunciationLibraryDescription": "Pre-recorded word audio for dictionary lookups",
27492749
"redownload": "Download again",
27502750
"collapseSidebar": "Collapse sidebar",
2751-
"expandSidebar": "Expand sidebar"
2751+
"expandSidebar": "Expand sidebar",
2752+
"audioDetailTitle": "File details",
2753+
"audioDetailDescription": "Description",
2754+
"audioDetailDifficulty": "Difficulty",
2755+
"audioDetailNoDescription": "No description yet"
27522756
}

‎lib/l10n/app_localizations.dart‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9985,6 +9985,30 @@ abstract class AppLocalizations {
99859985
/// In en, this message translates to:
99869986
/// **'Expand sidebar'**
99879987
String get expandSidebar;
9988+
9989+
/// No description provided for @audioDetailTitle.
9990+
///
9991+
/// In en, this message translates to:
9992+
/// **'File details'**
9993+
String get audioDetailTitle;
9994+
9995+
/// No description provided for @audioDetailDescription.
9996+
///
9997+
/// In en, this message translates to:
9998+
/// **'Description'**
9999+
String get audioDetailDescription;
10000+
10001+
/// No description provided for @audioDetailDifficulty.
10002+
///
10003+
/// In en, this message translates to:
10004+
/// **'Difficulty'**
10005+
String get audioDetailDifficulty;
10006+
10007+
/// No description provided for @audioDetailNoDescription.
10008+
///
10009+
/// In en, this message translates to:
10010+
/// **'No description yet'**
10011+
String get audioDetailNoDescription;
998810012
}
998910013

999010014
class _AppLocalizationsDelegate

‎lib/l10n/app_localizations_en.dart‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5662,4 +5662,16 @@ class AppLocalizationsEn extends AppLocalizations {
56625662

56635663
@override
56645664
String get expandSidebar => 'Expand sidebar';
5665+
5666+
@override
5667+
String get audioDetailTitle => 'File details';
5668+
5669+
@override
5670+
String get audioDetailDescription => 'Description';
5671+
5672+
@override
5673+
String get audioDetailDifficulty => 'Difficulty';
5674+
5675+
@override
5676+
String get audioDetailNoDescription => 'No description yet';
56655677
}

‎lib/l10n/app_localizations_zh.dart‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5405,4 +5405,16 @@ class AppLocalizationsZh extends AppLocalizations {
54055405

54065406
@override
54075407
String get expandSidebar => '展开侧边栏';
5408+
5409+
@override
5410+
String get audioDetailTitle => '文件详情';
5411+
5412+
@override
5413+
String get audioDetailDescription => '简介';
5414+
5415+
@override
5416+
String get audioDetailDifficulty => '难度';
5417+
5418+
@override
5419+
String get audioDetailNoDescription => '暂无简介';
54085420
}

‎lib/l10n/app_zh.arb‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,5 +2254,9 @@
22542254
"pronunciationLibraryDescription": "词典查词时优先播放预录的单词发音",
22552255
"redownload": "重新下载",
22562256
"collapseSidebar": "收起侧边栏",
2257-
"expandSidebar": "展开侧边栏"
2257+
"expandSidebar": "展开侧边栏",
2258+
"audioDetailTitle": "文件详情",
2259+
"audioDetailDescription": "简介",
2260+
"audioDetailDifficulty": "难度",
2261+
"audioDetailNoDescription": "暂无简介"
22582262
}

‎lib/router/app_router.dart‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import '../screens/study_screen.dart';
3838
import '../screens/favorites_screen.dart';
3939
import '../screens/settings_screen.dart';
4040
import '../screens/learning_plan_screen.dart';
41+
import '../screens/audio_detail_screen.dart';
4142
import '../screens/media_playback_screen.dart';
4243
import '../screens/blind_listen_player_screen.dart';
4344
import '../screens/intensive_listen_player_screen.dart';
@@ -165,6 +166,9 @@ abstract class AppRoutes {
165166

166167
/// 学习材料 PDF 导出预览页路径段(挂在计划页 / 合集页之下的相对子路由)
167168
static const pdfPreviewSegment = 'pdf-preview';
169+
170+
/// 音频详情页路径段(挂在计划页之下的相对子路由)
171+
static const audioDetailSegment = 'audio-detail';
168172
static const backupRestore = '/backup-restore';
169173

170174
/// 收藏词汇(单词+意群)调度式复习页路径
@@ -285,6 +289,17 @@ GoRoute _pdfPreviewRoute() => GoRoute(
285289
},
286290
);
287291

292+
/// 音频详情页子路由工厂。挂在计划页之下,同 _pdfPreviewRoute 的防塌栈说明。
293+
GoRoute _audioDetailRoute() => GoRoute(
294+
path: AppRoutes.audioDetailSegment,
295+
parentNavigatorKey: rootNavigatorKey,
296+
builder: (context, state) {
297+
final item = state.extra;
298+
if (item is! AudioItem) return const _RestoredRoutePopper();
299+
return AudioDetailScreen(audioItem: item);
300+
},
301+
);
302+
288303
/// GoRouter Provider(keepAlive,不可 invalidate)
289304
final appRouterProvider = Provider<GoRouter>((ref) {
290305
final analyticsService = ref.read(analyticsServiceProvider);
@@ -402,7 +417,7 @@ final appRouterProvider = Provider<GoRouter>((ref) {
402417
autoStart: autoStart,
403418
);
404419
},
405-
routes: [_pdfPreviewRoute()],
420+
routes: [_pdfPreviewRoute(), _audioDetailRoute()],
406421
),
407422
_audioPlayerRoute(':audioId/player'),
408423
_mediaPlayerRoute(
@@ -584,7 +599,7 @@ final appRouterProvider = Provider<GoRouter>((ref) {
584599
builder: (context, state) => const BookmarkReviewScreen(),
585600
),
586601
// 句子详情 / PDF 预览已下沉为各入口页的嵌套子路由(§7.17),
587-
// 见 _sentenceDetailRoute() / _pdfPreviewRoute() 的挂载点。
602+
// 见 _sentenceDetailRoute() / _pdfPreviewRoute() / _audioDetailRoute() 的挂载点。
588603
// 收藏词汇(单词+意群)调度式复习(全屏)
589604
GoRoute(
590605
path: AppRoutes.favoriteVocabularyReview,
@@ -649,7 +664,7 @@ final appRouterProvider = Provider<GoRouter>((ref) {
649664
autoStart: autoStart,
650665
);
651666
},
652-
routes: [_pdfPreviewRoute()],
667+
routes: [_pdfPreviewRoute(), _audioDetailRoute()],
653668
),
654669
_audioPlayerRoute('/audio/:audioId/player'),
655670
_mediaPlayerRoute('/audio/:audioId/${AppRoutes.mediaPlayerSegment}'),
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import 'package:flutter/material.dart';
2+
3+
import '../features/community_collections/models/community_collection_models.dart';
4+
import '../features/community_collections/widgets/community_difficulty_badge.dart';
5+
import '../l10n/app_localizations.dart';
6+
import '../models/audio_item.dart';
7+
import '../services/subtitle_parser.dart';
8+
import '../theme/app_theme.dart';
9+
import '../widgets/audio_info_chip.dart';
10+
11+
/// 音频详情页:展示单个音频的完整描述、难度与基础元信息。
12+
///
13+
/// 从学习计划页的进度卡片进入(嵌套子路由 `audio-detail`)。
14+
/// 后续会追加关键点等内容,因此按分区组织 ListView。
15+
class AudioDetailScreen extends StatelessWidget {
16+
/// 要展示的音频条目。
17+
final AudioItem audioItem;
18+
19+
const AudioDetailScreen({super.key, required this.audioItem});
20+
21+
@override
22+
Widget build(BuildContext context) {
23+
final l10n = AppLocalizations.of(context)!;
24+
final theme = Theme.of(context);
25+
final difficulty = CommunityDifficulty.fromCode(
26+
audioItem.communityDifficulty,
27+
);
28+
final description = audioItem.description?.trim();
29+
final metaChips = _buildMetaChips(l10n);
30+
31+
return Scaffold(
32+
appBar: AppBar(title: Text(l10n.audioDetailTitle)),
33+
body: ListView(
34+
padding: const EdgeInsets.all(AppSpacing.l),
35+
children: [
36+
Text(
37+
audioItem.name,
38+
style: theme.textTheme.headlineSmall?.copyWith(
39+
fontWeight: FontWeight.bold,
40+
),
41+
),
42+
if (metaChips.isNotEmpty) ...[
43+
const SizedBox(height: AppSpacing.s),
44+
Wrap(
45+
spacing: AppSpacing.m,
46+
runSpacing: AppSpacing.xs,
47+
children: metaChips,
48+
),
49+
],
50+
if (difficulty != null) ...[
51+
const SizedBox(height: AppSpacing.l),
52+
Row(
53+
key: const Key('audio_detail_difficulty'),
54+
children: [
55+
Text(
56+
l10n.audioDetailDifficulty,
57+
style: theme.textTheme.titleSmall?.copyWith(
58+
fontWeight: FontWeight.w600,
59+
),
60+
),
61+
const SizedBox(width: AppSpacing.s),
62+
CommunityDifficultyBadge(difficulty: difficulty),
63+
],
64+
),
65+
],
66+
const SizedBox(height: AppSpacing.l),
67+
Text(
68+
l10n.audioDetailDescription,
69+
style: theme.textTheme.titleSmall?.copyWith(
70+
fontWeight: FontWeight.w600,
71+
),
72+
),
73+
const SizedBox(height: AppSpacing.s),
74+
Text(
75+
description == null || description.isEmpty
76+
? l10n.audioDetailNoDescription
77+
: description,
78+
key: const Key('audio_detail_description'),
79+
style: theme.textTheme.bodyLarge?.copyWith(
80+
color: description == null || description.isEmpty
81+
? theme.colorScheme.onSurfaceVariant
82+
: theme.colorScheme.onSurface,
83+
),
84+
),
85+
],
86+
),
87+
);
88+
}
89+
90+
/// 时长 / 句数 / 词数标签,与学习计划页卡片的图标样式一致;没有数据时返回空列表。
91+
List<Widget> _buildMetaChips(AppLocalizations l10n) {
92+
return [
93+
if (audioItem.totalDuration > 0)
94+
AudioInfoChip(
95+
icon: Icons.timer_outlined,
96+
label: SubtitleParser.formatDuration(
97+
Duration(seconds: audioItem.totalDuration),
98+
),
99+
),
100+
if (audioItem.sentenceCount > 0)
101+
AudioInfoChip(
102+
icon: Icons.format_list_numbered,
103+
label: l10n.sentenceCountLabel(audioItem.sentenceCount),
104+
),
105+
if (audioItem.wordCount > 0)
106+
AudioInfoChip(
107+
icon: Icons.text_fields,
108+
label: l10n.wordCountLabel(audioItem.wordCount),
109+
),
110+
];
111+
}
112+
}

0 commit comments

Comments
 (0)