Zuletzt zeigt zuletzt Gehörtes statt neu Hinzugefügtes; Herz sitzt jetzt neben dem Songnamen

- MeloDb.watchRecentlyPlayed(): wertet PlaybackHistory statt dateAddedMs aus,
  ein mehrfach gehörter Song erscheint nur einmal, an der Position seines
  jüngsten Abspielens (Subquery mit GROUP BY songId / MAX(playedAtMs)).
- "Zuletzt" (Karte + RecentlyPlayedScreen, vormals RecentlyAddedScreen) in
  my_music_screen.dart nutzt jetzt watchRecentlyPlayed() statt watchRecent().
- Herz im Vollbild-Player: aus der AppBar-actions-Row entfernt, sitzt jetzt
  direkt neben dem Songtitel in _Angaben (now_playing_screen.dart).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012A2pmbnVNPiHdyf2GW8eLP
This commit is contained in:
Hermes (Server)
2026-08-29 11:24:42 +02:00
co-authored by Claude Sonnet 5
parent 90b63c467e
commit 2cabe36a6c
6 changed files with 345 additions and 32 deletions
+9 -9
View File
@@ -234,17 +234,17 @@ class _QuickAccessRow extends StatelessWidget {
),
if (sektionen.contains(AppSettings.sektionZuletzt))
StreamBuilder<List<Song>>(
stream: db.watchRecent(limit: 50),
stream: db.watchRecentlyPlayed(limit: 50),
builder: (context, snapshot) {
final recent = snapshot.data ?? const <Song>[];
return _QuickCard(
icon: Icons.schedule,
label: 'Zuletzt',
subtitle: 'Neu hinzugefügt',
subtitle: 'Zuletzt gehört',
coverPath: recent.isEmpty ? null : recent.first.coverPath,
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => const RecentlyAddedScreen()),
builder: (_) => const RecentlyPlayedScreen()),
),
);
},
@@ -363,22 +363,22 @@ class _Empty extends StatelessWidget {
}
}
/// Vollbild-Liste der zuletzt hinzugefügten Songs (Schnellzugriff "Zuletzt").
class RecentlyAddedScreen extends StatelessWidget {
const RecentlyAddedScreen({super.key});
/// Vollbild-Liste der zuletzt gehörten Songs (Schnellzugriff "Zuletzt").
class RecentlyPlayedScreen extends StatelessWidget {
const RecentlyPlayedScreen({super.key});
@override
Widget build(BuildContext context) {
final db = context.read<MeloDb>();
return Scaffold(
appBar: AppBar(title: const Text('Zuletzt hinzugefügt')),
appBar: AppBar(title: const Text('Zuletzt gehört')),
body: StreamBuilder<List<Song>>(
stream: db.watchRecent(limit: 100),
stream: db.watchRecentlyPlayed(limit: 100),
builder: (context, snapshot) {
final songs = snapshot.data ?? const <Song>[];
if (songs.isEmpty) {
return const Center(
child: Text('Noch nichts hinzugefügt',
child: Text('Noch nichts abgespielt',
style: TextStyle(color: MeloTheme.text2)),
);
}