写一个想听啥听啥的听歌软件 想听歌下载什么软件( 二 )

("queueState") ?? 0;var resourceId = GetStorage().read<String>("currentSong");if (resourceId == null) {SongListManager.playList().then((value) => currentSong.value = https://www.goobye.net/value.first);} else {SongListManager.getSong(resourceId).then((value) => currentSong.value = value);}}static PlayerManager _getInstance() {_instance = _instance ?? PlayerManager._internal();return _instance!;}play(SongModel songModel) async {SongListManager.addSong(songModel);try {var url = await songModel.playUrl();int state = await audioPlayer.play(url);audioPlayer.getDuration();currentSong.value = songModel;GetStorage().write("currentSong", currentSong.value!.resourceId());addSong();isInit.value = https://www.goobye.net/true;} catch (e) {next();}}pause() {if (currentSong.value == null) {return;}audioPlayer.pause();}resume() async {if (currentSong.value == null) {return;}if (isInit.value) {audioPlayer.resume();} else {play(currentSong.value!);}}next() async {if (currentSong.value == null) {return;}var list = await SongListManager.playList();if (queueState.value == 0) {var index = list.indexOf(currentSong.value!);var i = index + 1;if (index >= list.length - 1) {i = 0;}var song = list.elementAt(i);currentSong.value = song;play(song);} else if (queueState.value == 1) {var random = Random();var index = random.nextInt(list.length);var song = list.elementAt(index);currentSong.value = song;play(song);} else {play(currentSong.value!);}}previous() async {if (currentSong.value == null) {return;}var list = await SongListManager.playList();if (queueState.value == 0) {var index = list.indexOf(currentSong.value!);var i = index - 1;if (index <= 0) {i = list.length - 1;}var song = list.elementAt(i);currentSong.value = song;play(song);} else if (queueState.value == 1) {var random = Random();var index = random.nextInt(list.length);var song = list.elementAt(index);currentSong.value = song;play(song);} else {play(currentSong.value!);}}seek(Duration duration) async {if (currentSong.value == null) {return;}await audioPlayer.seek(duration);}addSong() async {var songModel = currentSong.value;if (songModel == null) {return;}var img = await songModel.songImg();var album = songModel.album();var title = songModel.songName();// var duration = await audioPlayer.getDuration();var duration = 200000;var item = MediaItem(id: songModel.resourceId(),album: album,title: title,artist:'',duration: Duration(milliseconds: duration),artUri: Uri.parse(img),);// audioHandler.playMediaItem(item);audioHandler.mediaItem.add(item);var playbackState = PlaybackState(// Which buttons should appear in the notification nowcontrols: [MediaControl.skipToPrevious,MediaControl.play,MediaControl.pause,MediaControl.stop,MediaControl.skipToNext,],// Which other actions should be enabled in the notificationsystemActions: const {MediaAction.seek,MediaAction.seekForward,MediaAction.seekBackward,},// Which controls to show in Android's compact view.androidCompactActionIndices: const [0, 1, 3],// Whether audio is ready, buffering, ...processingState: AudioProcessingState.ready,// Whether audio is playingspeed: 1.0,// The current queue positionqueueIndex: 0,playing: true,);audioHandler.playbackState.add(playbackState);}}

哎,我为啥要在头条上发这种东西呢?这种东西真的有人看吗?
不管了,发几张成品图:

写一个想听啥听啥的听歌软件 想听歌下载什么软件

文章插图

写一个想听啥听啥的听歌软件 想听歌下载什么软件

文章插图

写一个想听啥听啥的听歌软件 想听歌下载什么软件

文章插图




顺便搞了个mac版的,上班好好用 嘿嘿
写一个想听啥听啥的听歌软件 想听歌下载什么软件

文章插图


【写一个想听啥听啥的听歌软件 想听歌下载什么软件】虽然界面比较简陋,但是听歌的搞这么花里胡哨的干啥呢,是吧?