Skip to content

Commit

Permalink
修复QQ音乐无法播放问题 修改歌词展示
Browse files Browse the repository at this point in the history
  • Loading branch information
a13087635768 committed Sep 14, 2024
1 parent 84ce99f commit 22ad178
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 159 deletions.
6 changes: 4 additions & 2 deletions lib/color/SqThemeData.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ final ThemeData appDarkThemeData = ThemeData(
backgroundColor: dark_background_Colors
)
),
backgroundColor: Colors.transparent,
// dialogBackgroundColor: Colors.transparent,
// backgroundColor: Colors.transparent,
brightness: Brightness.dark,
primaryColor: dark_background_Colors, // 主要部分背景颜色(导航和tabBar等)
scaffoldBackgroundColor:
Expand All @@ -34,7 +35,8 @@ final ThemeData appLightThemeData = ThemeData(
backgroundColor: light_background_Colors
)
),
backgroundColor: Colors.transparent,
// backgroundColor: Colors.transparent,
// dialogBackgroundColor: Colors.transparent,
brightness: Brightness.light,
primaryColor: light_background_Colors, // 主要部分背景颜色(导航和tabBar等)
scaffoldBackgroundColor:
Expand Down
2 changes: 1 addition & 1 deletion lib/page/left_widget/LeftWidge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class _LeftWidgeState extends State<LeftWidge> {
text: TextSpan(
children: [
TextSpan(
text:'版本号:v1.1.12',
text:'版本号:v1.1.13',
style: TextStyle(
color: Get.isDarkMode?dark_text_Colors:light_text_Colors,
),
Expand Down
143 changes: 88 additions & 55 deletions lib/page/play_page/PlayPage.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import 'package:audioplayers/audioplayers.dart';
import 'package:blur/blur.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hotkey_manager/hotkey_manager.dart';
import 'package:line_icons/line_icons.dart';
import 'package:mmoo_lyric/lyric.dart';
import 'package:mmoo_lyric/lyric_controller.dart';
import 'package:mmoo_lyric/lyric_util.dart';
import 'package:mmoo_lyric/lyric_widget.dart';
import 'package:sq_subsonic_desktop/color/SqThemeData.dart';
import 'package:sq_subsonic_desktop/page/controller/ServiceController.dart';
import 'package:flutter_lyric/lyrics_reader.dart';
Expand All @@ -22,8 +27,9 @@ class PlayPage extends StatefulWidget {

class _PlayPageState extends State<PlayPage> {
final serviceController = Get.put(ServiceController());
var lyricUI = SqLyricUI();

// var lyricUI = SqLyricUI();
var lyricWidget;
var lyriccontroller = LyricController(draggingTimerDuration: Duration(milliseconds: 500));
HotKey _hotKey = HotKey(
KeyCode.escape,
// modifiers: [KeyModifier.alt, KeyModifier.control],
Expand Down Expand Up @@ -51,8 +57,27 @@ class _PlayPageState extends State<PlayPage> {
serviceController.player.onPositionChanged.listen((event) {
setState(() {
widget.nowDuration = event;
lyriccontroller.progress = widget.nowDuration;
});
});
List<Lyric> formatLyric ;
var lyric = Lyric(lyric: "暂无歌词", startTime: Duration(hours: 200),endTime: Duration(hours: 200));

try {
formatLyric= LyricUtil.formatLyric(serviceController.musicLyric.value.isEmpty?'[00:00.00] 暂无歌词!':serviceController.musicLyric.value);
} catch (e) {
// var lyric2 = Lyric(lyric: serviceController.musicLyric.value, startTime: Duration(hours: 200),endTime: Duration(hours: 200));
// var showlss = serviceController.musicLyric.value.isEmpty?lyric:lyric2;
formatLyric = [lyric];
}

lyricWidget = LyricWidget(
size: Size(double.infinity, double.infinity),
lyrics: formatLyric,
controller: lyriccontroller,
);


}


Expand Down Expand Up @@ -185,59 +210,61 @@ class _PlayPageState extends State<PlayPage> {
children: [
Expanded(
flex: 1,
child:
LyricsReader(
padding: const EdgeInsets.all(8.0),
position: widget.nowDuration.inMilliseconds,
lyricUi: lyricUI,
model: LyricsModelBuilder.create()
.bindLyricToMain(
logic
.musicLyric.value)
.getModel(),
playing: logic.player.state == PlayerState.playing,
emptyBuilder: () =>
Center(
child: Text(
"暂无歌词",
style:
lyricUI
.getOtherMainTextStyle(),
),
),
selectLineBuilder: (progress,
confirm) {
return Row(
children: [
IconButton(
onPressed: () {
// LyricsLog.logD("点击事件");
confirm.call();
setState(() {
logic
.seekDuration(
(Duration(
milliseconds:
progress)));
});
},
icon: Icon(
Icons.play_arrow,
color: Colors
.redAccent)),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors
.redAccent),
height: 1,
width: double.infinity,
),
),
],
);
},
)
child:lyricWidget==null?Container(child: Text('暂无歌词')):lyricWidget!,


// LyricsReader(
// padding: const EdgeInsets.all(8.0),
// position: widget.nowDuration.inMilliseconds,
// lyricUi: lyricUI,
// model: LyricsModelBuilder.create()
// .bindLyricToMain(
// logic
// .musicLyric.value)
// .getModel(),
// playing: logic.player.state == PlayerState.playing,
// emptyBuilder: () =>
// Center(
// child: Text(
// "暂无歌词",
// style:
// lyricUI
// .getOtherMainTextStyle(),
// ),
// ),
// selectLineBuilder: (progress,
// confirm) {
// return Row(
// children: [
// IconButton(
// onPressed: () {
// // LyricsLog.logD("点击事件");
// confirm.call();
// setState(() {
// logic
// .seekDuration(
// (Duration(
// milliseconds:
// progress)));
// });
// },
// icon: Icon(
// Icons.play_arrow,
// color: Colors
// .redAccent)),
// Expanded(
// child: Container(
// decoration: BoxDecoration(
// color: Colors
// .redAccent),
// height: 1,
// width: double.infinity,
// ),
// ),
// ],
// );
// },
// )

),
],
Expand All @@ -262,4 +289,10 @@ class _PlayPageState extends State<PlayPage> {
)));
});
}

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty('lyricWidget', lyricWidget));
}
}
4 changes: 2 additions & 2 deletions lib/subsonic/models/PlugSearchResult.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class Records {
String? pic;
String? albumName;
String? albumid;
Null? lyric;
Null? lyricId;
String? lyric;
String? lyricId;
String? searchType;
String? duration;
String? oter;
Expand Down
Loading

0 comments on commit 22ad178

Please sign in to comment.