Melo v2.10 - YouTube Proxy, Download-Screen, Logger, iOS

This commit is contained in:
Hermes (Server)
2026-07-26 14:24:10 +02:00
parent b4baef5875
commit 3e9389ab59
17 changed files with 1065 additions and 347 deletions
+11 -94
View File
@@ -9,10 +9,9 @@ import '../widgets/melo_header.dart';
import '../widgets/statistik_card.dart';
import '../widgets/tag_leiste.dart';
import '../widgets/song_tile.dart';
import '../widgets/recent_widget.dart';
import '../widgets/tag_stats_widget.dart';
import '../widgets/navidrome_browser.dart';
import '../widgets/playlist_sheet.dart';
import 'download_screen.dart';
class MeloHome extends StatefulWidget {
const MeloHome({super.key});
@@ -237,102 +236,15 @@ class _MeloHomeState extends State<MeloHome> {
}
Future<void> _zeigeDownloadDialog() async {
final controller = TextEditingController();
final url = await showDialog<String>(
context: context,
builder: (ctx) => AlertDialog(
backgroundColor: MeloTheme.dunkel1,
title: const Text('⬇ YouTube-Link einfügen', style: TextStyle(color: Colors.white)),
content: TextField(
controller: controller,
autofocus: true,
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
hintText: 'https://youtube.com/watch?v=...',
hintStyle: TextStyle(color: Colors.grey),
border: OutlineInputBorder(),
),
),
actions: [
TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('Abbrechen')),
TextButton(
onPressed: () => Navigator.pop(ctx, controller.text),
child: const Text('Download', style: TextStyle(color: MeloTheme.rot)),
),
],
),
);
if (url == null || url.isEmpty) return;
if (!mounted) return;
showDialog(
context: context,
barrierDismissible: false,
builder: (ctx) {
Timer? timer;
return StatefulBuilder(
builder: (ctx, setDialogState) {
timer ??= Timer.periodic(const Duration(milliseconds: 200), (_) {
if (ctx.mounted) setDialogState(() {});
});
_vm.downloader.downloadVonUrl(url).then((song) {
timer?.cancel();
if (song != null && ctx.mounted) {
setDialogState(() {});
Future.delayed(const Duration(milliseconds: 800), () {
if (ctx.mounted) Navigator.pop(ctx);
_vm.ladeSongs();
});
} else if (ctx.mounted) {
Future.delayed(const Duration(seconds: 3), () {
if (ctx.mounted) Navigator.pop(ctx);
});
}
});
final fehler = _vm.downloader.fehler;
final fortschritt = _vm.downloader.fortschritt;
final statusText = fehler ?? _vm.downloader.aktuellerTitel ?? 'Song wird heruntergeladen...';
return AlertDialog(
backgroundColor: MeloTheme.dunkel1,
title: const Text('⬇ Download', style: TextStyle(color: Colors.white)),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (fehler == null)
LinearProgressIndicator(
value: fortschritt > 0 ? fortschritt : null,
color: MeloTheme.rot,
)
else
const Icon(Icons.error, color: Colors.red, size: 40),
const SizedBox(height: 12),
Text(statusText,
style: TextStyle(fontSize: 13, color: fehler != null ? Colors.red : Colors.white70),
textAlign: TextAlign.center,
),
if (fortschritt > 0) ...[
const SizedBox(height: 8),
Text('${(fortschritt * 100).toStringAsFixed(0)}%',
style: const TextStyle(fontSize: 12, color: Colors.grey)),
],
],
),
);
},
);
},
);
// Statt Dialog → zum Download-Tab wechseln
setState(() => _aktiverTab = 1);
}
@override
Widget build(BuildContext context) {
return ListenableBuilder(
listenable: _vm,
builder: (_, __) {
builder: (_, _) {
if (_vm.ladt) {
return const Scaffold(
backgroundColor: MeloTheme.schwarz,
@@ -348,9 +260,14 @@ class _MeloHomeState extends State<MeloHome> {
return Scaffold(
backgroundColor: MeloTheme.schwarz,
body: SafeArea(
child: Column(
child: _aktiverTab == 1
? DownloadScreen(
downloader: _vm.downloader,
onSongsChanged: _vm.ladeSongs,
)
: Column(
children: [
MeloHeader(onDownload: _zeigeDownloadDialog, onSearch: _zeigeSuche),
MeloHeader(onDownload: _zeigeDownloadDialog, onSearch: _zeigeSuche, onServer: _zeigeServerBrowser),
// ─── EIN/AUS: RecentWidget (Zuletzt gehört) ───
// Entferne die Kommentarzeichen um RecentWidget zu aktivieren:
// RecentWidget(songs: _vm.letzteSongs, onPlay: _vm.spieleSong),