调整部分样式
This commit is contained in:
parent
a1020160e1
commit
64047ed78a
@ -144,7 +144,7 @@ class DownloadManager {
|
||||
if (ObjUtil.isEmpty(musicModel.value.coverUrl)) {
|
||||
var thumbnails = playerModel.videoDetails?.thumbnail?.thumbnails;
|
||||
if (thumbnails != null && thumbnails.isNotEmpty) {
|
||||
musicModel.value.coverUrl = thumbnails[0].url;
|
||||
musicModel.value.coverUrl = thumbnails.last.url;
|
||||
}
|
||||
}
|
||||
if (ObjUtil.isEmpty(musicModel.value.musicType)) {
|
||||
|
||||
@ -33,8 +33,7 @@ class LaunchController extends GetxController with GetSingleTickerProviderStateM
|
||||
_appLifecycleReactor = AppLifecycleReactor();
|
||||
_appLifecycleReactor.listenToAppStateChanges();
|
||||
|
||||
// 监听网络变化
|
||||
Get.putAsync(() async => NetworkConnectivityService());
|
||||
Get.put(NetworkConnectivityService());
|
||||
|
||||
_startTimer();
|
||||
}
|
||||
|
||||
@ -141,10 +141,7 @@ class AlbumSongListController extends GetxController {
|
||||
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);
|
||||
}
|
||||
index = NumUtil.getRandomNumber(0, musicList.length);
|
||||
}
|
||||
List<MusicModel> playList = await _next(musicList[index].value.videoId, playlistId: musicList[index].value.playlistId);
|
||||
musicPlayerController.playMusic(playList[index].videoId, playList: playList);
|
||||
|
||||
@ -106,10 +106,15 @@ class AlbumSongListView extends StatelessWidget {
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
children: [
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0),
|
||||
SizedBox(width: 10.w),
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle Playback', 1),
|
||||
const Spacer(),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: [
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0),
|
||||
SizedBox(width: 10.w),
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAllRandom, 'Shuffle', 1),
|
||||
],
|
||||
),
|
||||
),
|
||||
ClipOval(
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
@ -138,38 +143,51 @@ class AlbumSongListView 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,
|
||||
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,
|
||||
return IntrinsicWidth(
|
||||
child: GestureDetector(
|
||||
onTap: () => controller.onTapPlayAll(type),
|
||||
child: Container(
|
||||
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),
|
||||
Flexible(
|
||||
child: Visibility(
|
||||
visible: type == 0,
|
||||
replacement: Text(
|
||||
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,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -222,17 +222,17 @@ class MusicPlayerController extends GetxController {
|
||||
|
||||
/// 开始/结束拖动进度条
|
||||
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;
|
||||
if (_player.playing) {
|
||||
_player.pause();
|
||||
}
|
||||
} else {
|
||||
// 拖动前如果是播放状态,拖动完成后恢复播放
|
||||
if (_seekFrontPlaying) {
|
||||
_player.play();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 拖动前如果是播放状态,拖动完成后恢复播放
|
||||
if (_seekFrontPlaying) {
|
||||
_player.play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,10 +65,7 @@ class CustomPlaylistController extends GetxController {
|
||||
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);
|
||||
}
|
||||
index = NumUtil.getRandomNumber(0, musicList.length);
|
||||
}
|
||||
musicPlayerController.playMusic(musicList[index].value.videoId, playList: musicList.map((e) => e.value).toList());
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ class CustomPlaylistView extends StatelessWidget {
|
||||
children: [
|
||||
_buildPlayAll(Assets.sideBPlaylistPlayAll, 'Play all', 0),
|
||||
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) {
|
||||
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,
|
||||
return IntrinsicWidth(
|
||||
child: GestureDetector(
|
||||
onTap: () => controller.onTapPlayAll(type),
|
||||
child: Container(
|
||||
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),
|
||||
Flexible(
|
||||
child: Visibility(
|
||||
visible: type == 0,
|
||||
replacement: Text(
|
||||
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,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -137,8 +137,8 @@ class HomeView extends GetView<HomeController> {
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 0,
|
||||
crossAxisSpacing: 10.h,
|
||||
childAspectRatio: 60.w / (1.sw - 16.w),
|
||||
crossAxisSpacing: 12.w,
|
||||
childAspectRatio: 60.w / (1.sw - 48.w),
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final musicModel = browseGroupModel.browseList![index];
|
||||
|
||||
@ -71,7 +71,7 @@ class MusicAppbar extends StatelessWidget {
|
||||
width: 42.w,
|
||||
height: 42.w,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0x26FFFFFF),
|
||||
color: const Color(0x66000000),
|
||||
borderRadius: BorderRadius.circular(42.w),
|
||||
border: isBackBorder ? Border.all(color: const Color(0x4DFFFFFF), width: 1.w) : null,
|
||||
),
|
||||
|
||||
@ -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
|
||||
# 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.
|
||||
version: 1.0.3+13
|
||||
version: 1.0.4+14
|
||||
|
||||
environment:
|
||||
sdk: '>=3.4.1 <4.0.0'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user