修复bug
This commit is contained in:
parent
db53f60925
commit
21030681a2
@ -44,7 +44,16 @@ class CreatePlaylistDialog extends Dialog {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 19.h),
|
||||
SizedBox(height: 4.h),
|
||||
Text(
|
||||
'Enter up to 60 characters',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
Container(
|
||||
height: 30.h,
|
||||
alignment: Alignment.center,
|
||||
@ -64,7 +73,7 @@ class CreatePlaylistDialog extends Dialog {
|
||||
keyboardType: TextInputType.text,
|
||||
style: TextStyle(color: Colors.white, fontSize: 15.sp),
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
maxLength: 30,
|
||||
maxLength: 60,
|
||||
decoration: InputDecoration(
|
||||
counterText: '',
|
||||
hintText: 'My playlist1',
|
||||
@ -78,7 +87,7 @@ class CreatePlaylistDialog extends Dialog {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 19.h),
|
||||
SizedBox(height: 16.h),
|
||||
DividerWidget(
|
||||
height: 0.5.h,
|
||||
color: const Color(0xA6545458),
|
||||
@ -114,11 +123,9 @@ class CreatePlaylistDialog extends Dialog {
|
||||
onTap: () {
|
||||
if (isConfirm) {
|
||||
if (ObjUtil.isNotEmpty(_textEditingController.text)) {
|
||||
onTap(_textEditingController.text);
|
||||
} else {
|
||||
onTap('My playlist1');
|
||||
}
|
||||
Get.back();
|
||||
onTap(_textEditingController.text);
|
||||
}
|
||||
} else {
|
||||
Get.back();
|
||||
}
|
||||
|
||||
2
lib/data/cache/music_cache_manager.dart
vendored
2
lib/data/cache/music_cache_manager.dart
vendored
@ -10,7 +10,7 @@ class MusicCacheManager {
|
||||
Config(
|
||||
key,
|
||||
stalePeriod: const Duration(days: 7),
|
||||
maxNrOfCacheObjects: 20,
|
||||
maxNrOfCacheObjects: 30,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ class MusicBox {
|
||||
Future<void> putSearchHistory(String history) async {
|
||||
var historyList = getAllSearchHistory();
|
||||
if (!historyList.contains(history)) {
|
||||
if (historyList.length >= 9) {
|
||||
if (historyList.length >= 10) {
|
||||
historyList.removeLast();
|
||||
}
|
||||
historyList.insert(0, history);
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:tone_snap/ads/app_open_ad_manager.dart';
|
||||
@ -14,7 +12,6 @@ import 'package:tone_snap/global/app_config.dart';
|
||||
import 'package:tone_snap/global/app_lifecycle_reactor.dart';
|
||||
import 'package:tone_snap/global/network_connectivity_service.dart';
|
||||
import 'package:tone_snap/modules/sideb/controllers/main_controller.dart';
|
||||
import 'package:tone_snap/res/themes/app_themes.dart';
|
||||
import 'package:tone_snap/routes/app_routes.dart';
|
||||
import 'package:tone_snap/utils/log_util.dart';
|
||||
|
||||
|
||||
@ -137,11 +137,17 @@ class AlbumSongListController extends GetxController {
|
||||
}
|
||||
|
||||
/// 点击播放全部歌曲
|
||||
Future<void> onTapPlayAll() async {
|
||||
Future<void> onTapPlayAll(int type) async {
|
||||
if (musicList.isNotEmpty) {
|
||||
final randomNumber = NumUtil.getRandomNumber(0, musicList.length);
|
||||
List<MusicModel> playList = await _next(musicList[randomNumber].value.videoId, playlistId: musicList[randomNumber].value.playlistId);
|
||||
musicPlayerController.playMusic(playList[randomNumber].videoId, playList: playList);
|
||||
int index = 0;
|
||||
if (type == 1) {
|
||||
if (musicPlayerController.getMusicModel() != null) {
|
||||
int currentIndex = musicList.indexWhere((e) => e.value.videoId == musicPlayerController.getMusicModel()!.value.videoId);
|
||||
index = NumUtil.getRandomNumberExcludingCurrent(0, musicList.length, currentIndex);
|
||||
}
|
||||
}
|
||||
List<MusicModel> playList = await _next(musicList[index].value.videoId, playlistId: musicList[index].value.playlistId);
|
||||
musicPlayerController.playMusic(playList[index].videoId, playList: playList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,18 +22,20 @@ class AlbumSongListView extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF121212),
|
||||
body: Stack(
|
||||
children: [
|
||||
_buildPageBgImg(),
|
||||
Column(
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 413.h,
|
||||
child: Column(
|
||||
child: Stack(
|
||||
children: [
|
||||
_buildPageBgImg(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const MusicAppbar(),
|
||||
_buildIntroduction(),
|
||||
_buildPlaylistInfo(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -41,8 +43,6 @@ class AlbumSongListView extends StatelessWidget {
|
||||
const RemovePaddingMusicBar(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -52,36 +52,31 @@ class AlbumSongListView extends StatelessWidget {
|
||||
return NetworkImageWidget(
|
||||
url: controller.coverUrl.value,
|
||||
width: 1.sw,
|
||||
height: 413.h,
|
||||
height: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildIntroduction() {
|
||||
return SizedBox(
|
||||
height: 173.h,
|
||||
child: Stack(
|
||||
children: [
|
||||
ClipRect(
|
||||
Widget _buildPlaylistInfo() {
|
||||
return ClipRect(
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0),
|
||||
child: ClipRRect(
|
||||
child: Container(
|
||||
height: 173.h,
|
||||
padding: EdgeInsets.symmetric(horizontal: 18.w, vertical: 18.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(16.r), topRight: Radius.circular(16.r)),
|
||||
child: Image.asset(
|
||||
image: const DecorationImage(
|
||||
image: AssetImage(
|
||||
Assets.sideBPlaylistTitleBg,
|
||||
width: 1.sw,
|
||||
height: double.infinity,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18).w,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 18.h),
|
||||
Obx(() {
|
||||
return Text(
|
||||
ObjUtil.getStr(controller.title.value),
|
||||
@ -110,43 +105,11 @@ class AlbumSongListView extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: controller.onTapPlayAll,
|
||||
child: Container(
|
||||
width: 138.w,
|
||||
height: 32.h,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4).w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16).r,
|
||||
color: const Color(0x1A80F988),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
Assets.sideBPlaylistPlayAllRandom,
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
),
|
||||
SizedBox(width: 4.w),
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
return Text(
|
||||
'Play all (${controller.musicList.length})',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0),
|
||||
SizedBox(width: 10.w),
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle Playback', 1),
|
||||
const Spacer(),
|
||||
ClipOval(
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
@ -167,12 +130,48 @@ class AlbumSongListView extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 18.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPlayAll(String img, String label, int type) {
|
||||
return GestureDetector(
|
||||
onTap: () => controller.onTapPlayAll(type),
|
||||
child: Container(
|
||||
width: 100.w,
|
||||
height: 32.h,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4).w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16).r,
|
||||
color: const Color(0x1A80F988),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
img,
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
),
|
||||
SizedBox(width: 4.w),
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
return Text(
|
||||
'$label (${controller.musicList.length})',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
// Description: 音乐播放器控制器
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -104,9 +105,13 @@ class MusicPlayerController extends GetxController {
|
||||
Get.currentRoute == AppRoutes.playPage ? MusicBar().hide() : MusicBar().show();
|
||||
try {
|
||||
MusicModel? model = OfflineBox().getList().firstWhereOrNull((e) => e.videoId == getMusicModel()!.value.videoId!);
|
||||
if (model != null) {
|
||||
if (model != null && ObjUtil.isNotEmpty(model.localPath)) {
|
||||
// 有下载
|
||||
LogUtil.d('读取下载路径=${model.localPath}');
|
||||
if (!await File(model.localPath!).exists()) {
|
||||
BaseEasyLoading.toast('file does not exist');
|
||||
return;
|
||||
}
|
||||
await _player.setFilePath(model.localPath!);
|
||||
} else {
|
||||
// 无下载
|
||||
@ -192,7 +197,7 @@ class MusicPlayerController extends GetxController {
|
||||
if (!_isCompletedHandled) {
|
||||
_isCompletedHandled = true;
|
||||
_player.seek(Duration.zero);
|
||||
nextTrack();
|
||||
nextTrack(manualSwitch: false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -217,7 +222,7 @@ class MusicPlayerController extends GetxController {
|
||||
|
||||
/// 开始/结束拖动进度条
|
||||
Future<void> seekStartEnd(int value) async {
|
||||
if (processingState.value == ProcessingState.ready) {
|
||||
if (processingState.value == ProcessingState.buffering || processingState.value == ProcessingState.ready) {
|
||||
if (value == 0) {
|
||||
_seekFrontPlaying = _player.playing;
|
||||
if (_player.playing) {
|
||||
@ -271,13 +276,15 @@ class MusicPlayerController extends GetxController {
|
||||
_startPlay();
|
||||
break;
|
||||
case PlayMode.singleCycle:
|
||||
currentIndex.value = (currentIndex.value - 1 + playlist.length) % playlist.length;
|
||||
_startPlay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 下一首
|
||||
Future<void> nextTrack() async {
|
||||
Future<void> nextTrack({bool manualSwitch = true}) async {
|
||||
if (playlist.length > 1) {
|
||||
switch(playMode.value) {
|
||||
case PlayMode.listLoop:
|
||||
@ -291,6 +298,10 @@ class MusicPlayerController extends GetxController {
|
||||
_startPlay();
|
||||
break;
|
||||
case PlayMode.singleCycle:
|
||||
if (manualSwitch) {
|
||||
currentIndex.value = (currentIndex.value + 1) % playlist.length;
|
||||
_startPlay();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tone_snap/components/view_state_widget.dart';
|
||||
import 'package:tone_snap/data/models/music_model.dart';
|
||||
import 'package:tone_snap/data/models/playlist_model.dart';
|
||||
import 'package:tone_snap/data/storage/playlists_box.dart';
|
||||
import 'package:tone_snap/modules/sideb/initial/initial_controller.dart';
|
||||
import 'package:tone_snap/modules/sideb/controllers/music_player_controller.dart';
|
||||
import 'package:tone_snap/modules/sideb/more_playlist_bottom_sheet/more_playlist_bottom_sheet_view.dart';
|
||||
import 'package:tone_snap/routes/app_routes.dart';
|
||||
import 'package:tone_snap/utils/num_util.dart';
|
||||
import 'package:tone_snap/utils/obj_util.dart';
|
||||
|
||||
class CustomPlaylistController extends GetxController {
|
||||
static CustomPlaylistController get to => Get.find<CustomPlaylistController>();
|
||||
var musicPlayerController = MusicPlayerController.to;
|
||||
late String playlistModelId;
|
||||
var playlistModel = Rx<PlaylistModel?>(null);
|
||||
var viewState = ViewState.normal.obs;
|
||||
var musicList = <Rx<MusicModel>>[].obs;
|
||||
var showSearch = false.obs;
|
||||
var textEditingController = TextEditingController();
|
||||
@ -31,13 +35,16 @@ class CustomPlaylistController extends GetxController {
|
||||
|
||||
void getPlaylistMode() {
|
||||
playlistModel.value = PlaylistsBox().getPlaylistModel(playlistModelId);
|
||||
playlistModel.update((fn){});
|
||||
playlistModel.update((fn) {});
|
||||
_getList();
|
||||
}
|
||||
|
||||
void _getList() {
|
||||
if (playlistModel.value != null && playlistModel.value!.musicList != null) {
|
||||
musicList.value = playlistModel.value!.musicList!.map((e) => e.obs).toList();
|
||||
}
|
||||
viewState.value = musicList.isNotEmpty ? ViewState.normal : ViewState.empty;
|
||||
}
|
||||
|
||||
String? getFirstCoverUrl() {
|
||||
if (musicList.isNotEmpty) {
|
||||
@ -54,6 +61,19 @@ class CustomPlaylistController extends GetxController {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> onTapPlayAll(int type) async {
|
||||
if (musicList.isNotEmpty) {
|
||||
int index = 0;
|
||||
if (type == 1) {
|
||||
if (musicPlayerController.getMusicModel() != null) {
|
||||
int currentIndex = musicList.indexWhere((e) => e.value.videoId == musicPlayerController.getMusicModel()!.value.videoId);
|
||||
index = NumUtil.getRandomNumberExcludingCurrent(0, musicList.length, currentIndex);
|
||||
}
|
||||
}
|
||||
musicPlayerController.playMusic(musicList[index].value.videoId, playList: musicList.map((e) => e.value).toList());
|
||||
}
|
||||
}
|
||||
|
||||
void onTapShowSearch(bool show) {
|
||||
if (show && musicList.isEmpty) {
|
||||
return;
|
||||
@ -85,9 +105,4 @@ class CustomPlaylistController extends GetxController {
|
||||
'playList': musicList.map((e) => e.value).toList(),
|
||||
});
|
||||
}
|
||||
|
||||
void onTapAddSongs() {
|
||||
Get.until((route) => route.isFirst);
|
||||
InitialController.to.onBottomAppBarItemChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,9 +6,11 @@ import 'package:get/get.dart';
|
||||
import 'package:tone_snap/components/base_scrollbar.dart';
|
||||
import 'package:tone_snap/components/my_marquee_text.dart';
|
||||
import 'package:tone_snap/components/network_image_widget.dart';
|
||||
import 'package:tone_snap/components/view_state_widget.dart';
|
||||
import 'package:tone_snap/generated/assets.dart';
|
||||
import 'package:tone_snap/modules/sideb/widgets/music_appbar.dart';
|
||||
import 'package:tone_snap/modules/sideb/widgets/music_item.dart';
|
||||
import 'package:tone_snap/modules/sideb/widgets/remove_padding_music_bar.dart';
|
||||
import 'package:tone_snap/res/themes/app_colors.dart';
|
||||
import 'package:tone_snap/utils/date_util.dart';
|
||||
import 'package:tone_snap/utils/obj_util.dart';
|
||||
@ -28,6 +30,7 @@ class CustomPlaylistView extends StatelessWidget {
|
||||
_buildPlaylistInfo(),
|
||||
_buildPlayAllSearch(),
|
||||
_buildList(),
|
||||
const RemovePaddingMusicBar(),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -135,25 +138,9 @@ class CustomPlaylistView extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
Assets.sideBPlaylistPlayAll,
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
),
|
||||
SizedBox(width: 6.w),
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
return Text(
|
||||
'Play all (${controller.musicList.length})',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0),
|
||||
SizedBox(width: 10.w),
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle Playback', 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -228,13 +215,48 @@ class CustomPlaylistView extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPlayAll(String img, String label, int type) {
|
||||
return GestureDetector(
|
||||
onTap: () => controller.onTapPlayAll(type),
|
||||
child: Container(
|
||||
width: 100.w,
|
||||
height: 32.h,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4).w,
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
img,
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
),
|
||||
SizedBox(width: 4.w),
|
||||
Expanded(
|
||||
child: Obx(() {
|
||||
return Text(
|
||||
'$label (${controller.musicList.length})',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildList() {
|
||||
return Expanded(
|
||||
child: Obx(() {
|
||||
return ViewStateWidget(
|
||||
viewState: controller.viewState.value,
|
||||
child: BaseScrollbar(
|
||||
child: Obx(() {
|
||||
return Visibility(
|
||||
visible: controller.musicList.isNotEmpty,
|
||||
replacement: _buildEmpty(),
|
||||
child: ListView.builder(
|
||||
itemCount: controller.musicList.length,
|
||||
itemBuilder: (context, index) {
|
||||
@ -249,42 +271,44 @@ class CustomPlaylistView extends StatelessWidget {
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmpty() {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(height: 40.h),
|
||||
Text(
|
||||
'Nothing Yet',
|
||||
style: TextStyle(
|
||||
color: const Color(0x99FFFFFF),
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.h),
|
||||
GestureDetector(
|
||||
onTap: controller.onTapAddSongs,
|
||||
child: Container(
|
||||
width: 122.w,
|
||||
height: 35.h,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40).r,
|
||||
border: Border.all(
|
||||
color: seedColor,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Add Songs',
|
||||
style: TextStyle(
|
||||
color: seedColor,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _buildEmpty() {
|
||||
// return Column(
|
||||
// children: [
|
||||
// SizedBox(height: 40.h),
|
||||
// Text(
|
||||
// 'Nothing Yet',
|
||||
// style: TextStyle(
|
||||
// color: const Color(0x99FFFFFF),
|
||||
// fontSize: 14.sp,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 16.h),
|
||||
// GestureDetector(
|
||||
// onTap: controller.onTapAddSongs,
|
||||
// child: Container(
|
||||
// width: 122.w,
|
||||
// height: 35.h,
|
||||
// alignment: Alignment.center,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.circular(40).r,
|
||||
// border: Border.all(
|
||||
// color: seedColor,
|
||||
// ),
|
||||
// ),
|
||||
// child: Text(
|
||||
// 'Add Songs',
|
||||
// style: TextStyle(
|
||||
// color: seedColor,
|
||||
// fontSize: 16.sp,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ class MoreBottomSheetController extends GetxController {
|
||||
RemindDialog(
|
||||
content: 'Confirm to remove this song?',
|
||||
confirmOnTap: () async {
|
||||
Get.back();
|
||||
await OfflineBox().delete(musicModel.value.videoId!);
|
||||
musicModel.update((fn) => fn?.taskStatus = null);
|
||||
BaseEasyLoading.toast('Removed');
|
||||
|
||||
@ -94,6 +94,9 @@ class PlayPageController extends GetxController {
|
||||
await LoveSongsBox().add(musicPlayerController.getMusicModel()!.value.copyWith());
|
||||
BaseEasyLoading.toast('Collected');
|
||||
}
|
||||
if (Get.isRegistered<PersonalMusicLibraryController>()) {
|
||||
PersonalMusicLibraryController.to.refreshLoveSongs();
|
||||
}
|
||||
musicPlayerController.getMusicModel()!.update((fn) => fn?.isLove = LoveSongsBox().checkLove(musicPlayerController.getMusicModel()!.value.videoId));
|
||||
}
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ class PlayPageView extends StatelessWidget {
|
||||
_buildCover(),
|
||||
SizedBox(height: 36.h),
|
||||
_buildMusicName(),
|
||||
SizedBox(height: 24.h),
|
||||
SizedBox(height: 12.h),
|
||||
_processBar(context),
|
||||
SizedBox(height: 24.h),
|
||||
],
|
||||
@ -61,17 +61,26 @@ class PlayPageView extends StatelessWidget {
|
||||
|
||||
/// 页面背景图
|
||||
Widget _buildPageBgImg() {
|
||||
return Obx(() {
|
||||
return ImageFiltered(
|
||||
imageFilter: ImageFilter.blur(sigmaX: 50.0, sigmaY: 50.0),
|
||||
child: NetworkImageWidget(
|
||||
child: Stack(
|
||||
children: [
|
||||
Obx(() {
|
||||
return NetworkImageWidget(
|
||||
url: musicPlayerController.getMusicModel()?.value.coverUrl,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
noPlaceholder: true,
|
||||
);
|
||||
}),
|
||||
Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
color: const Color(0xB3000000),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// 头部
|
||||
@ -242,17 +251,15 @@ class PlayPageView extends StatelessWidget {
|
||||
activeTrackColor: seedColor,
|
||||
inactiveTrackColor: const Color(0x4DFFFFFF),
|
||||
secondaryActiveTrackColor: seedColor.withOpacity(0.3),
|
||||
trackHeight: 3.h,
|
||||
trackHeight: 4.h,
|
||||
thumbColor: Colors.white,
|
||||
thumbShape: RoundSliderThumbShape(
|
||||
disabledThumbRadius: 7.w,
|
||||
enabledThumbRadius: 7.w,
|
||||
disabledThumbRadius: 8.w,
|
||||
enabledThumbRadius: 8.w,
|
||||
),
|
||||
trackShape: FullWidthTrackShape(),
|
||||
overlayShape: RoundSliderOverlayShape(overlayRadius: 10.w), // 扩大覆盖层半径
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 1.sw,
|
||||
height: 7.w,
|
||||
child: Obx(() {
|
||||
return Slider(
|
||||
value: musicPlayerController.positionDuration.value.inSeconds.toDouble(),
|
||||
@ -265,8 +272,6 @@ class PlayPageView extends StatelessWidget {
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user