|
|
@ -151,6 +151,7 @@ class _UserViewState extends State<UserView> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
|
|
|
height: 10,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -195,139 +196,100 @@ class _UserViewState extends State<UserView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
|
|
///歌单
|
|
|
|
///歌单
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
'歌单 $playlistCount',
|
|
|
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
|
|
|
fontSize: 20, fontWeight: FontWeight.w500),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
_showAddPlaylistDialog();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
icon: Image.asset(
|
|
|
|
|
|
|
|
"assets/img/user_add.png",
|
|
|
|
|
|
|
|
width: 31,
|
|
|
|
|
|
|
|
color: const Color(0xff404040),
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
|
|
|
icon: Image.asset("assets/img/user_export.png",
|
|
|
|
|
|
|
|
width: 31))
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
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());
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: List.generate(playlistNames.length, (index) {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
return Dismissible(
|
|
|
|
children: [
|
|
|
|
key: Key(playlistNames[index]),
|
|
|
|
// 歌单标题行
|
|
|
|
direction: DismissDirection.endToStart,
|
|
|
|
Row(
|
|
|
|
background: Container(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
color: Colors.red,
|
|
|
|
children: [
|
|
|
|
alignment: Alignment.centerRight,
|
|
|
|
Text(
|
|
|
|
padding: const EdgeInsets.only(right: 20.0),
|
|
|
|
'歌单 $playlistCount',
|
|
|
|
child: const Icon(
|
|
|
|
style: const TextStyle(
|
|
|
|
Icons.delete,
|
|
|
|
fontSize: 20,
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: FontWeight.w500
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
confirmDismiss: (direction) async {
|
|
|
|
|
|
|
|
return await _showDeleteConfirmationDialog(
|
|
|
|
|
|
|
|
context, index);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onDismissed: (direction) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
playlistNames.removeAt(index);
|
|
|
|
|
|
|
|
playlistid.removeAt(index);
|
|
|
|
|
|
|
|
playlistCount--;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: ListTile(
|
|
|
|
|
|
|
|
title: Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
IconButton(
|
|
|
|
children: [
|
|
|
|
onPressed: () {
|
|
|
|
Image.asset("assets/img/artist_pic.png"),
|
|
|
|
_showAddPlaylistDialog();
|
|
|
|
const SizedBox(
|
|
|
|
},
|
|
|
|
width: 30,
|
|
|
|
icon: Image.asset(
|
|
|
|
),
|
|
|
|
"assets/img/user_add.png",
|
|
|
|
Column(
|
|
|
|
width: 31,
|
|
|
|
crossAxisAlignment:
|
|
|
|
color: const Color(0xff404040),
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
)
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
|
|
|
icon: Image.asset(
|
|
|
|
|
|
|
|
"assets/img/user_export.png",
|
|
|
|
|
|
|
|
width: 31
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 歌单列表
|
|
|
|
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: List.generate(
|
|
|
|
|
|
|
|
playlistNames.length,
|
|
|
|
|
|
|
|
(index) => Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
InkWell(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
print('点击成功');
|
|
|
|
|
|
|
|
Get.to(MyMusicView(songlistIdd: playlistid[index]));
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Image.asset("assets/img/artist_pic.png"),
|
|
|
|
playlistNames[index],
|
|
|
|
const SizedBox(width: 25),
|
|
|
|
style: const TextStyle(fontSize: 18),
|
|
|
|
Expanded(
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
const Text(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
'0首',
|
|
|
|
children: [
|
|
|
|
style: TextStyle(fontSize: 18),
|
|
|
|
Text(
|
|
|
|
|
|
|
|
playlistNames[index],
|
|
|
|
|
|
|
|
style: const TextStyle(fontSize: 20),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
'$playlistCount首',
|
|
|
|
|
|
|
|
style: const TextStyle(fontSize: 16),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
Image.asset("assets/img/user_next.png"),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (index < playlistNames.length - 1)
|
|
|
|
Image.asset(
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
"assets/img/user_next.png",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
),
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
const SizedBox(
|
|
|
|
height: 20,
|
|
|
|
height: 30,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
const Text(
|
|
|
|
const Text(
|
|
|
@ -463,8 +425,19 @@ class _UserViewState extends State<UserView> {
|
|
|
|
content: TextFieldColor(controller: _controller, hintText: '请输入歌单名称'),
|
|
|
|
content: TextFieldColor(controller: _controller, hintText: '请输入歌单名称'),
|
|
|
|
actions: <Widget>[
|
|
|
|
actions: <Widget>[
|
|
|
|
TextButton(
|
|
|
|
TextButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () async {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
String enteredSongName = _controller.text;
|
|
|
|
|
|
|
|
SonglistBean bean = await SonglistApi().addSonglist(
|
|
|
|
|
|
|
|
songlistName: enteredSongName,
|
|
|
|
|
|
|
|
Authorization: AppData().currentToken);
|
|
|
|
|
|
|
|
if (bean.code == 200) {
|
|
|
|
|
|
|
|
print('添加成功');
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
playlistCount++;
|
|
|
|
|
|
|
|
playlistNames.add(enteredSongName);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
@ -474,22 +447,13 @@ class _UserViewState extends State<UserView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
"取消",
|
|
|
|
"确认",
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextButton(
|
|
|
|
TextButton(
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
String enteredSongName = _controller.text;
|
|
|
|
|
|
|
|
playlistCount++;
|
|
|
|
|
|
|
|
// Add the new playlist
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
playlistNames.add(enteredSongName);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
SonglistBean bean = await SonglistApi().addSonglist(
|
|
|
|
|
|
|
|
songlistName: _controller.text,
|
|
|
|
|
|
|
|
Authorization: AppData().currentToken);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
@ -499,7 +463,7 @@ class _UserViewState extends State<UserView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
"确认",
|
|
|
|
"取消",
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|