v2.52.4 — Einstellungen (F4): Auto-Sync-Intervall, Sleep-Timer-Default, Wiedergabegeschwindigkeit, Akzentfarbe, Storage-Info
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'dart:ui' show ImageFilter;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../models/song.dart';
|
||||
import '../services/favoriten_service.dart';
|
||||
import '../services/lyrics_service.dart';
|
||||
@@ -389,7 +390,12 @@ class _NowPlayingScreenState extends State<NowPlayingScreen>
|
||||
}
|
||||
|
||||
/// Schlaf-Timer: Chips Aus/15/30/45/60 + Restzeit, wenn aktiv.
|
||||
void _zeigeSleepTimer() {
|
||||
/// Der in den Einstellungen gewählte Standard (`sleep_timer_default_min`)
|
||||
/// ist vorausgewählt markiert, solange kein Timer läuft.
|
||||
Future<void> _zeigeSleepTimer() async {
|
||||
final p = await SharedPreferences.getInstance();
|
||||
final defaultMin = p.getInt('sleep_timer_default_min') ?? 0;
|
||||
if (!mounted) return;
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: MeloTheme.dunkel1,
|
||||
@@ -397,6 +403,7 @@ class _NowPlayingScreenState extends State<NowPlayingScreen>
|
||||
builder: (ctx, setSheetState) {
|
||||
final aktiv = _player.sleepTimerAktiv;
|
||||
final rest = _player.sleepRestzeit;
|
||||
final zeigeStandard = !aktiv && defaultMin > 0;
|
||||
return SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 16, 20, 20),
|
||||
@@ -427,6 +434,14 @@ class _NowPlayingScreenState extends State<NowPlayingScreen>
|
||||
],
|
||||
],
|
||||
),
|
||||
if (zeigeStandard) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Standard: $defaultMin Min (aus Einstellungen)',
|
||||
style: const TextStyle(
|
||||
fontSize: 11, color: MeloTheme.textSekundaer),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 14),
|
||||
Row(
|
||||
children: [
|
||||
@@ -436,21 +451,25 @@ class _NowPlayingScreenState extends State<NowPlayingScreen>
|
||||
setSheetState(() {});
|
||||
}),
|
||||
_zeitChip(ctx, '15', const Duration(minutes: 15),
|
||||
standard: defaultMin == 15 && zeigeStandard,
|
||||
onTap: () {
|
||||
_player.setSleepTimer(const Duration(minutes: 15));
|
||||
setSheetState(() {});
|
||||
}),
|
||||
_zeitChip(ctx, '30', const Duration(minutes: 30),
|
||||
standard: defaultMin == 30 && zeigeStandard,
|
||||
onTap: () {
|
||||
_player.setSleepTimer(const Duration(minutes: 30));
|
||||
setSheetState(() {});
|
||||
}),
|
||||
_zeitChip(ctx, '45', const Duration(minutes: 45),
|
||||
standard: defaultMin == 45 && zeigeStandard,
|
||||
onTap: () {
|
||||
_player.setSleepTimer(const Duration(minutes: 45));
|
||||
setSheetState(() {});
|
||||
}),
|
||||
_zeitChip(ctx, '60', const Duration(minutes: 60),
|
||||
standard: defaultMin == 60 && zeigeStandard,
|
||||
onTap: () {
|
||||
_player.setSleepTimer(const Duration(minutes: 60));
|
||||
setSheetState(() {});
|
||||
@@ -467,7 +486,7 @@ class _NowPlayingScreenState extends State<NowPlayingScreen>
|
||||
}
|
||||
|
||||
Widget _zeitChip(BuildContext ctx, String label, Duration? dauer,
|
||||
{bool aktiv = false, VoidCallback? onTap}) {
|
||||
{bool aktiv = false, bool standard = false, VoidCallback? onTap}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
@@ -476,9 +495,13 @@ class _NowPlayingScreenState extends State<NowPlayingScreen>
|
||||
decoration: BoxDecoration(
|
||||
color: aktiv ? MeloTheme.rot : MeloTheme.dunkel2,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
// Standard-Chip (Einstellung) bekommt einen Akzent-Rahmen
|
||||
border: standard
|
||||
? Border.all(color: MeloTheme.rot, width: 1.5)
|
||||
: null,
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
standard ? '$label ⭐' : label,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: aktiv ? Colors.white : MeloTheme.textSekundaer,
|
||||
|
||||
Reference in New Issue
Block a user