Merge branch 'refs/heads/dev2'

# Conflicts:
#	pubspec.lock
master
Spark 1 week 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!,
@ -340,8 +333,13 @@ class _HomeViewState extends State<HomeView> {
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( ),
builder: (context) => StatefulBuilder( // 使StatefulBuilder便
builder: (context, setState) {
bool likesnot = false; //
return Container(
height: 210, height: 210,
padding: const EdgeInsets.only(top: 20), padding: const EdgeInsets.only(top: 20),
child: Column( child: Column(
@ -357,7 +355,7 @@ class _HomeViewState extends State<HomeView> {
icon: Image.asset("assets/img/list_add.png"), icon: Image.asset("assets/img/list_add.png"),
iconSize: 60, iconSize: 60,
), ),
const Text("加入歌单") const Text("加入歌单"),
], ],
), ),
Column( Column(
@ -367,7 +365,7 @@ class _HomeViewState extends State<HomeView> {
icon: Image.asset("assets/img/list_download.png"), icon: Image.asset("assets/img/list_download.png"),
iconSize: 60, iconSize: 60,
), ),
const Text("下载") const Text("下载"),
], ],
), ),
Column( Column(
@ -377,17 +375,17 @@ class _HomeViewState extends State<HomeView> {
icon: Image.asset("assets/img/list_collection.png"), icon: Image.asset("assets/img/list_collection.png"),
iconSize: 60, iconSize: 60,
), ),
const Text("收藏") const Text("收藏"),
], ],
), ),
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,
), ),
const Text("点赞") Text("点赞")
], ],
), ),
Column( Column(
@ -401,7 +399,7 @@ class _HomeViewState extends State<HomeView> {
icon: Image.asset("assets/img/list_comment.png"), icon: Image.asset("assets/img/list_comment.png"),
iconSize: 60, iconSize: 60,
), ),
const Text("评论") const Text("评论"),
], ],
), ),
], ],
@ -410,7 +408,17 @@ class _HomeViewState extends State<HomeView> {
height: 10, height: 10,
), ),
ElevatedButton( ElevatedButton(
onPressed: () {}, onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => MusicView(
song: songs[index],
initialSongIndex: index,
),
),
);
},
child: const Text( child: const Text(
"查看详情页", "查看详情页",
style: TextStyle(color: Colors.black, fontSize: 18), style: TextStyle(color: Colors.black, fontSize: 18),
@ -441,6 +449,9 @@ class _HomeViewState extends State<HomeView> {
), ),
], ],
), ),
)); );
},
),
);
} }
} }

@ -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(
"查看详情页", "查看详情页",

@ -409,11 +409,13 @@ class _UserViewState extends State<UserView> {
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, //
builder: (context) => Padding(
padding: const EdgeInsets.only(top: 20), padding: const EdgeInsets.only(top: 20),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, // 使Column
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Row( Row(
@ -435,9 +437,9 @@ class _UserViewState extends State<UserView> {
children: [ children: [
IconButton( IconButton(
onPressed: () async { onPressed: () async {
UniversalBean bean = await LogoutApiClient() UniversalBean bean = await LogoutApiClient().logout(
.logout( Authorization: AppData().currentToken,
Authorization: AppData().currentToken); );
if (bean.code == 200) { if (bean.code == 200) {
Get.to(const BeginView()); Get.to(const BeginView());
} }
@ -450,9 +452,7 @@ class _UserViewState extends State<UserView> {
), ),
], ],
), ),
const SizedBox( const SizedBox(height: 30),
height: 30,
),
ElevatedButton( ElevatedButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -470,9 +470,11 @@ class _UserViewState extends State<UserView> {
), ),
], ],
), ),
)); ),
);
} }
///-- ///--
void _showAddPlaylistDialog() { void _showAddPlaylistDialog() {
_controller.clear(); _controller.clear();

Loading…
Cancel
Save