|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:music_player_miao/common_widget/app_data.dart';
|
|
|
|
import 'package:music_player_miao/common_widget/app_data.dart';
|
|
|
|
import '../api/api_music_rank.dart';
|
|
|
|
import '../api/api_music_rank.dart';
|
|
|
|
import '../common_widget/rank_song_row.dart';
|
|
|
|
import '../common/download_manager.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 'music_view.dart';
|
|
|
@ -23,6 +23,8 @@ class _RankViewState extends State<RankView> {
|
|
|
|
List rankMusicPath = [];
|
|
|
|
List rankMusicPath = [];
|
|
|
|
List<Song> songs = [];
|
|
|
|
List<Song> songs = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final downloadManager = Get.put(DownloadManager());
|
|
|
|
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
_fetchSonglistData();
|
|
|
|
_fetchSonglistData();
|
|
|
@ -158,8 +160,16 @@ class _RankViewState extends State<RankView> {
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
MaterialPageRoute(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) => MusicView(
|
|
|
|
builder: (context) => MusicView(
|
|
|
|
song: songs[index],
|
|
|
|
songList: songs,
|
|
|
|
initialSongIndex: index,
|
|
|
|
initialSongIndex: index,
|
|
|
|
|
|
|
|
onSongStatusChanged: (index, isCollected, isLiked) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
// 更新父组件中的数据
|
|
|
|
|
|
|
|
songs[index].collection = isCollected;
|
|
|
|
|
|
|
|
songs[index].likes = isLiked;
|
|
|
|
|
|
|
|
downloadManager.updateSongInfo(songs[index].id, isCollected, isLiked);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -228,7 +238,7 @@ class _RankViewState extends State<RankView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
const SizedBox(
|
|
|
|
width: 20,
|
|
|
|
width: 18,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -273,7 +283,7 @@ class _RankViewState extends State<RankView> {
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(30))),
|
|
|
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(30))),
|
|
|
|
builder: (context) =>Container(
|
|
|
|
builder: (context) =>Container(
|
|
|
|
height: 210,
|
|
|
|
height: 150,
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
@ -333,49 +343,6 @@ class _RankViewState extends State<RankView> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 10,),
|
|
|
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => MusicView(
|
|
|
|
|
|
|
|
song: songs[index],
|
|
|
|
|
|
|
|
initialSongIndex: index,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
"查看详情页",
|
|
|
|
|
|
|
|
style: const TextStyle(color:Colors.black,fontSize: 18),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
backgroundColor: const Color(0xffE6F4F1),
|
|
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
|
|
|
|
|
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.zero,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
|
|
|
onPressed: () =>Navigator.pop(context),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
"取消",
|
|
|
|
|
|
|
|
style: const TextStyle(color:Colors.black,fontSize: 18),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
backgroundColor: const Color(0xff429482),
|
|
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
|
|
|
|
|
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.zero,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|