diff --git a/lib/components/dialog/add_playlist_dialog.dart b/lib/components/dialog/add_playlist_dialog.dart index 8e08457..e8a9d67 100644 --- a/lib/components/dialog/add_playlist_dialog.dart +++ b/lib/components/dialog/add_playlist_dialog.dart @@ -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)) { + Get.back(); onTap(_textEditingController.text); - } else { - onTap('My playlist1'); } - Get.back(); } else { Get.back(); } diff --git a/lib/data/cache/music_cache_manager.dart b/lib/data/cache/music_cache_manager.dart index 692d202..f962898 100644 --- a/lib/data/cache/music_cache_manager.dart +++ b/lib/data/cache/music_cache_manager.dart @@ -10,7 +10,7 @@ class MusicCacheManager { Config( key, stalePeriod: const Duration(days: 7), - maxNrOfCacheObjects: 20, + maxNrOfCacheObjects: 30, ), ); diff --git a/lib/data/storage/music_box.dart b/lib/data/storage/music_box.dart index 655d5a4..9d89d21 100644 --- a/lib/data/storage/music_box.dart +++ b/lib/data/storage/music_box.dart @@ -158,7 +158,7 @@ class MusicBox { Future 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); diff --git a/lib/modules/launch/launch_controller.dart b/lib/modules/launch/launch_controller.dart index 802b430..7e56468 100644 --- a/lib/modules/launch/launch_controller.dart +++ b/lib/modules/launch/launch_controller.dart @@ -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'; diff --git a/lib/modules/sideb/album_song_list/album_song_list_controller.dart b/lib/modules/sideb/album_song_list/album_song_list_controller.dart index e70cc98..bdc6041 100644 --- a/lib/modules/sideb/album_song_list/album_song_list_controller.dart +++ b/lib/modules/sideb/album_song_list/album_song_list_controller.dart @@ -137,11 +137,17 @@ class AlbumSongListController extends GetxController { } /// 点击播放全部歌曲 - Future onTapPlayAll() async { + Future onTapPlayAll(int type) async { if (musicList.isNotEmpty) { - final randomNumber = NumUtil.getRandomNumber(0, musicList.length); - List 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 playList = await _next(musicList[index].value.videoId, playlistId: musicList[index].value.playlistId); + musicPlayerController.playMusic(playList[index].videoId, playList: playList); } } diff --git a/lib/modules/sideb/album_song_list/album_song_list_view.dart b/lib/modules/sideb/album_song_list/album_song_list_view.dart index c944326..857c74f 100644 --- a/lib/modules/sideb/album_song_list/album_song_list_view.dart +++ b/lib/modules/sideb/album_song_list/album_song_list_view.dart @@ -22,25 +22,25 @@ class AlbumSongListView extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFF121212), - body: Stack( + body: Column( children: [ - _buildPageBgImg(), - Column( - children: [ - SizedBox( - height: 413.h, - child: Column( + SizedBox( + height: 413.h, + child: Stack( + children: [ + _buildPageBgImg(), + Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const MusicAppbar(), - _buildIntroduction(), + _buildPlaylistInfo(), ], ), - ), - _buildList(), - const RemovePaddingMusicBar(), - ], + ], + ), ), + _buildList(), + const RemovePaddingMusicBar(), ], ), ); @@ -52,126 +52,125 @@ 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( - child: BackdropFilter( - filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), - child: ClipRRect( - borderRadius: BorderRadius.only(topLeft: Radius.circular(16.r), topRight: Radius.circular(16.r)), - child: Image.asset( - Assets.sideBPlaylistTitleBg, - width: 1.sw, - height: double.infinity, - fit: BoxFit.cover, - ), + Widget _buildPlaylistInfo() { + return ClipRect( + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + 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)), + image: const DecorationImage( + image: AssetImage( + Assets.sideBPlaylistTitleBg, ), + fit: BoxFit.cover, ), ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 18).w, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 18.h), - Obx(() { + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Obx(() { + return Text( + ObjUtil.getStr(controller.title.value), + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Colors.white, + fontSize: 22.sp, + fontWeight: FontWeight.w500, + ), + ); + }), + SizedBox(height: 10.h), + Expanded( + child: Obx(() { return Text( - ObjUtil.getStr(controller.title.value), - maxLines: 1, + ObjUtil.getStr(controller.description.value), + maxLines: 3, overflow: TextOverflow.ellipsis, style: TextStyle( - color: Colors.white, - fontSize: 22.sp, - fontWeight: FontWeight.w500, + color: const Color(0x99FFFFFF), + fontSize: 12.sp, ), ); }), - SizedBox(height: 10.h), - Expanded( - child: Obx(() { - return Text( - ObjUtil.getStr(controller.description.value), - maxLines: 3, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: const Color(0x99FFFFFF), - fontSize: 12.sp, - ), - ); - }), - ), - 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, + ), + SizedBox(height: 10.h), + Row( + children: [ + _buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0), + SizedBox(width: 10.w), + _buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle Playback', 1), + const Spacer(), + ClipOval( + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: controller.onTapCollect, + child: Padding( + padding: const EdgeInsets.all(6).w, + child: Obx(() { + return Image.asset( + controller.isCollect.value ? Assets.sideBCollected : Assets.sideBNotCollectionAlbum, 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, - ), - ); - }), - ), - ], + ); + }), ), ), ), - ClipOval( - child: Material( - color: Colors.transparent, - child: InkWell( - onTap: controller.onTapCollect, - child: Padding( - padding: const EdgeInsets.all(6).w, - child: Obx(() { - return Image.asset( - controller.isCollect.value ? Assets.sideBCollected : Assets.sideBNotCollectionAlbum, - width: 24.w, - height: 24.w, - ); - }), - ), - ), - ), - ), - ], - ), - 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, + ), + ); + }), + ), + ], + ), ), ); } diff --git a/lib/modules/sideb/controllers/music_player_controller.dart b/lib/modules/sideb/controllers/music_player_controller.dart index f9e0b0a..6209a36 100644 --- a/lib/modules/sideb/controllers/music_player_controller.dart +++ b/lib/modules/sideb/controllers/music_player_controller.dart @@ -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 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 nextTrack() async { + Future 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; } } diff --git a/lib/modules/sideb/custom_playlist/custom_playlist_controller.dart b/lib/modules/sideb/custom_playlist/custom_playlist_controller.dart index ca2e54f..f006a33 100644 --- a/lib/modules/sideb/custom_playlist/custom_playlist_controller.dart +++ b/lib/modules/sideb/custom_playlist/custom_playlist_controller.dart @@ -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(); + var musicPlayerController = MusicPlayerController.to; late String playlistModelId; var playlistModel = Rx(null); + var viewState = ViewState.normal.obs; var musicList = >[].obs; var showSearch = false.obs; var textEditingController = TextEditingController(); @@ -31,12 +35,15 @@ class CustomPlaylistController extends GetxController { void getPlaylistMode() { playlistModel.value = PlaylistsBox().getPlaylistModel(playlistModelId); - playlistModel.update((fn){}); + playlistModel.update((fn) {}); _getList(); } void _getList() { - musicList.value = playlistModel.value!.musicList!.map((e) => e.obs).toList(); + 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() { @@ -54,6 +61,19 @@ class CustomPlaylistController extends GetxController { ); } + Future 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); - } } diff --git a/lib/modules/sideb/custom_playlist/custom_playlist_view.dart b/lib/modules/sideb/custom_playlist/custom_playlist_view.dart index 5700572..6ef01fb 100644 --- a/lib/modules/sideb/custom_playlist/custom_playlist_view.dart +++ b/lib/modules/sideb/custom_playlist/custom_playlist_view.dart @@ -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,63 +215,100 @@ class CustomPlaylistView extends StatelessWidget { ); } - Widget _buildList() { - return Expanded( - child: BaseScrollbar( - child: Obx(() { - return Visibility( - visible: controller.musicList.isNotEmpty, - replacement: _buildEmpty(), - child: ListView.builder( - itemCount: controller.musicList.length, - itemBuilder: (context, index) { - return MusicItem( - musicModel: controller.musicList[index], - playlistModelId: controller.playlistModel.value!.id, - onTapItem: () => controller.onTapItem(controller.musicList[index].value), - ); - }, + 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 _buildEmpty() { - return Column( - children: [ - SizedBox(height: 40.h), - Text( - 'Nothing Yet', - style: TextStyle( - color: const Color(0x99FFFFFF), - fontSize: 14.sp, + Widget _buildList() { + return Expanded( + child: Obx(() { + return ViewStateWidget( + viewState: controller.viewState.value, + child: BaseScrollbar( + child: Obx(() { + return Visibility( + child: ListView.builder( + itemCount: controller.musicList.length, + itemBuilder: (context, index) { + return MusicItem( + musicModel: controller.musicList[index], + playlistModelId: controller.playlistModel.value!.id, + onTapItem: () => controller.onTapItem(controller.musicList[index].value), + ); + }, + ), + ); + }), ), - ), - 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, + // ), + // ), + // ), + // ), + // ], + // ); + // } } diff --git a/lib/modules/sideb/more_bottom_sheet/more_bottom_sheet_controller.dart b/lib/modules/sideb/more_bottom_sheet/more_bottom_sheet_controller.dart index c63fa32..d34b828 100644 --- a/lib/modules/sideb/more_bottom_sheet/more_bottom_sheet_controller.dart +++ b/lib/modules/sideb/more_bottom_sheet/more_bottom_sheet_controller.dart @@ -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'); diff --git a/lib/modules/sideb/play_page/play_page_controller.dart b/lib/modules/sideb/play_page/play_page_controller.dart index 8baed35..3e0ec4d 100644 --- a/lib/modules/sideb/play_page/play_page_controller.dart +++ b/lib/modules/sideb/play_page/play_page_controller.dart @@ -94,6 +94,9 @@ class PlayPageController extends GetxController { await LoveSongsBox().add(musicPlayerController.getMusicModel()!.value.copyWith()); BaseEasyLoading.toast('Collected'); } + if (Get.isRegistered()) { + PersonalMusicLibraryController.to.refreshLoveSongs(); + } musicPlayerController.getMusicModel()!.update((fn) => fn?.isLove = LoveSongsBox().checkLove(musicPlayerController.getMusicModel()!.value.videoId)); } diff --git a/lib/modules/sideb/play_page/play_page_view.dart b/lib/modules/sideb/play_page/play_page_view.dart index b0e53f0..5a9919b 100644 --- a/lib/modules/sideb/play_page/play_page_view.dart +++ b/lib/modules/sideb/play_page/play_page_view.dart @@ -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( - url: musicPlayerController.getMusicModel()?.value.coverUrl, - width: 1.sw, - height: 1.sh, - noPlaceholder: true, - ), - ); - }); + return ImageFiltered( + imageFilter: ImageFilter.blur(sigmaX: 50.0, sigmaY: 50.0), + 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,31 +251,27 @@ 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(), - secondaryTrackValue: musicPlayerController.bufferedDuration.value.inSeconds.toDouble(), - min: 0, - max: musicPlayerController.totalDuration.value.inSeconds.toDouble(), - onChanged: (value) => musicPlayerController.seekToPosition(value), - onChangeStart: (value) => musicPlayerController.seekStartEnd(0), - onChangeEnd: (value) => musicPlayerController.seekStartEnd(1), - ); - }), - ), + child: Obx(() { + return Slider( + value: musicPlayerController.positionDuration.value.inSeconds.toDouble(), + secondaryTrackValue: musicPlayerController.bufferedDuration.value.inSeconds.toDouble(), + min: 0, + max: musicPlayerController.totalDuration.value.inSeconds.toDouble(), + onChanged: (value) => musicPlayerController.seekToPosition(value), + onChangeStart: (value) => musicPlayerController.seekStartEnd(0), + onChangeEnd: (value) => musicPlayerController.seekStartEnd(1), + ); + }), ), - SizedBox(height: 8.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [