1
1
import 'dart:async' ;
2
+ import 'package:app_rhyme/types/lyric_ui.dart' ;
2
3
import 'package:chinese_font_library/chinese_font_library.dart' ;
3
4
import 'package:app_rhyme/types/music_container.dart' ;
4
5
import 'package:app_rhyme/utils/global_vars.dart' ;
@@ -8,76 +9,12 @@ import 'package:flutter/material.dart';
8
9
import 'package:flutter_lyric/lyrics_reader.dart' ;
9
10
import 'package:get/get.dart' ;
10
11
11
- class AppleMusicLyricUi extends LyricUI {
12
- final bool isDarkMode;
13
-
14
- AppleMusicLyricUi ({this .isDarkMode = false });
15
-
16
- @override
17
- TextStyle getPlayingMainTextStyle () {
18
- return TextStyle (
19
- color: isDarkMode ? Colors .white : Colors .black,
20
- fontSize: 30 ,
21
- fontWeight: FontWeight .bold,
22
- ).useSystemChineseFont ();
23
- }
24
-
25
- @override
26
- TextStyle getPlayingExtTextStyle () {
27
- return TextStyle (
28
- color: isDarkMode ? Colors .white : Colors .black,
29
- fontSize: 22 ,
30
- fontWeight: FontWeight .bold)
31
- .useSystemChineseFont ();
32
- }
33
-
34
- @override
35
- TextStyle getOtherMainTextStyle () {
36
- return TextStyle (
37
- color: isDarkMode ? Colors .white70 : Colors .black54,
38
- fontSize: 18 ,
39
- fontWeight: FontWeight .bold,
40
- ).useSystemChineseFont ();
41
- }
42
-
43
- @override
44
- TextStyle getOtherExtTextStyle () {
45
- return TextStyle (
46
- color: isDarkMode ? Colors .white70 : Colors .black54,
47
- fontSize: 14 ,
48
- ).useSystemChineseFont ();
49
- }
50
-
51
- @override
52
- double getBlankLineHeight () => 16 ;
53
-
54
- @override
55
- double getLineSpace () => 26 ;
56
-
57
- @override
58
- double getInlineSpace () => 8 ;
59
-
60
- @override
61
- double getPlayingLineBias () => 0.4 ;
62
-
63
- @override
64
- LyricAlign getLyricHorizontalAlign () => LyricAlign .LEFT ;
65
-
66
- @override
67
- bool enableLineAnimation () => true ;
68
-
69
- @override
70
- bool enableHighlight () => false ;
71
-
72
- @override
73
- bool initAnimation () => true ;
74
- }
75
-
76
12
class LyricComp extends StatefulWidget {
77
13
final double maxHeight;
78
- final bool isDarkMode;
79
- const LyricComp (
80
- {super .key, required this .maxHeight, required this .isDarkMode});
14
+ const LyricComp ({
15
+ super .key,
16
+ required this .maxHeight,
17
+ });
81
18
82
19
@override
83
20
LyricCompState createState () => LyricCompState ();
@@ -92,7 +29,7 @@ class LyricCompState extends State<LyricComp> {
92
29
@override
93
30
void initState () {
94
31
super .initState ();
95
- lyricUI = AppleMusicLyricUi (isDarkMode : widget.isDarkMode );
32
+ lyricUI = AppleMusicLyricUi ();
96
33
lyricModel = LyricsModelBuilder .create ()
97
34
.bindLyricToMain (globalAudioHandler.playingMusic.value? .info.lyric ??
98
35
"[00:00.00]无歌词" )
@@ -114,10 +51,8 @@ class LyricCompState extends State<LyricComp> {
114
51
115
52
@override
116
53
Widget build (BuildContext context) {
117
- Color decorationColor =
118
- widget.isDarkMode ? CupertinoColors .white : CupertinoColors .black;
119
- Color iconColor =
120
- widget.isDarkMode ? CupertinoColors .white : CupertinoColors .black;
54
+ Color decorationColor = CupertinoColors .white;
55
+ Color iconColor = CupertinoColors .white;
121
56
return Obx (() => LyricsReader (
122
57
playing: globalAudioHandler.playingMusic.value != null ,
123
58
padding: const EdgeInsets .symmetric (horizontal: 20 ),
@@ -168,9 +103,7 @@ class LyricCompState extends State<LyricComp> {
168
103
169
104
class LyricPopupRoute extends PopupRoute <void > {
170
105
final double maxHeight;
171
- final bool isDarkMode;
172
- LyricPopupRoute (
173
- this .isDarkMode, {
106
+ LyricPopupRoute ({
174
107
required this .maxHeight,
175
108
});
176
109
@@ -192,7 +125,7 @@ class LyricPopupRoute extends PopupRoute<void> {
192
125
Animation <double > animation,
193
126
Animation <double > secondaryAnimation,
194
127
) {
195
- const containerWidth = 350 .0 ;
128
+ const containerWidth = 450 .0 ;
196
129
197
130
return FadeTransition (
198
131
opacity: animation,
@@ -201,7 +134,6 @@ class LyricPopupRoute extends PopupRoute<void> {
201
134
child: LyricContainer (
202
135
maxHeight: maxHeight,
203
136
width: containerWidth,
204
- isDarkMode: isDarkMode,
205
137
),
206
138
),
207
139
);
@@ -211,24 +143,18 @@ class LyricPopupRoute extends PopupRoute<void> {
211
143
class LyricContainer extends StatelessWidget {
212
144
final double maxHeight;
213
145
final double width;
214
- final bool isDarkMode;
215
146
216
147
const LyricContainer ({
217
148
super .key,
218
149
required this .maxHeight,
219
150
required this .width,
220
- required this .isDarkMode,
221
151
});
222
152
223
153
@override
224
154
Widget build (BuildContext context) {
225
- Color backgroundColor = isDarkMode
226
- ? const Color .fromARGB (255 , 46 , 46 , 46 )
227
- : const Color .fromARGB (255 , 249 , 249 , 249 );
155
+ Color backgroundColor = const Color .fromARGB (255 , 46 , 46 , 46 );
228
156
229
- Color borderColor = isDarkMode
230
- ? const Color .fromARGB (255 , 62 , 62 , 62 )
231
- : const Color .fromARGB (255 , 237 , 237 , 237 );
157
+ Color borderColor = const Color .fromARGB (255 , 62 , 62 , 62 );
232
158
233
159
return Container (
234
160
height: maxHeight,
@@ -243,7 +169,6 @@ class LyricContainer extends StatelessWidget {
243
169
),
244
170
child: LyricComp (
245
171
maxHeight: maxHeight,
246
- isDarkMode: isDarkMode,
247
172
),
248
173
);
249
174
}
@@ -253,7 +178,6 @@ void showLyricPopup(BuildContext context, bool isDarkMode) {
253
178
Navigator .push (
254
179
context,
255
180
LyricPopupRoute (
256
- isDarkMode,
257
181
maxHeight: MediaQuery .of (context).size.height,
258
182
),
259
183
);
0 commit comments