fix(ui): 收藏列表文件名解码,避免显示成百分号编码串

收藏项没有元数据时回退文件名,但 path 是百分号编码的播放路径,
直接截取会显示 "13%E6%A5%BC%E7%9A%84..." 这种不可读内容。
- 展示前对文件名做 Uri.decodeComponent,解码失败才用原串
- 播放仍使用编码后的原 path,不受影响

验证:收藏 "13楼的大笨象 - 郑融" 在首页正常显示中文歌名。
This commit is contained in:
2026-10-24 21:42:01 +08:00
parent c1e720311e
commit d3ed871626
+12 -1
View File
@@ -261,9 +261,20 @@ class _HomePageState extends BaseState<HomePage> {
final title = (row?['title'] as String?)?.trim() ?? ''; final title = (row?['title'] as String?)?.trim() ?? '';
final artist = (row?['artist'] as String?)?.trim() ?? ''; final artist = (row?['artist'] as String?)?.trim() ?? '';
final hasTitle = title.isNotEmpty; final hasTitle = title.isNotEmpty;
// path 是百分号编码的(播放时必须保持),显示前要解码,
// 否则没有元数据的收藏会显示成 "13%E6%A5%BC..." 这种不可读串。
final rawName = path.split('/').last;
String displayName;
try {
displayName = Uri.decodeComponent(rawName);
} catch (_) {
displayName = rawName;
}
items.add(SongItem( items.add(SongItem(
path: path, path: path,
fileName: path.split('/').last, fileName: displayName,
title: hasTitle ? title : null, title: hasTitle ? title : null,
artist: artist.isNotEmpty ? artist : null, artist: artist.isNotEmpty ? artist : null,
sourceTag: '收藏', sourceTag: '收藏',