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