diff --git a/IMG/IMG-03.png b/IMG/IMG-03.png deleted file mode 100644 index 4b12b90..0000000 Binary files a/IMG/IMG-03.png and /dev/null differ diff --git a/lib/data/Player.dart b/lib/data/Player.dart index d261370..4e4e743 100644 --- a/lib/data/Player.dart +++ b/lib/data/Player.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:convert'; import 'dart:math'; import 'package:audioplayers/audioplayers.dart'; import 'package:get/get.dart'; @@ -12,10 +13,10 @@ import '../api/http.dart'; //播放模式 enum PlayMode { - sequential, //顺序播放 - loop, //单曲循环 - listLoop, //列表循环 - random, //随机播放 + sequential, //顺序播放 0 + loop, //单曲循环 1 + listLoop, //列表循环 2 + random, //随机播放 3 } //播放状态 @@ -78,7 +79,11 @@ class Player extends GetxController { volume.value = storage.read("volume") ?? 1.0; player.setVolume(volume.value); //播放模式 - playMode.value = storage.read("playmode") ?? PlayMode.sequential; + var temp = storage.read("playmode") ?? 0; + if(temp == 0) playMode.value = PlayMode.sequential; + else if(temp == 1) playMode.value = PlayMode.loop; + else if(temp == 2) playMode.value = PlayMode.listLoop; + else if(temp == 3) playMode.value = PlayMode.random; //重置播放器 player.setSource(UrlSource("")); } @@ -255,11 +260,12 @@ class Player extends GetxController { //切换播放模式 void changePlayMode(){ - if(playMode.value == PlayMode.sequential){ playMode.value = PlayMode.listLoop; } - else if(playMode.value == PlayMode.listLoop){ playMode.value = PlayMode.loop; } - else if(playMode.value == PlayMode.loop){ playMode.value = PlayMode.random; } - else if(playMode.value == PlayMode.random){ playMode.value = PlayMode.sequential; } - storage.write("playmode", playMode.value); + if(playMode.value == PlayMode.sequential){ playMode.value = PlayMode.listLoop; storage.write("playmode", 2); } + else if(playMode.value == PlayMode.listLoop){ playMode.value = PlayMode.loop; storage.write("playmode", 1); } + else if(playMode.value == PlayMode.loop){ playMode.value = PlayMode.random; storage.write("playmode", 3); } + else if(playMode.value == PlayMode.random){ playMode.value = PlayMode.sequential; storage.write("playmode", 0); } + + print(storage.read("playmode")); } diff --git a/lib/main.dart b/lib/main.dart index 868de28..4dbf9f9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,11 +5,6 @@ import 'package:music/api/LoadCore.dart'; import 'package:music/data/Global.dart'; import 'package:music/ui/MainFrame.dart'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; - - void main() async { //运行核心 loadCore(); diff --git a/lib/ui/pages/SettingsPage.dart b/lib/ui/pages/SettingsPage.dart index 6cea0a7..55f69bd 100644 --- a/lib/ui/pages/SettingsPage.dart +++ b/lib/ui/pages/SettingsPage.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:music/data/Global.dart'; import 'package:music/ui/widget/LogoWidget.dart'; import 'package:music/ui/widget/SettingsTop.dart'; import 'package:music/ui/widget/TipsImageView.dart'; @@ -12,16 +13,23 @@ class _SettingsPage extends StatelessWidget { @override Widget build(BuildContext context) { - return const CustomScrollView( + return CustomScrollView( slivers: [ SliverPadding( padding: EdgeInsets.fromLTRB(0, 40, 0, 0), sliver: SliverToBoxAdapter( - child: About(), + child: TipsImageView( + image: Image.asset("src/images/QYN_let_go.png"), + text: Text("设置页面,但是并没有什么需要设置。"), + opacity: 0.15, + ), ), ), - + SliverToBoxAdapter( + child: TextButton(child: Text("重置软件"), onPressed: (){ storage.erase(); },), + ) ], ); + } } \ No newline at end of file diff --git a/lib/ui/widget/LogoWidget.dart b/lib/ui/widget/LogoWidget.dart index 5510516..eeb4af9 100644 --- a/lib/ui/widget/LogoWidget.dart +++ b/lib/ui/widget/LogoWidget.dart @@ -22,7 +22,7 @@ class LogoWidget extends StatelessWidget { ), const Padding(padding: EdgeInsets.all(3)), const Text("简易云音乐", style: TextStyle(fontSize: 19, fontWeight: FontWeight.w600)), - const SizedBox(width: 80, child: Text(" v0.0.1", style: TextStyle(fontSize: 12, color: Colors.black38),)), + const SizedBox(width: 80, child: Text(" v0.1", style: TextStyle(fontSize: 12, color: Colors.black38),)), ], ); } diff --git a/lib/ui/widget/SettingsTop.dart b/lib/ui/widget/SettingsTop.dart index 1313447..41581d6 100644 --- a/lib/ui/widget/SettingsTop.dart +++ b/lib/ui/widget/SettingsTop.dart @@ -11,11 +11,11 @@ class About extends StatelessWidget { Widget build(BuildContext context) { return Column( children: [ - LogoWidget(), - HoverView( - padding: EdgeInsets.fromLTRB(20, 12, 20, 12), - child: const Text("使用到的开源项目", ), - ), + // LogoWidget(), + // HoverView( + // padding: EdgeInsets.fromLTRB(20, 12, 20, 12), + // child: const Text("使用到的开源项目", ), + // ), ], );