feat: Add playlist selection screen and basic web IPTV player.

This commit is contained in:
Michael committed 2026-01-01 18:32:39 +01:00
1 parent c165ff5d40
commit 2d418e4e0c
3 files changed
+85 -46

No files matched your search

@@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../../core/services/playlist_api_service.dart';
import '../../../core/models/playlist_config.dart';
import '../../../core/theme/app_colors.dart';
import '../../auth/providers/auth_provider.dart';
/// Provider for fetching playlists from API
@@ -55,27 +56,28 @@ class PlaylistSelectionScreen extends ConsumerWidget {
),
body: Container(
decoration: const BoxDecoration(
gradient: RadialGradient(
center: Alignment.center,
radius: 1.5,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xFF2C2C2E), // Dark Grey (Apple TV Surface)
Color(0xFF000000), // Pure Black
Color(0xFF0F1014), // Deep Space Dark
Color(0xFF181920), // Soft Eerie Black
],
stops: [0.0, 1.0],
),
),
child: playlistsAsync.when(
loading: () => const Center(child: CircularProgressIndicator()),
loading: () => const Center(
child: CircularProgressIndicator(color: AppColors.primary),
),
error: (error, stack) => Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.error_outline, size: 64, color: Colors.red.shade400),
Icon(Icons.error_outline, size: 64, color: AppColors.error),
const SizedBox(height: 16),
Text(
'Error loading playlists',
style: GoogleFonts.roboto(
style: GoogleFonts.outfit(
fontSize: 18,
color: Colors.white70,
),
@@ -83,7 +85,11 @@ class PlaylistSelectionScreen extends ConsumerWidget {
const SizedBox(height: 8),
ElevatedButton(
onPressed: () => ref.refresh(playlistsProvider),
child: const Text('Retry'),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.primary,
foregroundColor: Colors.white,
),
child: Text('Retry', style: GoogleFonts.inter()),
),
],
),
@@ -102,7 +108,7 @@ class PlaylistSelectionScreen extends ConsumerWidget {
const SizedBox(height: 16),
Text(
'No playlists available',
style: GoogleFonts.roboto(
style: GoogleFonts.outfit(
fontSize: 18,
color: Colors.white60,
),
@@ -112,7 +118,7 @@ class PlaylistSelectionScreen extends ConsumerWidget {
currentUser?.isAdmin ?? false
? 'Add playlists in Admin Panel'
: 'Contact administrator',
style: GoogleFonts.roboto(
style: GoogleFonts.inter(
fontSize: 14,
color: Colors.white38,
),
@@ -124,16 +130,17 @@ class PlaylistSelectionScreen extends ConsumerWidget {
return GridView.builder(
padding: const EdgeInsets.fromLTRB(
24,
48,
100,
24,
24,
), // Top padding for transparent AppBar
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 24,
mainAxisSpacing: 24,
childAspectRatio: 1.5,
48,
48,
), // More padding for cinematic feel
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount:
MediaQuery.of(context).size.width > 1200 ? 4 : 3,
crossAxisSpacing: 32,
mainAxisSpacing: 32,
childAspectRatio: 1.4,
),
itemCount: playlists.length,
itemBuilder: (context, index) {
@@ -181,20 +188,21 @@ class _PlaylistCardState extends State<_PlaylistCard> {
duration: const Duration(milliseconds: 200),
decoration: BoxDecoration(
color: _isHovered
? Colors.white.withOpacity(0.15)
: Colors.white.withOpacity(0.05), // Glass effect
borderRadius: BorderRadius.circular(16),
? Colors.white.withOpacity(0.1)
: Colors.white.withOpacity(0.03), // Subtle glass
borderRadius: BorderRadius.circular(24),
border: Border.all(
color: _isHovered
? Colors.white.withOpacity(0.5)
: Colors.white.withOpacity(0.1),
? AppColors.primary.withOpacity(0.5)
: Colors.white.withOpacity(0.08),
width: 1.5,
),
boxShadow: _isHovered
? [
BoxShadow(
color: Colors.black.withOpacity(0.3),
blurRadius: 20,
color: AppColors.primary.withOpacity(0.2),
blurRadius: 30,
spreadRadius: -5,
offset: const Offset(0, 10),
),
]
@@ -205,37 +213,57 @@ class _PlaylistCardState extends State<_PlaylistCard> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
AnimatedContainer(
duration: const Duration(milliseconds: 200),
width: 56,
height: 56,
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.2), // Accent color tint
gradient: _isHovered
? AppColors.primaryGradient
: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
Colors.white.withOpacity(0.05),
],
),
shape: BoxShape.circle,
boxShadow: _isHovered
? [
BoxShadow(
color: AppColors.primary.withOpacity(0.4),
blurRadius: 16,
offset: const Offset(0, 4),
)
]
: [],
),
child: const Icon(
Icons.playlist_play,
child: Icon(
Icons.playlist_play_rounded,
size: 32,
color: Colors.white, // White icon
color: _isHovered ? Colors.white : Colors.white70,
),
),
const SizedBox(height: 16),
const SizedBox(height: 20),
Text(
widget.playlist.name,
style: GoogleFonts.outfit(
// Using Outfit for modern look
fontSize: 20,
fontSize: 22,
fontWeight: FontWeight.bold,
color: Colors.white,
height: 1.2,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 6),
const SizedBox(height: 8),
Text(
Uri.tryParse(widget.playlist.dns)?.host ?? widget.playlist.dns,
style: GoogleFonts.inter(
fontSize: 13,
color: Colors.white54,
color: Colors.white38,
letterSpacing: 0.5,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,