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,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../library/database.dart';
|
||||
import '../library/permissions.dart';
|
||||
import 'library_stats.dart';
|
||||
|
||||
/// Settings-Tab: Bibliotheks-Statistik, Berechtigungen, Über Melo.
|
||||
///
|
||||
/// Kein Cloud-/Account-System vorhanden (Phase 2) — daher keine
|
||||
/// Platzhalter-Einträge für Profil/Sync/Geräte, die aktuell ins Leere laufen.
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
const SettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final db = context.read<MeloDb>();
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Settings')),
|
||||
body: ListView(
|
||||
children: [
|
||||
const _SectionLabel('Bibliothek'),
|
||||
StreamBuilder<List<Song>>(
|
||||
stream: db.watchSongs(),
|
||||
builder: (context, snapshot) {
|
||||
final songs = snapshot.data ?? const [];
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.library_music),
|
||||
title: Text('${songs.length} Songs in der Bibliothek'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.schedule),
|
||||
title:
|
||||
Text('${formatTotalDuration(songs)} Gesamtspieldauer'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
const _SectionLabel('Berechtigungen'),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.mic_none),
|
||||
title: const Text('Musik-Berechtigung'),
|
||||
trailing: TextButton(
|
||||
onPressed: openMusicPermissionSettings,
|
||||
child: const Text('Einstellungen öffnen'),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
const _SectionLabel('Über Melo'),
|
||||
const ListTile(
|
||||
leading: Icon(Icons.info_outline),
|
||||
title: Text('Melo'),
|
||||
subtitle: Text('Deine Musik. Offline. Kein Abo.'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Kleine graue Überschrift über einer Einstellungs-Gruppe.
|
||||
class _SectionLabel extends StatelessWidget {
|
||||
const _SectionLabel(this.label);
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 4),
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: Colors.white54,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user