通知中心封面图显示

部分界面的信息更新
缓存系统初步引入
即将进入播放列表更新
This commit is contained in:
2026-08-25 23:09:17 +08:00
parent 0e8921742c
commit f2b4d1f46d
16 changed files with 454 additions and 161 deletions
+26 -13
View File
@@ -9,9 +9,8 @@ class GlobalMiniPlayer extends StatelessWidget {
@override
Widget build(BuildContext context) {
// ⭐ 用 Selector 监听 currentSong(低频变化
// ⭐ 使用 Selector 监听完整的 Song 对象(包括 artwork
final song = context.select<AudioService, Song?>((s) => s.currentSong);
// ⭐ 只监听播放状态(低频变化)
final isPlaying = context.select<AudioService, bool>((s) => s.isPlaying);
final bottomPadding = MediaQuery.of(context).padding.bottom;
@@ -19,12 +18,13 @@ class GlobalMiniPlayer extends StatelessWidget {
return Stack(
clipBehavior: Clip.none,
children: [
// ⭐ 背景高度从 56 改为 60
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
height: 56 + bottomPadding,
height: 60 + bottomPadding,
color: const Color(0xFF1A1F1E),
),
),
@@ -37,7 +37,7 @@ class GlobalMiniPlayer extends StatelessWidget {
bottom: Radius.circular(16),
),
child: Container(
height: 56,
height: 60, // ⭐ 从 56 改为 60
color: const Color(0xFF1A1F1E),
child: Material(
color: Colors.transparent,
@@ -52,21 +52,34 @@ class GlobalMiniPlayer extends StatelessWidget {
child: Row(
children: [
const SizedBox(width: 12),
// ⭐ 封面图容器尺寸从 40 改为 44(适配 60px 高度)
Container(
width: 40,
height: 40,
width: 44,
height: 44,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: song != null
? const Color(0xFF2A3332)
: Colors.grey[800],
borderRadius: BorderRadius.circular(4),
),
child: Icon(
song != null ? Icons.music_note : Icons.music_off,
color:
song != null ? Colors.white38 : Colors.grey[600],
size: 20,
// ⭐ 如果 song.artwork 存在,显示封面图
image: song?.artwork != null
? DecorationImage(
image: MemoryImage(song!.artwork!),
fit: BoxFit.cover,
)
: null,
),
child: song?.artwork == null
? Icon(
song != null
? Icons.music_note
: Icons.music_off,
color: song != null
? Colors.white38
: Colors.grey[600],
size: 20,
)
: null,
),
const SizedBox(width: 12),
Expanded(