Initial commit

This commit is contained in:
2026-05-18 09:37:50 +01:00
commit 4b61602e5a
120 changed files with 5990 additions and 0 deletions
+88
View File
@@ -0,0 +1,88 @@
// lib/screens/permission_screen.dart
//
// Shown when the user hasn't yet granted Notification Listener access.
// Explains why it's needed and opens the system settings page.
import 'package:flutter/material.dart';
import '../services/media_service.dart';
class PermissionScreen extends StatelessWidget {
final MediaService mediaService;
final VoidCallback onPermissionGranted;
const PermissionScreen({
super.key,
required this.mediaService,
required this.onPermissionGranted,
});
Future<void> _openSettings(BuildContext context) async {
await mediaService.requestPermission();
// Poll after a short delay — the user may have just come back from settings
await Future.delayed(const Duration(seconds: 1));
final granted = await mediaService.hasPermission();
if (granted) onPermissionGranted();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF0D0D0D),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(36),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.notifications_active_outlined,
color: Colors.white54,
size: 72,
),
const SizedBox(height: 32),
const Text(
'Notification Access Needed',
style: TextStyle(
color: Colors.white,
fontSize: 22,
fontWeight: FontWeight.w700,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 16),
Text(
'OpenVinyl reads your currently playing music from your notification shade — '
'it never accesses your messages or other notifications.\n\n'
'Tap below to open system settings and enable access for OpenVinyl.',
style: TextStyle(
color: Colors.white.withOpacity(0.6),
fontSize: 15,
height: 1.55,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 40),
FilledButton.icon(
onPressed: () => _openSettings(context),
icon: const Icon(Icons.settings_outlined),
label: const Text('Open Settings'),
style: FilledButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: Colors.black,
padding: const EdgeInsets.symmetric(
horizontal: 32,
vertical: 14,
),
textStyle: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
),
);
}
}