## Critical Blockers Fixed - Remove playbackState.addError() which broke audio_service permanently - Move error handling from audio_handler to song_list where UI context exists - Display error in SnackBar instead of destroying playback stream - Add escapeChar parameter to LIKE queries for correct wildcard handling - Fixes broken search for titles with _ or % characters - Add dismissScanError() method to allow closing error banner - Previously banner couldn't be dismissed (missing notifyListeners()) ## Improvements - Remove dead livePaths list, use companions.isNotEmpty instead - Add initial progress update to show total files when scan starts - Add tooltip to now_playing_screen Zurück button - Add proper error handling in song_list with async/await ## Testing - Add regression test for CRITICAL-1: empty scan doesn't delete songs - Add regression test for CRITICAL-2: tombstoned files restore on re-scan - All 11 tests pass Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
46 lines
1.3 KiB
Dart
46 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../player/audio_handler.dart';
|
|
import '../shared/cover.dart';
|
|
import 'database.dart';
|
|
import 'song_media.dart';
|
|
|
|
/// Scrollbare Songliste; Tippen spielt die ganze Liste ab dem Song ab.
|
|
class SongList extends StatelessWidget {
|
|
const SongList(this.songs, {super.key});
|
|
final List<Song> songs;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final handler = context.read<MeloAudioHandler>();
|
|
return ListView.builder(
|
|
itemCount: songs.length,
|
|
itemBuilder: (context, i) {
|
|
final s = songs[i];
|
|
return ListTile(
|
|
leading: CoverImage(
|
|
artUri: s.coverPath != null ? Uri.file(s.coverPath!) : null,
|
|
size: 48,
|
|
radius: 6,
|
|
),
|
|
title: Text(s.title, maxLines: 1, overflow: TextOverflow.ellipsis),
|
|
subtitle: Text(s.artist ?? 'Unbekannt',
|
|
maxLines: 1, overflow: TextOverflow.ellipsis),
|
|
onTap: () async {
|
|
try {
|
|
await playSongs(handler, songs, i);
|
|
} catch (e) {
|
|
if (context.mounted) {
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(content: Text('Wiedergabe fehlgeschlagen: $e')),
|
|
);
|
|
}
|
|
}
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|