💄 Player optimization
This commit is contained in:
parent
a5f39321eb
commit
ddeda2ce23
@ -57,6 +57,8 @@ PODS:
|
|||||||
- sqlite3/rtree
|
- sqlite3/rtree
|
||||||
- url_launcher_ios (0.0.1):
|
- url_launcher_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- wakelock_plus (0.0.1):
|
||||||
|
- Flutter
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
- audio_service (from `.symlinks/plugins/audio_service/ios`)
|
||||||
@ -76,6 +78,7 @@ DEPENDENCIES:
|
|||||||
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
|
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
|
||||||
- sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`)
|
- sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`)
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
|
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
trunk:
|
trunk:
|
||||||
@ -117,6 +120,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/sqlite3_flutter_libs/ios"
|
:path: ".symlinks/plugins/sqlite3_flutter_libs/ios"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
wakelock_plus:
|
||||||
|
:path: ".symlinks/plugins/wakelock_plus/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
|
||||||
@ -138,6 +143,7 @@ SPEC CHECKSUMS:
|
|||||||
sqlite3: 0bb0e6389d824e40296f531b858a2a0b71c0d2fb
|
sqlite3: 0bb0e6389d824e40296f531b858a2a0b71c0d2fb
|
||||||
sqlite3_flutter_libs: c00457ebd31e59fa6bb830380ddba24d44fbcd3b
|
sqlite3_flutter_libs: c00457ebd31e59fa6bb830380ddba24d44fbcd3b
|
||||||
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
|
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
|
||||||
|
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
|
||||||
|
|
||||||
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
|
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
|
||||||
|
|
||||||
|
@ -42,20 +42,34 @@ class _ExploreScreenState extends State<ExploreScreen> {
|
|||||||
|
|
||||||
_featuredPlaylist =
|
_featuredPlaylist =
|
||||||
(await _spotify.api.playlists.featured.getPage(20)).items!.toList();
|
(await _spotify.api.playlists.featured.getPage(20)).items!.toList();
|
||||||
|
if (mounted) {
|
||||||
setState(() => _isLoading['featured'] = false);
|
setState(() => _isLoading['featured'] = false);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final idxList = Set();
|
||||||
_recentlyPlaylist = (await _history.fetch())
|
_recentlyPlaylist = (await _history.fetch())
|
||||||
.where((x) => x.playlist != null)
|
.where((x) => x.playlist != null)
|
||||||
.map((x) => x.playlist!)
|
.map((x) => x.playlist!)
|
||||||
.toList();
|
.toList()
|
||||||
|
..retainWhere((x) => idxList.add(x.id!));
|
||||||
|
if (mounted) {
|
||||||
setState(() => _isLoading['recently'] = false);
|
setState(() => _isLoading['recently'] = false);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_newReleasesPlaylist =
|
_newReleasesPlaylist =
|
||||||
(await _spotify.api.browse.newReleases(country: market).getPage(20))
|
(await _spotify.api.browse.newReleases(country: market).getPage(20))
|
||||||
.items
|
.items
|
||||||
?.map((album) => album.toAlbum())
|
?.map((album) => album.toAlbum())
|
||||||
.toList();
|
.toList();
|
||||||
|
if (mounted) {
|
||||||
setState(() => _isLoading['newReleases'] = false);
|
setState(() => _isLoading['newReleases'] = false);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final customEndpoint =
|
final customEndpoint =
|
||||||
CustomSpotifyEndpoints(_auth.auth.value?.accessToken.value ?? '');
|
CustomSpotifyEndpoints(_auth.auth.value?.accessToken.value ?? '');
|
||||||
@ -65,7 +79,11 @@ class _ExploreScreenState extends State<ExploreScreen> {
|
|||||||
locale: Intl.canonicalizedLocale(locale.toString()),
|
locale: Intl.canonicalizedLocale(locale.toString()),
|
||||||
);
|
);
|
||||||
_forYouView = forYouView['content']?['items'];
|
_forYouView = forYouView['content']?['items'];
|
||||||
|
if (mounted) {
|
||||||
setState(() => _isLoading['forYou'] = false);
|
setState(() => _isLoading['forYou'] = false);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -2,12 +2,35 @@ import 'dart:math';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:rhythm_box/providers/user_preferences.dart';
|
||||||
import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart';
|
import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart';
|
||||||
import 'package:rhythm_box/widgets/player/bottom_player.dart';
|
import 'package:rhythm_box/widgets/player/bottom_player.dart';
|
||||||
|
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||||
|
|
||||||
class LyricsScreen extends StatelessWidget {
|
class LyricsScreen extends StatefulWidget {
|
||||||
const LyricsScreen({super.key});
|
const LyricsScreen({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LyricsScreen> createState() => _LyricsScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LyricsScreenState extends State<LyricsScreen> {
|
||||||
|
late final UserPreferencesProvider _preferences = Get.find();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void activate() {
|
||||||
|
super.activate();
|
||||||
|
if (_preferences.state.value.playerWakelock) {
|
||||||
|
WakelockPlus.enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void deactivate() {
|
||||||
|
super.deactivate();
|
||||||
|
WakelockPlus.disable();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
|
@ -2,11 +2,13 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:rhythm_box/platform.dart';
|
import 'package:rhythm_box/platform.dart';
|
||||||
|
import 'package:rhythm_box/providers/user_preferences.dart';
|
||||||
import 'package:rhythm_box/screens/player/queue.dart';
|
import 'package:rhythm_box/screens/player/queue.dart';
|
||||||
import 'package:rhythm_box/screens/player/siblings.dart';
|
import 'package:rhythm_box/screens/player/siblings.dart';
|
||||||
import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart';
|
import 'package:rhythm_box/widgets/lyrics/synced_lyrics.dart';
|
||||||
import 'package:rhythm_box/widgets/player/bottom_player.dart';
|
import 'package:rhythm_box/widgets/player/bottom_player.dart';
|
||||||
import 'package:rhythm_box/widgets/player/devices.dart';
|
import 'package:rhythm_box/widgets/player/devices.dart';
|
||||||
|
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
class MiniPlayerScreen extends StatefulWidget {
|
class MiniPlayerScreen extends StatefulWidget {
|
||||||
@ -19,6 +21,8 @@ class MiniPlayerScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MiniPlayerScreenState extends State<MiniPlayerScreen> {
|
class _MiniPlayerScreenState extends State<MiniPlayerScreen> {
|
||||||
|
late final UserPreferencesProvider _preferences = Get.find();
|
||||||
|
|
||||||
bool _wasMaximized = false;
|
bool _wasMaximized = false;
|
||||||
|
|
||||||
bool _areaActive = false;
|
bool _areaActive = false;
|
||||||
@ -51,6 +55,20 @@ class _MiniPlayerScreenState extends State<MiniPlayerScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void activate() {
|
||||||
|
super.activate();
|
||||||
|
if (_preferences.state.value.playerWakelock) {
|
||||||
|
WakelockPlus.enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void deactivate() {
|
||||||
|
super.deactivate();
|
||||||
|
WakelockPlus.disable();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -34,7 +34,6 @@ class _PlayerScreenState extends State<PlayerScreen> {
|
|||||||
late final AudioPlayerProvider _playback = Get.find();
|
late final AudioPlayerProvider _playback = Get.find();
|
||||||
late final QueryingTrackInfoProvider _query = Get.find();
|
late final QueryingTrackInfoProvider _query = Get.find();
|
||||||
late final AuthenticationProvider _auth = Get.find();
|
late final AuthenticationProvider _auth = Get.find();
|
||||||
|
|
||||||
late final UserPreferencesProvider _preferences = Get.find();
|
late final UserPreferencesProvider _preferences = Get.find();
|
||||||
|
|
||||||
String? get _albumArt =>
|
String? get _albumArt =>
|
||||||
|
@ -55,7 +55,21 @@ class AppDatabase extends _$AppDatabase {
|
|||||||
AppDatabase() : super(_openConnection());
|
AppDatabase() : super(_openConnection());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 1;
|
int get schemaVersion => 2;
|
||||||
|
|
||||||
|
@override
|
||||||
|
MigrationStrategy get migration {
|
||||||
|
return MigrationStrategy(
|
||||||
|
onCreate: (Migrator m) async {
|
||||||
|
await m.createAll();
|
||||||
|
},
|
||||||
|
onUpgrade: (Migrator m, int from, int to) async {
|
||||||
|
if (from < 2) {
|
||||||
|
await m.addColumn(preferencesTable, preferencesTable.playerWakelock);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyDatabase _openConnection() {
|
LazyDatabase _openConnection() {
|
||||||
|
Loading…
Reference in New Issue
Block a user