Skip to content

Commit

Permalink
首次提交
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoXianThis committed Mar 26, 2023
1 parent 1ed87d4 commit e03a881
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 24 deletions.
Binary file removed IMG/IMG-03.png
Binary file not shown.
26 changes: 16 additions & 10 deletions lib/data/Player.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math';
import 'package:audioplayers/audioplayers.dart';
import 'package:get/get.dart';
Expand All @@ -12,10 +13,10 @@ import '../api/http.dart';

//播放模式
enum PlayMode {
sequential, //顺序播放
loop, //单曲循环
listLoop, //列表循环
random, //随机播放
sequential, //顺序播放 0
loop, //单曲循环 1
listLoop, //列表循环 2
random, //随机播放 3
}

//播放状态
Expand Down Expand Up @@ -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(""));
}
Expand Down Expand Up @@ -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"));
}


Expand Down
5 changes: 0 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 11 additions & 3 deletions lib/ui/pages/SettingsPage.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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(); },),
)
],
);

}
}
2 changes: 1 addition & 1 deletion lib/ui/widget/LogoWidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),)),
],
);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/widget/SettingsTop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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("使用到的开源项目", ),
// ),

],
);
Expand Down

0 comments on commit e03a881

Please sign in to comment.