mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-10-01 05:39:34 +02:00
fix(lyrics): hide controls after five seconds only during playback
This commit is contained in:
1 parent
fc13a6c7c0
commit
e09d0c1609
3 files changed
+100
-14
No files matched your search
@@ -17,8 +17,10 @@ class MornyeLandscapePlayer extends StatefulWidget {
|
||||
required this.controls,
|
||||
required this.volume,
|
||||
required this.page,
|
||||
required this.isPlaying,
|
||||
required this.onPageChanged,
|
||||
this.lyricsOptions,
|
||||
this.controlsHeldOpen = false,
|
||||
});
|
||||
|
||||
final Widget artwork;
|
||||
@@ -28,6 +30,8 @@ class MornyeLandscapePlayer extends StatefulWidget {
|
||||
final Widget controls;
|
||||
final Widget volume;
|
||||
final int page;
|
||||
final bool isPlaying;
|
||||
final bool controlsHeldOpen;
|
||||
final ValueChanged<int> onPageChanged;
|
||||
final Widget? lyricsOptions;
|
||||
|
||||
@@ -54,21 +58,26 @@ class _MornyeLandscapePlayerState extends State<MornyeLandscapePlayer> {
|
||||
@override
|
||||
void didUpdateWidget(MornyeLandscapePlayer oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.page != widget.page) {
|
||||
if (oldWidget.page != widget.page ||
|
||||
oldWidget.isPlaying != widget.isPlaying) {
|
||||
_actionsVisible = true;
|
||||
_scheduleHide();
|
||||
} else if (oldWidget.controlsHeldOpen != widget.controlsHeldOpen) {
|
||||
_scheduleHide();
|
||||
}
|
||||
}
|
||||
|
||||
void _scheduleHide() {
|
||||
_hideTimer?.cancel();
|
||||
if (widget.page != 1 ||
|
||||
!widget.isPlaying ||
|
||||
widget.controlsHeldOpen ||
|
||||
!_actionsVisible ||
|
||||
_audioOutputOpen ||
|
||||
MediaQuery.accessibleNavigationOf(context)) {
|
||||
return;
|
||||
}
|
||||
_hideTimer = Timer(const Duration(seconds: 3), () {
|
||||
_hideTimer = Timer(const Duration(seconds: 5), () {
|
||||
if (!mounted) return;
|
||||
if (ModalRoute.of(context)?.isCurrent == false) {
|
||||
_scheduleHide();
|
||||
|
||||
Reference in new issue
Block a user