调整部分样式

This commit is contained in:
fengshengxiong 2024-08-04 16:44:47 +08:00
parent a1020160e1
commit 64047ed78a
10 changed files with 113 additions and 85 deletions

View File

@ -144,7 +144,7 @@ class DownloadManager {
if (ObjUtil.isEmpty(musicModel.value.coverUrl)) { if (ObjUtil.isEmpty(musicModel.value.coverUrl)) {
var thumbnails = playerModel.videoDetails?.thumbnail?.thumbnails; var thumbnails = playerModel.videoDetails?.thumbnail?.thumbnails;
if (thumbnails != null && thumbnails.isNotEmpty) { if (thumbnails != null && thumbnails.isNotEmpty) {
musicModel.value.coverUrl = thumbnails[0].url; musicModel.value.coverUrl = thumbnails.last.url;
} }
} }
if (ObjUtil.isEmpty(musicModel.value.musicType)) { if (ObjUtil.isEmpty(musicModel.value.musicType)) {

View File

@ -33,8 +33,7 @@ class LaunchController extends GetxController with GetSingleTickerProviderStateM
_appLifecycleReactor = AppLifecycleReactor(); _appLifecycleReactor = AppLifecycleReactor();
_appLifecycleReactor.listenToAppStateChanges(); _appLifecycleReactor.listenToAppStateChanges();
// Get.put(NetworkConnectivityService());
Get.putAsync(() async => NetworkConnectivityService());
_startTimer(); _startTimer();
} }

View File

@ -141,10 +141,7 @@ class AlbumSongListController extends GetxController {
if (musicList.isNotEmpty) { if (musicList.isNotEmpty) {
int index = 0; int index = 0;
if (type == 1) { if (type == 1) {
if (musicPlayerController.getMusicModel() != null) { index = NumUtil.getRandomNumber(0, musicList.length);
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); List<MusicModel> playList = await _next(musicList[index].value.videoId, playlistId: musicList[index].value.playlistId);
musicPlayerController.playMusic(playList[index].videoId, playList: playList); musicPlayerController.playMusic(playList[index].videoId, playList: playList);

View File

@ -105,11 +105,16 @@ class AlbumSongListView extends StatelessWidget {
), ),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Row( Row(
children: [
Expanded(
child: Row(
children: [ children: [
_buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0), _buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0),
SizedBox(width: 10.w), SizedBox(width: 10.w),
_buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle Playback', 1), _buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle', 1),
const Spacer(), ],
),
),
ClipOval( ClipOval(
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,
@ -138,10 +143,10 @@ class AlbumSongListView extends StatelessWidget {
} }
Widget _buildPlayAll(String img, String label, int type) { Widget _buildPlayAll(String img, String label, int type) {
return GestureDetector( return IntrinsicWidth(
child: GestureDetector(
onTap: () => controller.onTapPlayAll(type), onTap: () => controller.onTapPlayAll(type),
child: Container( child: Container(
width: 100.w,
height: 32.h, height: 32.h,
padding: const EdgeInsets.symmetric(horizontal: 4).w, padding: const EdgeInsets.symmetric(horizontal: 4).w,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -156,7 +161,18 @@ class AlbumSongListView extends StatelessWidget {
height: 24.w, height: 24.w,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Expanded( Flexible(
child: Visibility(
visible: type == 0,
replacement: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white,
fontSize: 13.sp,
),
),
child: Obx(() { child: Obx(() {
return Text( return Text(
'$label (${controller.musicList.length})', '$label (${controller.musicList.length})',
@ -164,14 +180,16 @@ class AlbumSongListView extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp, fontSize: 13.sp,
), ),
); );
}), }),
), ),
),
], ],
), ),
), ),
),
); );
} }

View File

