Merge branch 'refs/heads/dev2'

# Conflicts:
#	pubspec.lock
master
Spark 2 weeks ago
commit b76c58a7fb

@ -0,0 +1,2 @@
#Sun Oct 27 00:29:01 HKT 2024
java.home=E\:\\Program Files\\Android\\Android Studio\\jbr

@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Oct 27 00:29:01 HKT 2024
sdk.dir=E\:\\Android\\Sdk

@ -1,11 +1,18 @@
buildscript { buildscript {
ext.kotlin_version = '1.7.10' ext.kotlin_version = '1.7.10'
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/central'}
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/spring'}
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven { url 'https://maven.aliyun.com/repository/apache-snapshots'}
google() google()
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
//
classpath 'com.android.tools.build:gradle:7.3.0' classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
@ -13,8 +20,16 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
// 使Maven
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/central'}
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/spring'}
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
maven { url 'https://maven.aliyun.com/repository/apache-snapshots'}
google() google()
mavenCentral() mavenCentral()
mavenCentral()
} }
} }

Binary file not shown.

Binary file not shown.

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip distributionUrl=file:///E:/Flutter/MusicAPP/android/gradle/wrapper/gradle-7.5-all.zip

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -12,6 +12,8 @@ import '../common_widget/Song_widegt.dart';
import '../common_widget/list_cell.dart'; import '../common_widget/list_cell.dart';
import '../models/getMusicList_bean.dart'; import '../models/getMusicList_bean.dart';
import 'music_view.dart'; import 'music_view.dart';
import '../api/api_music_likes.dart'; // API
import '../models/universal_bean.dart';
class HomeView extends StatefulWidget { class HomeView extends StatefulWidget {
const HomeView({super.key}); const HomeView({super.key});
@ -42,15 +44,6 @@ class _HomeViewState extends State<HomeView> {
setState(() { setState(() {
songs = [ 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( Song(
artistPic: bean2.coverPath!, artistPic: bean2.coverPath!,
title: bean2.name!, title: bean2.name!,
@ -337,110 +330,128 @@ class _HomeViewState extends State<HomeView> {
Future _bottomSheet(BuildContext context, int index) { Future _bottomSheet(BuildContext context, int index) {
return showModalBottomSheet( return showModalBottomSheet(
context: context, context: context,
backgroundColor: Colors.white, backgroundColor: Colors.white,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(30))), borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
builder: (context) => Container( ),
height: 210, builder: (context) => StatefulBuilder( // 使StatefulBuilder便
padding: const EdgeInsets.only(top: 20), builder: (context, setState) {
child: Column( bool likesnot = false; //
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ return Container(
Row( height: 210,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, padding: const EdgeInsets.only(top: 20),
children: [ child: Column(
Column( crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
IconButton( Row(
onPressed: () {}, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
icon: Image.asset("assets/img/list_add.png"), children: [
iconSize: 60, Column(
), children: [
const Text("加入歌单") IconButton(
], onPressed: () {},
), icon: Image.asset("assets/img/list_add.png"),
Column( iconSize: 60,
children: [ ),
IconButton( const Text("加入歌单"),
onPressed: () {}, ],
icon: Image.asset("assets/img/list_download.png"), ),
iconSize: 60, Column(
), children: [
const Text("下载") IconButton(
], onPressed: () {},
), icon: Image.asset("assets/img/list_download.png"),
Column( iconSize: 60,
children: [ ),
IconButton( const Text("下载"),
onPressed: () {}, ],
icon: Image.asset("assets/img/list_collection.png"), ),
iconSize: 60, Column(
), children: [
const Text("收藏") IconButton(
], onPressed: () {},
), icon: Image.asset("assets/img/list_collection.png"),
Column( iconSize: 60,
children: [ ),
IconButton( const Text("收藏"),
onPressed: () {}, ],
icon: Image.asset("assets/img/list_good.png"), ),
iconSize: 60, Column(
children: [
IconButton(
onPressed: (){},
icon: Image.asset("assets/img/list_good.png"),
iconSize: 60,
),
Text("点赞")
],
),
Column(
children: [
IconButton(
onPressed: () {
Get.to(() => CommentView(
initialSongIndex: index,
));
},
icon: Image.asset("assets/img/list_comment.png"),
iconSize: 60,
),
const Text("评论"),
],
),
],
),
const SizedBox(
height: 10,
),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MusicView(
song: songs[index],
initialSongIndex: index,
),
), ),
const Text("点赞") );
], },
child: const Text(
"查看详情页",
style: TextStyle(color: Colors.black, fontSize: 18),
), ),
Column( style: ElevatedButton.styleFrom(
children: [ backgroundColor: const Color(0xffE6F4F1),
IconButton( padding: const EdgeInsets.symmetric(vertical: 8),
onPressed: () { tapTargetSize: MaterialTapTargetSize.shrinkWrap,
Get.to(() => CommentView( shape: const RoundedRectangleBorder(
initialSongIndex: index, borderRadius: BorderRadius.zero,
)); ),
},
icon: Image.asset("assets/img/list_comment.png"),
iconSize: 60,
),
const Text("评论")
],
), ),
],
),
const SizedBox(
height: 10,
),
ElevatedButton(
onPressed: () {},
child: const Text(
"查看详情页",
style: TextStyle(color: Colors.black, fontSize: 18),
), ),
style: ElevatedButton.styleFrom( ElevatedButton(
backgroundColor: const Color(0xffE6F4F1), onPressed: () => Navigator.pop(context),
padding: const EdgeInsets.symmetric(vertical: 8), style: ElevatedButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap, backgroundColor: const Color(0xff429482),
shape: const RoundedRectangleBorder( padding: const EdgeInsets.symmetric(vertical: 8),
borderRadius: BorderRadius.zero, tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
), ),
), child: const Text(
), "取消",
ElevatedButton( style: TextStyle(color: Colors.black, fontSize: 18),
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xff429482),
padding: const EdgeInsets.symmetric(vertical: 8),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
), ),
), ),
child: const Text( ],
"取消", ),
style: TextStyle(color: Colors.black, fontSize: 18), );
), },
), ),
], );
),
));
} }
} }

@ -5,6 +5,8 @@ import '../api/api_music_rank.dart';
import '../common_widget/rank_song_row.dart'; import '../common_widget/rank_song_row.dart';
import '../models/getRank_bean.dart'; import '../models/getRank_bean.dart';
import '../view_model/rank_view_model.dart'; import '../view_model/rank_view_model.dart';
import 'music_view.dart';
import '../common_widget/Song_widegt.dart';
class RankView extends StatefulWidget { class RankView extends StatefulWidget {
const RankView({super.key}); const RankView({super.key});
@ -19,6 +21,7 @@ class _RankViewState extends State<RankView> {
List rankSingerName = []; List rankSingerName = [];
List rankCoverPath = []; List rankCoverPath = [];
List rankMusicPath = []; List rankMusicPath = [];
List<Song> songs = [];
void initState() { void initState() {
super.initState(); super.initState();
@ -32,6 +35,24 @@ class _RankViewState extends State<RankView> {
rankSingerName = bean2.data!.map((data) => data.singerName!).toList(); rankSingerName = bean2.data!.map((data) => data.singerName!).toList();
rankCoverPath = bean2.data!.map((data) => data.coverPath!).toList(); rankCoverPath = bean2.data!.map((data) => data.coverPath!).toList();
rankMusicPath = bean2.data!.map((data) => data.musicPath!).toList(); rankMusicPath = bean2.data!.map((data) => data.musicPath!).toList();
if (rankNames.isNotEmpty &&
rankNames.length == rankSingerName.length &&
rankNames.length == rankCoverPath.length &&
rankNames.length == rankMusicPath.length) {
for (int i = 0; i < rankNames.length; i++) {
songs.add(Song(
artistPic: rankCoverPath[i],
title: rankNames[i],
artist: rankSingerName[i],
musicurl: rankMusicPath[i],
pic: rankCoverPath[i],
id: i,
likes: false,
collection: false,
));
}
}
}); });
} }
@ -132,6 +153,17 @@ class _RankViewState extends State<RankView> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
int rankNum = index + 1; int rankNum = index + 1;
return ListTile( return ListTile(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MusicView(
song: songs[index],
initialSongIndex: index,
),
),
);
},
title: Column( title: Column(
children: [ children: [
Row( Row(
@ -202,12 +234,16 @@ class _RankViewState extends State<RankView> {
), ),
IconButton( IconButton(
onPressed: () { onPressed: () {
_bottomSheet(context); _bottomSheet(context, index); // index
}, },
icon: Image.asset( icon: Image.asset(
"assets/img/More.png", 'assets/img/More.png',
width: 25, width: 25,
height: 25, height: 25,
errorBuilder: (context, error, stackTrace) {
print('Error loading image: $error');
return const Icon(Icons.error, size: 25); // 使 const
},
), ),
), ),
const SizedBox( const SizedBox(
@ -231,7 +267,7 @@ class _RankViewState extends State<RankView> {
), ),
); );
} }
Future _bottomSheet(BuildContext context){ Future _bottomSheet(BuildContext context, int index){
return showModalBottomSheet( return showModalBottomSheet(
context: context, context: context,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -300,7 +336,15 @@ class _RankViewState extends State<RankView> {
const SizedBox(height: 10,), const SizedBox(height: 10,),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
// Get.to(()=>const MainTabView()); Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MusicView(
song: songs[index],
initialSongIndex: index,
),
),
);
}, },
child: Text( child: Text(
"查看详情页", "查看详情页",

@ -406,73 +406,75 @@ class _UserViewState extends State<UserView> {
///--退 ///--退
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( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(30))), borderRadius: BorderRadius.vertical(top: Radius.circular(30)),
builder: (context) => Container( ),
height: 200, isScrollControlled: true, //
padding: const EdgeInsets.only(top: 20), builder: (context) => Padding(
child: Column( padding: const EdgeInsets.only(top: 20),
crossAxisAlignment: CrossAxisAlignment.stretch, child: Column(
children: [ mainAxisSize: MainAxisSize.min, // 使Column
Row( crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
children: [ Row(
Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
IconButton( Column(
onPressed: () { children: [
Get.to(const UserInfo()); IconButton(
}, onPressed: () {
icon: Image.asset("assets/img/user_infor.png"), Get.to(const UserInfo());
iconSize: 60, },
), icon: Image.asset("assets/img/user_infor.png"),
const Text("账户信息") iconSize: 60,
],
),
Column(
children: [
IconButton(
onPressed: () async {
UniversalBean bean = await LogoutApiClient()
.logout(
Authorization: AppData().currentToken);
if (bean.code == 200) {
Get.to(const BeginView());
}
},
icon: Image.asset("assets/img/user_out.png"),
iconSize: 60,
),
const Text("退出登录")
],
),
],
),
const SizedBox(
height: 30,
),
ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xff429482),
padding: const EdgeInsets.symmetric(vertical: 14),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
), ),
child: const Text( const Text("账户信息")
"取消", ],
style: TextStyle(color: Colors.black, fontSize: 18), ),
Column(
children: [
IconButton(
onPressed: () async {
UniversalBean bean = await LogoutApiClient().logout(
Authorization: AppData().currentToken,
);
if (bean.code == 200) {
Get.to(const BeginView());
}
},
icon: Image.asset("assets/img/user_out.png"),
iconSize: 60,
), ),
), const Text("退出登录")
], ],
),
],
),
const SizedBox(height: 30),
ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xff429482),
padding: const EdgeInsets.symmetric(vertical: 14),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
), ),
)); child: const Text(
"取消",
style: TextStyle(color: Colors.black, fontSize: 18),
),
),
],
),
),
);
} }
///-- ///--
void _showAddPlaylistDialog() { void _showAddPlaylistDialog() {
_controller.clear(); _controller.clear();

Loading…
Cancel
Save