- Meine Musik als Startbildschirm ohne Topbar: Kopfzeile (Einstellungen, Suche, Musikerkennung), Schnellzugriffe, Shuffle + Sortieren, Liederliste - Sortierung nach Zuletzt hinzugefuegt / Name (A-Z-#) / Wie oft abgespielt, auf- und absteigend, pro Liste gespeichert (SortStore) - Favoriten als eigener Tab mit gleicher Shuffle-/Sortier-Leiste - Download-Tab uebernimmt den Navidrome-Server-Browser - DB-Schema 3: playCount, gezaehlt beim Titelstart - Theme auf #0B0B10 / #c0392b - Scan-Aktionen aus der entfallenen Topbar jetzt in den Einstellungen Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011snPXPafPC5i87o68H14W7
83 lines
2.5 KiB
Dart
83 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../shared/cover.dart';
|
|
import 'database.dart';
|
|
import 'song_grouping.dart';
|
|
import 'song_list.dart';
|
|
|
|
/// Bibliotheks-Tab: Album-Übersicht, gruppiert aus [MeloDb.watchSongs].
|
|
class AlbumListScreen extends StatelessWidget {
|
|
const AlbumListScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final db = context.read<MeloDb>();
|
|
return StreamBuilder<List<Song>>(
|
|
stream: db.watchSongs(),
|
|
builder: (context, snapshot) {
|
|
final songs = snapshot.data ?? const [];
|
|
if (songs.isEmpty) {
|
|
return const Center(
|
|
child: Text('Keine Alben', style: TextStyle(color: Colors.white54)),
|
|
);
|
|
}
|
|
final grouped = groupByAlbum(songs);
|
|
final albums = grouped.keys.toList();
|
|
return ListView.builder(
|
|
itemCount: albums.length,
|
|
itemBuilder: (context, i) {
|
|
final album = albums[i];
|
|
final albumSongs = grouped[album]!;
|
|
final coverPath = albumSongs.first.coverPath;
|
|
return ListTile(
|
|
leading: CoverImage(
|
|
artUri: coverPath != null ? Uri.file(coverPath) : null,
|
|
size: 48,
|
|
radius: 6,
|
|
),
|
|
title: Text(album, maxLines: 1, overflow: TextOverflow.ellipsis),
|
|
subtitle: Text('${albumArtistLabel(albumSongs)} · ${albumSongs.length} Songs',
|
|
maxLines: 1, overflow: TextOverflow.ellipsis),
|
|
onTap: () => Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (_) => _AlbumSongsScreen(album: album, songs: albumSongs),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Zeigt alle Songs eines Albums.
|
|
class _AlbumSongsScreen extends StatelessWidget {
|
|
const _AlbumSongsScreen({required this.album, required this.songs});
|
|
final String album;
|
|
final List<Song> songs;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(album)),
|
|
body: SongList(songs),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Alben-Übersicht als eigener Bildschirm (Schnellzugriff "Alben").
|
|
class AlbumsScreen extends StatelessWidget {
|
|
const AlbumsScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Alben')),
|
|
body: const AlbumListScreen(),
|
|
);
|
|
}
|
|
}
|