|
|
|
@ -27,9 +27,9 @@ class UserView extends StatefulWidget {
|
|
|
|
|
class _UserViewState extends State<UserView> {
|
|
|
|
|
final homeVM = Get.put(HomeViewModel());
|
|
|
|
|
final TextEditingController _controller = TextEditingController();
|
|
|
|
|
int playlistCount = 2;
|
|
|
|
|
int playlistCount = 0;
|
|
|
|
|
List playlistNames = [];
|
|
|
|
|
List playlistid = [];
|
|
|
|
|
List<int> playlistid = [];
|
|
|
|
|
int downloadCount = 0;
|
|
|
|
|
String avatar = AppData().currentAvatar;
|
|
|
|
|
String username = AppData().currentUsername;
|
|
|
|
@ -51,7 +51,7 @@ class _UserViewState extends State<UserView> {
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
playlistNames = bean2.data!.map((data) => data.name!).toList();
|
|
|
|
|
playlistid = bean2.data!.map((data) => data.id!).toList();
|
|
|
|
|
playlistid = bean2.data!.map((data) => data.id!).toList(); // 确保这里的id是int类型
|
|
|
|
|
playlistCount = playlistNames.length;
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
@ -116,6 +116,8 @@ class _UserViewState extends State<UserView> {
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 15, right: 15, top: 20, bottom: 20),
|
|
|
|
|
|
|
|
|
|
//我的收藏
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
@ -152,6 +154,8 @@ class _UserViewState extends State<UserView> {
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
//我的收藏和本地下载分界
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () async {
|
|
|
|
|
final result = await Get.to(const MyDownloadView());
|
|
|
|
@ -220,72 +224,43 @@ class _UserViewState extends State<UserView> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
left: 15, right: 15, top: 10, bottom: 5),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset("assets/img/artist_pic.png"),
|
|
|
|
|
const Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"我的收藏",
|
|
|
|
|
style: TextStyle(fontSize: 20),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"19首",
|
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 80,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/img/user_next.png",
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset("assets/img/artist_pic.png"),
|
|
|
|
|
const Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
"本地下载",
|
|
|
|
|
style: TextStyle(fontSize: 20),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"19首",
|
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(
|
|
|
|
|
width: 80,
|
|
|
|
|
),
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/img/user_next.png",
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 10, bottom: 5),
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
shrinkWrap: true, // 使得ListView适应内容高度
|
|
|
|
|
itemCount: playlistNames.length, // 根据歌单数量动态设置itemCount
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
print('点击成功');
|
|
|
|
|
Get.to(MyMusicView(songlistIdd: playlistid[index]));
|
|
|
|
|
// 点击歌单时的回调,可以导航到歌单详情页
|
|
|
|
|
//待添加
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset("assets/img/artist_pic.png"),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
playlistNames[index], // 动态显示歌单名称
|
|
|
|
|
style: TextStyle(fontSize: 20),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'$playlistCount首', // 动态显示歌曲数量
|
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 80),
|
|
|
|
|
Image.asset("assets/img/user_next.png"),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Get.to(const MyMusicView());
|
|
|
|
@ -469,7 +444,6 @@ class _UserViewState extends State<UserView> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///弹出框--添加歌单
|
|
|
|
|
void _showAddPlaylistDialog() {
|
|
|
|
|
_controller.clear();
|
|
|
|
|