From 09916d088ba55700d58e80390cd46e4d5ae2fb10 Mon Sep 17 00:00:00 2001 From: SQ <59799517@qq。com> Date: Wed, 7 Feb 2024 09:55:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=92=AD=E6=94=BE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=BA=E7=A9=BA=E4=B8=8D=E8=83=BD=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/page/controller/ServiceController.dart | 21 +++++++++++++++------ lib/page/left_widget/LeftWidge.dart | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/page/controller/ServiceController.dart b/lib/page/controller/ServiceController.dart index d044925..9e03cbb 100644 --- a/lib/page/controller/ServiceController.dart +++ b/lib/page/controller/ServiceController.dart @@ -249,8 +249,13 @@ class ServiceController extends GetxController { playMusicEntity.lyric = getsongInfoById["musicLyric"]; var box = await Hive.openBox("playlist_nowPlaying"); box.put(id, playMusicEntity.toJson()); - playlist.insert(currentPlayIndex.value+1, playMusicEntity); - currentPlayIndex.value = currentPlayIndex.value+1; + if(playlist.length==0){ + playlist.add(playMusicEntity); + currentPlayIndex.value = 0; + }else{ + playlist.insert(currentPlayIndex.value+1, playMusicEntity); + currentPlayIndex.value = currentPlayIndex.value+1; + } updatePlayListSet(); await player.play(UrlSource(source)); musicID.value = playMusicEntity.id!; @@ -278,8 +283,14 @@ class ServiceController extends GetxController { var box = await Hive.openBox("playlist_nowPlaying"); box.put(id, playMusicEntity.toJson()); - playlist.insert(currentPlayIndex.value+1, playMusicEntity); - currentPlayIndex.value = currentPlayIndex.value+1; + + if(playlist.length==0){ + playlist.add(playMusicEntity); + currentPlayIndex.value = 0; + }else{ + playlist.insert(currentPlayIndex.value+1, playMusicEntity); + currentPlayIndex.value = currentPlayIndex.value+1; + } updatePlayListSet(); await player.play(UrlSource(url)); musicID.value = playMusicEntity.id!; @@ -297,8 +308,6 @@ class ServiceController extends GetxController { jumpMusic(int playListIndex) async { PlayMusicEntity music = playlist[playListIndex]; - - Hive.openBox("play_list_star_song").then((box) => { if (box.get(music.id) != null) {isStar.value = true} }); diff --git a/lib/page/left_widget/LeftWidge.dart b/lib/page/left_widget/LeftWidge.dart index c0b2e6a..412c28d 100644 --- a/lib/page/left_widget/LeftWidge.dart +++ b/lib/page/left_widget/LeftWidge.dart @@ -141,7 +141,7 @@ class _LeftWidgeState extends State { text: TextSpan( children: [ TextSpan( - text:'版本号:v1.1.8', + text:'版本号:v1.1.9', style: TextStyle( color: Get.isDarkMode?dark_text_Colors:light_text_Colors, ),