调整部分样式

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

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

View File

@ -222,17 +222,17 @@ 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) { //
_player.play(); if (_seekFrontPlaying) {
} _player.play();
} }
} }
} }

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