Initial commit

This commit is contained in:
Dustin-Mike Jens Hähnel
2026-08-16 18:46:06 +02:00
commit b5ab7bd9dd
126 changed files with 7952 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'database.dart';
import 'song_list.dart';
class SearchScreen extends StatefulWidget {
const SearchScreen({super.key});
@override
State<SearchScreen> createState() => _SearchScreenState();
}
class _SearchScreenState extends State<SearchScreen> {
String _query = '';
@override
Widget build(BuildContext context) {
final db = context.read<MeloDb>();
return Scaffold(
appBar: AppBar(
title: TextField(
autofocus: false,
decoration: const InputDecoration(
hintText: 'Titel, Künstler, Album …',
border: InputBorder.none,
prefixIcon: Icon(Icons.search),
),
onChanged: (v) => setState(() => _query = v.trim()),
),
),
body: _query.isEmpty
? const Center(
child: Text('Suchbegriff eingeben',
style: TextStyle(color: Colors.white54)),
)
: StreamBuilder<List<Song>>(
stream: db.searchSongs(_query),
builder: (context, snapshot) {
final songs = snapshot.data ?? const [];
if (songs.isEmpty) {
return const Center(
child: Text('Nichts gefunden',
style: TextStyle(color: Colors.white54)),
);
}
return SongList(songs);
},
),
);
}
}