mirror of
https://github.com/IllusionMan1212/lyrics-grabbr.git
synced 2026-10-24 02:12:27 +00:00
Compare commits
2
Commits
keep_screen_on
...
v0.3.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c834c7eed
|
||
|
|
a770033563
|
Vendored
+1
-1
Submodule 3rdparty/flutter updated: b8f5394a5c...f468f3366c
+34
-13
@@ -20,6 +20,7 @@ class LyricsPage extends StatefulWidget {
|
|||||||
class _LyricsPageState extends State<LyricsPage> {
|
class _LyricsPageState extends State<LyricsPage> {
|
||||||
bool fetching = false;
|
bool fetching = false;
|
||||||
String? lyrics;
|
String? lyrics;
|
||||||
|
bool instrumental = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -35,13 +36,16 @@ class _LyricsPageState extends State<LyricsPage> {
|
|||||||
String path = widget.url.split('genius.com/')[1];
|
String path = widget.url.split('genius.com/')[1];
|
||||||
String fullLyrics = '';
|
String fullLyrics = '';
|
||||||
if (await webScraper.loadWebPage('/$path?react=1')) {
|
if (await webScraper.loadWebPage('/$path?react=1')) {
|
||||||
webScraper.loadFromString(webScraper.getPageContent().replaceAll('<br>', '\n'));
|
webScraper
|
||||||
var element = webScraper.getElement("div[data-lyrics-container]", ['data-lyrics-container']);
|
.loadFromString(webScraper.getPageContent().replaceAll('<br>', '\n'));
|
||||||
|
var element = webScraper
|
||||||
|
.getElement("div[data-lyrics-container]", ['data-lyrics-container']);
|
||||||
for (var section in element) {
|
for (var section in element) {
|
||||||
fullLyrics += section['title'] + '\n';
|
fullLyrics += section['title'] + '\n';
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
lyrics = fullLyrics;
|
lyrics = fullLyrics;
|
||||||
|
instrumental = fullLyrics.isEmpty;
|
||||||
fetching = false;
|
fetching = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -82,20 +86,37 @@ class _LyricsPageState extends State<LyricsPage> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: instrumental
|
||||||
width: MediaQuery.of(context).size.width,
|
? const Center(
|
||||||
child: SingleChildScrollView(
|
child: Column(
|
||||||
child: Container(
|
mainAxisSize: MainAxisSize.min,
|
||||||
padding: const EdgeInsets.all(30),
|
children: [
|
||||||
child: SelectableText(
|
Icon(Icons.music_note, size: 50),
|
||||||
lyrics ?? '',
|
SizedBox(width: 20, height: 20),
|
||||||
style: const TextStyle(
|
Text(
|
||||||
fontSize: 16,
|
'This Song is an Instrumental',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.all(30),
|
||||||
|
child: SelectableText(
|
||||||
|
lyrics ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 0.3.4+3
|
version: 0.3.5+4
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user