feat(settings): Settings-Tab mit Bibliotheks-Statistik, Berechtigungen, Über Melo
- Bibliotheks-Statistik: Song-Anzahl + Gesamtspieldauer via watchSongs() (reine Summier-/Format-Funktion in lib/settings/library_stats.dart, unabhängig von Flutter/Plattform testbar) - Berechtigungen: Musik-Berechtigung öffnet Systemeinstellungen über das bereits vorhandene openMusicPermissionSettings() - Über Melo: kurzer Name + Slogan, keine erfundene Versionsnummer (package_info_plus ist keine Dependency) - Keine Platzhalter für Profil/Cloud-Sync/Geräte-Verwaltung, da es noch kein Account-/Cloud-System gibt (Phase 2) - HomeShell nutzt SettingsScreen statt des Settings-Placeholders, toter _Placeholder-Widget-Code entfernt Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
3fc52327c9
commit
23a1e7838d
@@ -0,0 +1,26 @@
|
||||
import '../library/database.dart';
|
||||
|
||||
/// Summiert die Spieldauer aller Songs (in [songs]). Songs ohne bekannte
|
||||
/// Dauer (`durationMs == null`) werden übersprungen.
|
||||
Duration totalDuration(List<Song> songs) {
|
||||
var totalMs = 0;
|
||||
for (final song in songs) {
|
||||
final durationMs = song.durationMs;
|
||||
if (durationMs != null) {
|
||||
totalMs += durationMs;
|
||||
}
|
||||
}
|
||||
return Duration(milliseconds: totalMs);
|
||||
}
|
||||
|
||||
/// Formatiert die Gesamtspieldauer der Bibliothek als "Xh Ym" bzw. "Ym" bei
|
||||
/// unter einer Stunde.
|
||||
String formatTotalDuration(List<Song> songs) {
|
||||
final duration = totalDuration(songs);
|
||||
final hours = duration.inHours;
|
||||
final minutes = duration.inMinutes.remainder(60);
|
||||
if (hours > 0) {
|
||||
return '${hours}h ${minutes}m';
|
||||
}
|
||||
return '${minutes}m';
|
||||
}
|
||||
Reference in New Issue
Block a user