- Bibliotheks-Statistik: Song-Anzahl + Gesamtspieldauer via watchSongs() (reine Summier-/Format-Funktion in lib/settings/library_stats.dart, unabhängig von Flutter/Plattform testbar) - Berechtigungen: Musik-Berechtigung öffnet Systemeinstellungen über das bereits vorhandene openMusicPermissionSettings() - Über Melo: kurzer Name + Slogan, keine erfundene Versionsnummer (package_info_plus ist keine Dependency) - Keine Platzhalter für Profil/Cloud-Sync/Geräte-Verwaltung, da es noch kein Account-/Cloud-System gibt (Phase 2) - HomeShell nutzt SettingsScreen statt des Settings-Placeholders, toter _Placeholder-Widget-Code entfernt Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
104 lines
3.0 KiB
Dart
104 lines
3.0 KiB
Dart
import 'package:audio_service/audio_service.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'library/database.dart';
|
|
import 'library/library_screen.dart';
|
|
import 'library/library_service.dart';
|
|
import 'library/playlist_service.dart';
|
|
import 'library/search_screen.dart';
|
|
import 'player/audio_handler.dart';
|
|
import 'player/mini_player.dart';
|
|
import 'player/now_playing_screen.dart';
|
|
import 'playlists/playlists_screen.dart';
|
|
import 'settings/settings_screen.dart';
|
|
import 'shared/theme.dart';
|
|
|
|
late final MeloAudioHandler _handler;
|
|
late final MeloDb _db;
|
|
late final LibraryService _library;
|
|
late final PlaylistService _playlists;
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
_db = MeloDb();
|
|
_library = LibraryService(_db);
|
|
_playlists = PlaylistService(_db);
|
|
_handler = await AudioService.init(
|
|
builder: () => MeloAudioHandler(db: _db),
|
|
config: const AudioServiceConfig(
|
|
androidNotificationChannelId: 'de.baka.melo.audio',
|
|
androidNotificationChannelName: 'Melo',
|
|
androidNotificationOngoing: true,
|
|
),
|
|
);
|
|
runApp(const MeloApp());
|
|
}
|
|
|
|
class MeloApp extends StatelessWidget {
|
|
const MeloApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MultiProvider(
|
|
providers: [
|
|
Provider<MeloAudioHandler>.value(value: _handler),
|
|
Provider<MeloDb>.value(value: _db),
|
|
ChangeNotifierProvider<LibraryService>.value(value: _library),
|
|
ChangeNotifierProvider<PlaylistService>.value(value: _playlists),
|
|
],
|
|
child: MaterialApp(
|
|
title: 'Melo',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: MeloTheme.dark,
|
|
home: const HomeShell(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class HomeShell extends StatefulWidget {
|
|
const HomeShell({super.key});
|
|
|
|
@override
|
|
State<HomeShell> createState() => _HomeShellState();
|
|
}
|
|
|
|
class _HomeShellState extends State<HomeShell> {
|
|
int _index = 0;
|
|
|
|
static const _tabs = <Widget>[
|
|
NowPlayingScreen(),
|
|
LibraryScreen(),
|
|
PlaylistsScreen(),
|
|
SearchScreen(),
|
|
SettingsScreen(),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Column(
|
|
children: [
|
|
Expanded(child: IndexedStack(index: _index, children: _tabs)),
|
|
if (_index != 0) const MiniPlayer(),
|
|
],
|
|
),
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _index,
|
|
onTap: (i) => setState(() => _index = i),
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.play_circle_outline), label: 'Player'),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.library_music), label: 'Bibliothek'),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.playlist_play), label: 'Playlisten'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Suche'),
|
|
BottomNavigationBarItem(icon: Icon(Icons.settings), label: 'Settings'),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|