|
|
|
@ -12,6 +12,8 @@ import '../common_widget/Song_widegt.dart';
|
|
|
|
|
import '../common_widget/list_cell.dart';
|
|
|
|
|
import '../models/getMusicList_bean.dart';
|
|
|
|
|
import 'music_view.dart';
|
|
|
|
|
import '../api/api_music_likes.dart'; // 导入点赞API文件
|
|
|
|
|
import '../models/universal_bean.dart';
|
|
|
|
|
|
|
|
|
|
class HomeView extends StatefulWidget {
|
|
|
|
|
const HomeView({super.key});
|
|
|
|
@ -42,15 +44,6 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
songs = [
|
|
|
|
|
Song(
|
|
|
|
|
artistPic: bean1.coverPath!,
|
|
|
|
|
title: bean1.name!,
|
|
|
|
|
artist: bean1.singerName!,
|
|
|
|
|
musicurl: bean1.musicPath!,
|
|
|
|
|
pic: bean1.coverPath!,
|
|
|
|
|
id: bean1.id!,
|
|
|
|
|
likes: bean1.likeOrNot!,
|
|
|
|
|
collection: bean1.collectOrNot!),
|
|
|
|
|
Song(
|
|
|
|
|
artistPic: bean2.coverPath!,
|
|
|
|
|
title: bean2.name!,
|
|
|
|
@ -340,8 +333,13 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
context: context,
|
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(30))),
|
|
|
|
|
builder: (context) => Container(
|
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
|
|
|
|
|
),
|
|
|
|
|
builder: (context) => StatefulBuilder( // 使用StatefulBuilder以便动态修改状态
|
|
|
|
|
builder: (context, setState) {
|
|
|
|
|
bool likesnot = false; // 初始状态,假设未点赞
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
height: 210,
|
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
|
child: Column(
|
|
|
|
@ -357,7 +355,7 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
icon: Image.asset("assets/img/list_add.png"),
|
|
|
|
|
iconSize: 60,
|
|
|
|
|
),
|
|
|
|
|
const Text("加入歌单")
|
|
|
|
|
const Text("加入歌单"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
@ -367,7 +365,7 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
icon: Image.asset("assets/img/list_download.png"),
|
|
|
|
|
iconSize: 60,
|
|
|
|
|
),
|
|
|
|
|
const Text("下载")
|
|
|
|
|
const Text("下载"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
@ -377,17 +375,17 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
icon: Image.asset("assets/img/list_collection.png"),
|
|
|
|
|
iconSize: 60,
|
|
|
|
|
),
|
|
|
|
|
const Text("收藏")
|
|
|
|
|
const Text("收藏"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
onPressed: (){},
|
|
|
|
|
icon: Image.asset("assets/img/list_good.png"),
|
|
|
|
|
iconSize: 60,
|
|
|
|
|
),
|
|
|
|
|
const Text("点赞")
|
|
|
|
|
Text("点赞")
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
@ -401,7 +399,7 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
icon: Image.asset("assets/img/list_comment.png"),
|
|
|
|
|
iconSize: 60,
|
|
|
|
|
),
|
|
|
|
|
const Text("评论")
|
|
|
|
|
const Text("评论"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -410,7 +408,17 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => MusicView(
|
|
|
|
|
song: songs[index],
|
|
|
|
|
initialSongIndex: index,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: const Text(
|
|
|
|
|
"查看详情页",
|
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 18),
|
|
|
|
@ -441,6 +449,9 @@ class _HomeViewState extends State<HomeView> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|