From d3ed8716266bcf385fa9c49cc3f0cef6d135128e Mon Sep 17 00:00:00 2001 From: lxh2875931338 Date: Sat, 24 Oct 2026 21:42:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E6=94=B6=E8=97=8F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E8=A7=A3=E7=A0=81=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E6=98=BE=E7=A4=BA=E6=88=90=E7=99=BE=E5=88=86=E5=8F=B7?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 收藏项没有元数据时回退文件名,但 path 是百分号编码的播放路径, 直接截取会显示 "13%E6%A5%BC%E7%9A%84..." 这种不可读内容。 - 展示前对文件名做 Uri.decodeComponent,解码失败才用原串 - 播放仍使用编码后的原 path,不受影响 验证:收藏 "13楼的大笨象 - 郑融" 在首页正常显示中文歌名。 --- lib/pages/home_page.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 56ee7c7..678676e 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -261,9 +261,20 @@ class _HomePageState extends BaseState { final title = (row?['title'] as String?)?.trim() ?? ''; final artist = (row?['artist'] as String?)?.trim() ?? ''; 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( path: path, - fileName: path.split('/').last, + fileName: displayName, title: hasTitle ? title : null, artist: artist.isNotEmpty ? artist : null, sourceTag: '收藏',