|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../common_widget/app_data.dart';
|
|
|
|
import '../../common_widget/app_data.dart';
|
|
|
@ -13,20 +12,21 @@ List<T> flatten<T>(Iterable<Iterable<T>> iterable) {
|
|
|
|
|
|
|
|
|
|
|
|
class MyMusicView extends StatefulWidget {
|
|
|
|
class MyMusicView extends StatefulWidget {
|
|
|
|
final int? songlistIdd;
|
|
|
|
final int? songlistIdd;
|
|
|
|
|
|
|
|
|
|
|
|
const MyMusicView({Key? key, this.songlistIdd}) : super(key: key);
|
|
|
|
const MyMusicView({Key? key, this.songlistIdd}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
State<MyMusicView> createState() => _MyMusicViewState();
|
|
|
|
State<MyMusicView> createState() => _MyMusicViewState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
|
|
|
|
|
|
|
|
int songsNum = 0;
|
|
|
|
int songsNum = 0;
|
|
|
|
List songlistId =[];
|
|
|
|
List songlistId = [];
|
|
|
|
List musicDetail = [];
|
|
|
|
List musicDetail = [];
|
|
|
|
List name = [];
|
|
|
|
List name = [];
|
|
|
|
List coverPath = [];
|
|
|
|
List coverPath = [];
|
|
|
|
List musicPath = [];
|
|
|
|
List musicPath = [];
|
|
|
|
List singerName =[];
|
|
|
|
List singerName = [];
|
|
|
|
List uploadUserName = [];
|
|
|
|
List uploadUserName = [];
|
|
|
|
|
|
|
|
|
|
|
|
final listVM = Get.put(HomeViewModel());
|
|
|
|
final listVM = Get.put(HomeViewModel());
|
|
|
@ -34,7 +34,6 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
final List<bool> _mySongListSelections = List.generate(2, (index) => false);
|
|
|
|
final List<bool> _mySongListSelections = List.generate(2, (index) => false);
|
|
|
|
List<bool> _selectedItems = List.generate(10, (index) => false);
|
|
|
|
List<bool> _selectedItems = List.generate(10, (index) => false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改从这开始
|
|
|
|
//修改从这开始
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
@ -86,8 +85,8 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
print('Error fetching myworks data: $error');
|
|
|
|
print('Error fetching myworks data: $error');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//在这里结束
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//在这里结束
|
|
|
|
|
|
|
|
|
|
|
|
void _toggleSelectMode() {
|
|
|
|
void _toggleSelectMode() {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
@ -110,21 +109,20 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return AlertDialog(
|
|
|
|
return AlertDialog(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius:BorderRadius.circular(10),
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Row(
|
|
|
|
title: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
const Text("添加到",),
|
|
|
|
const Text(
|
|
|
|
|
|
|
|
"添加到",
|
|
|
|
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
'(${_selectedItems.where((item) => item).length} 首)',
|
|
|
|
'(${_selectedItems.where((item) => item).length} 首)',
|
|
|
|
style: const TextStyle(
|
|
|
|
style: const TextStyle(color: Color(0xff429482), fontSize: 16),
|
|
|
|
color: Color(0xff429482),
|
|
|
|
|
|
|
|
fontSize: 16
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
content:SingleChildScrollView(
|
|
|
|
content: SingleChildScrollView(
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
@ -151,8 +149,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextButton(
|
|
|
|
TextButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {},
|
|
|
|
},
|
|
|
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
minimumSize: const Size(130, 50),
|
|
|
|
minimumSize: const Size(130, 50),
|
|
|
@ -192,7 +189,6 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
@ -209,7 +205,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
centerTitle: true,
|
|
|
|
centerTitle: true,
|
|
|
|
elevation: 0,
|
|
|
|
elevation: 0,
|
|
|
|
leading: !_isSelectMode
|
|
|
|
leading: !_isSelectMode
|
|
|
|
?IconButton(
|
|
|
|
? IconButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
Get.back(result: true);
|
|
|
|
Get.back(result: true);
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -224,8 +220,14 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
onPressed: _selectAll,
|
|
|
|
onPressed: _selectAll,
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
foregroundColor: Colors.black,
|
|
|
|
foregroundColor: Colors.black,
|
|
|
|
|
|
|
|
minimumSize: const Size(50, 40), // 设置最小宽度,确保文字有足够空间
|
|
|
|
|
|
|
|
padding:
|
|
|
|
|
|
|
|
const EdgeInsets.symmetric(horizontal: 8), // 添加水平内边距
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: const Text(
|
|
|
|
|
|
|
|
'全选',
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: const Text('全选',style: TextStyle(fontSize: 18),),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: _isSelectMode
|
|
|
|
title: _isSelectMode
|
|
|
|
? Text(
|
|
|
|
? Text(
|
|
|
@ -241,7 +243,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
actions: [
|
|
|
|
actions: [
|
|
|
|
if (_isSelectMode)
|
|
|
|
if (_isSelectMode)
|
|
|
|
TextButton(
|
|
|
|
TextButton(
|
|
|
|
onPressed: (){
|
|
|
|
onPressed: () {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
_isSelectMode = false;
|
|
|
|
_isSelectMode = false;
|
|
|
|
_selectedItems = List.generate(10, (index) => false);
|
|
|
|
_selectedItems = List.generate(10, (index) => false);
|
|
|
@ -249,12 +251,8 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
"完成",
|
|
|
|
"完成",
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 18),
|
|
|
|
color: Colors.black,
|
|
|
|
))
|
|
|
|
fontSize: 18
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: Container(
|
|
|
|
body: Container(
|
|
|
@ -271,7 +269,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){},
|
|
|
|
onPressed: () {},
|
|
|
|
icon: Image.asset(
|
|
|
|
icon: Image.asset(
|
|
|
|
"assets/img/button_play.png",
|
|
|
|
"assets/img/button_play.png",
|
|
|
|
width: 20,
|
|
|
|
width: 20,
|
|
|
@ -280,16 +278,14 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Text(
|
|
|
|
const Text(
|
|
|
|
'播放全部',
|
|
|
|
'播放全部',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
fontSize: 16
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
width: 5,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(width: 5,),
|
|
|
|
|
|
|
|
const Text(
|
|
|
|
const Text(
|
|
|
|
'50',
|
|
|
|
'50',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(fontSize: 16),
|
|
|
|
fontSize: 16
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -324,10 +320,14 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
activeColor: const Color(0xff429482),
|
|
|
|
activeColor: const Color(0xff429482),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: CircleAvatar(
|
|
|
|
: CircleAvatar(
|
|
|
|
backgroundImage: NetworkImage(coverPath[index]), // 假设封面路径是网络资源
|
|
|
|
backgroundImage:
|
|
|
|
|
|
|
|
NetworkImage(coverPath[index]),
|
|
|
|
|
|
|
|
// 假设封面路径是网络资源
|
|
|
|
radius: 25,
|
|
|
|
radius: 25,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
title: Text('${name[index]} - ${singerName[index]}'), // 显示歌曲名和歌手名
|
|
|
|
title:
|
|
|
|
|
|
|
|
Text('${name[index]} - ${singerName[index]}'),
|
|
|
|
|
|
|
|
// 显示歌曲名和歌手名
|
|
|
|
trailing: _isSelectMode
|
|
|
|
trailing: _isSelectMode
|
|
|
|
? null
|
|
|
|
? null
|
|
|
|
: IconButton(
|
|
|
|
: IconButton(
|
|
|
@ -344,7 +344,6 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
bottomNavigationBar: _isSelectMode
|
|
|
|
bottomNavigationBar: _isSelectMode
|
|
|
|
? BottomAppBar(
|
|
|
|
? BottomAppBar(
|
|
|
|
child: SizedBox(
|
|
|
|
child: SizedBox(
|
|
|
@ -358,7 +357,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){
|
|
|
|
onPressed: () {
|
|
|
|
_showSelectionDialog();
|
|
|
|
_showSelectionDialog();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
icon: Image.asset("assets/img/list_add.png"),
|
|
|
|
icon: Image.asset("assets/img/list_add.png"),
|
|
|
@ -375,8 +374,9 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){},
|
|
|
|
onPressed: () {},
|
|
|
|
icon: Image.asset("assets/img/list_download.png"),
|
|
|
|
icon:
|
|
|
|
|
|
|
|
Image.asset("assets/img/list_download.png"),
|
|
|
|
iconSize: 60,
|
|
|
|
iconSize: 60,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const Text("下载"),
|
|
|
|
const Text("下载"),
|
|
|
@ -388,7 +388,8 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
_isSelectMode = false;
|
|
|
|
_isSelectMode = false;
|
|
|
|
_selectedItems = List.generate(10, (index) => false);
|
|
|
|
_selectedItems =
|
|
|
|
|
|
|
|
List.generate(10, (index) => false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
@ -399,11 +400,10 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
borderRadius: BorderRadius.zero,
|
|
|
|
borderRadius: BorderRadius.zero,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: const Text('取消',
|
|
|
|
child: const Text(
|
|
|
|
style: TextStyle(
|
|
|
|
'取消',
|
|
|
|
color: Colors.black,
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 16),
|
|
|
|
fontSize: 16
|
|
|
|
),
|
|
|
|
),),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -413,12 +413,14 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Future _bottomSheet(BuildContext context){
|
|
|
|
|
|
|
|
|
|
|
|
Future _bottomSheet(BuildContext context) {
|
|
|
|
return showModalBottomSheet(
|
|
|
|
return showModalBottomSheet(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(30))),
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
builder: (context) =>Container(
|
|
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(30))),
|
|
|
|
|
|
|
|
builder: (context) => Container(
|
|
|
|
height: 210,
|
|
|
|
height: 210,
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
@ -430,7 +432,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){},
|
|
|
|
onPressed: () {},
|
|
|
|
icon: Image.asset("assets/img/list_remove.png"),
|
|
|
|
icon: Image.asset("assets/img/list_remove.png"),
|
|
|
|
iconSize: 60,
|
|
|
|
iconSize: 60,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -440,7 +442,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){},
|
|
|
|
onPressed: () {},
|
|
|
|
icon: Image.asset("assets/img/list_download.png"),
|
|
|
|
icon: Image.asset("assets/img/list_download.png"),
|
|
|
|
iconSize: 60,
|
|
|
|
iconSize: 60,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -450,7 +452,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){},
|
|
|
|
onPressed: () {},
|
|
|
|
icon: Image.asset("assets/img/list_collection.png"),
|
|
|
|
icon: Image.asset("assets/img/list_collection.png"),
|
|
|
|
iconSize: 60,
|
|
|
|
iconSize: 60,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -460,7 +462,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){},
|
|
|
|
onPressed: () {},
|
|
|
|
icon: Image.asset("assets/img/list_good.png"),
|
|
|
|
icon: Image.asset("assets/img/list_good.png"),
|
|
|
|
iconSize: 60,
|
|
|
|
iconSize: 60,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -470,7 +472,7 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
Column(
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){},
|
|
|
|
onPressed: () {},
|
|
|
|
icon: Image.asset("assets/img/list_comment.png"),
|
|
|
|
icon: Image.asset("assets/img/list_comment.png"),
|
|
|
|
iconSize: 60,
|
|
|
|
iconSize: 60,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -479,7 +481,9 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 10,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
ElevatedButton(
|
|
|
|
ElevatedButton(
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
// Get.to(()=>const MusicView());
|
|
|
|
// Get.to(()=>const MusicView());
|
|
|
@ -494,12 +498,11 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
"查看详情页",
|
|
|
|
"查看详情页",
|
|
|
|
style: TextStyle(color:Colors.black,fontSize: 18),
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 18),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
ElevatedButton(
|
|
|
|
ElevatedButton(
|
|
|
|
onPressed: () =>Navigator.pop(context),
|
|
|
|
onPressed: () => Navigator.pop(context),
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
|
@ -510,17 +513,11 @@ class _MyMusicViewState extends State<MyMusicView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
"取消",
|
|
|
|
"取消",
|
|
|
|
style: TextStyle(color:Colors.black,fontSize: 18),
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 18),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|