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