@ -222,12 +222,13 @@ class MusicPlayerController extends GetxController {
/// / /// /
Future<void> seekStartEnd(int value) async { Future<void> seekStartEnd(int value) async {
if (processingState.value == ProcessingState.buffering || processingState.value == ProcessingState.ready) {
if (value == 0) { if (value == 0) {
if (processingState.value == ProcessingState.ready) {
_seekFrontPlaying = _player.playing; _seekFrontPlaying = _player.playing;
if (_player.playing) { if (_player.playing) {
_player.pause(); _player.pause();
} }
}
} else { } else {
// //
if (_seekFrontPlaying) { if (_seekFrontPlaying) {
@ -235,7 +236,6 @@ class MusicPlayerController extends GetxController {
} }
} }
} }
}
/// / /// /
Future<void> playPause() async { Future<void> playPause() async {

View File

@ -65,10 +65,7 @@ class CustomPlaylistController extends GetxController {
if (musicList.isNotEmpty) { if (musicList.isNotEmpty) {
int index = 0; int index = 0;
if (type == 1) { if (type == 1) {
if (musicPlayerController.getMusicModel() != null) { index = NumUtil.getRandomNumber(0, musicList.length);
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()); musicPlayerController.playMusic(musicList[index].value.videoId, playList: musicList.map((e) => e.value).toList());
} }

View File

@ -140,7 +140,7 @@ class CustomPlaylistView extends StatelessWidget {
children: [ children: [
_buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0), _buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0),
SizedBox(width: 10.w), SizedBox(width: 10.w),
_buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle Playback', 1), _buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle', 1),
], ],
), ),
), ),
@ -216,12 +216,16 @@ class CustomPlaylistView extends StatelessWidget {
} }
Widget _buildPlayAll(String img, String label, int type) { Widget _buildPlayAll(String img, String label, int type) {
return GestureDetector( return IntrinsicWidth(
child: GestureDetector(
onTap: () => controller.onTapPlayAll(type), onTap: () => controller.onTapPlayAll(type),
child: Container( child: Container(
width: 100.w,
height: 32.h, height: 32.h,
padding: const EdgeInsets.symmetric(horizontal: 4).w, padding: const EdgeInsets.symmetric(horizontal: 4).w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16).r,
color: const Color(0x1A80F988),
),
child: Row( child: Row(
children: [ children: [
Image.asset( Image.asset(
@ -230,7 +234,18 @@ class CustomPlaylistView extends StatelessWidget {
height: 24.w, height: 24.w,
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
Expanded( Flexible(
child: Visibility(
visible: type == 0,
replacement: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white,
fontSize: 13.sp,
),
),
child: Obx(() { child: Obx(() {
return Text( return Text(
'$label (${controller.musicList.length})', '$label (${controller.musicList.length})',
@ -238,14 +253,16 @@ class CustomPlaylistView extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp, fontSize: 13.sp,
), ),
); );
}), }),
), ),
),
], ],
), ),
), ),
),
); );
} }

View File

@ -137,8 +137,8 @@ class HomeView extends GetView<HomeController> {
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisCount: 3,
mainAxisSpacing: 0, mainAxisSpacing: 0,
crossAxisSpacing: 10.h, crossAxisSpacing: 12.w,
childAspectRatio: 60.w / (1.sw - 16.w), childAspectRatio: 60.w / (1.sw - 48.w),
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final musicModel = browseGroupModel.browseList![index]; final musicModel = browseGroupModel.browseList![index];

View File

@ -71,7 +71,7 @@ class MusicAppbar extends StatelessWidget {
width: 42.w, width: 42.w,
height: 42.w, height: 42.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0x26FFFFFF), color: const Color(0x66000000),
borderRadius: BorderRadius.circular(42.w), borderRadius: BorderRadius.circular(42.w),
border: isBackBorder ? Border.all(color: const Color(0x4DFFFFFF), width: 1.w) : null, border: isBackBorder ? Border.all(color: const Color(0x4DFFFFFF), width: 1.w) : null,
), ),

View File

@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.3+13 version: 1.0.4+14
environment: environment:
sdk: '>=3.4.1 <4.0.0' sdk: '>=3.4.1 <4.0.0'