import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../models/song_model.dart'; import '../services/audio_service.dart'; import '../widgets/full_player_page.dart'; class PlaylistPage extends StatelessWidget { const PlaylistPage({super.key}); @override Widget build(BuildContext context) { final songs = Song.placeholderSongs; // 后续替换成 WebDAV/SAF 列表 return Scaffold( appBar: AppBar( title: const Text('我的清听'), actions: [ IconButton( icon: const Icon(Icons.shuffle), onPressed: () {}, // 以后实现随机 ), ], ), body: ListView.builder( padding: const EdgeInsets.symmetric(vertical: 8), itemCount: songs.length, itemBuilder: (context, index) { final song = songs[index]; return ListTile( leading: const CircleAvatar( backgroundColor: Color(0xFF2A3332), child: Icon(Icons.audiotrack, size: 20, color: Colors.white54), ), title: Text(song.title, style: const TextStyle(fontWeight: FontWeight.w500)), subtitle: Text(song.artist, style: TextStyle(color: Colors.grey[400], fontSize: 13)), trailing: const Icon(Icons.more_vert, color: Colors.grey), onTap: () { // 1. 先更新服务,显示迷你条 context.read().playSong(song); // 2. 再跳转全屏播放器 Navigator.push( context, MaterialPageRoute(builder: (_) => const FullPlayerPage()), ); }, ); }, ), ); } }