mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-17 20:29:30 +02:00
134 lines
4.5 KiB
Dart
134 lines
4.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
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';
|
|
import '../providers/xtream_provider.dart';
|
|
|
|
/// Provider for fetching playlists from API
|
|
final playlistsProvider = FutureProvider<List<PlaylistConfig>>((ref) async {
|
|
final service = PlaylistApiService();
|
|
return service.getPlaylists();
|
|
});
|
|
|
|
class PlaylistSelectionScreen extends ConsumerWidget {
|
|
|
|
class _PlaylistCard extends StatefulWidget {
|
|
final PlaylistConfig playlist;
|
|
final VoidCallback onTap;
|
|
|
|
const _PlaylistCard({
|
|
required this.playlist,
|
|
required this.onTap,
|
|
});
|
|
|
|
@override
|
|
State<_PlaylistCard> createState() => _PlaylistCardState();
|
|
}
|
|
|
|
class _PlaylistCardState extends State<_PlaylistCard> {
|
|
bool _isHovered = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MouseRegion(
|
|
onEnter: (_) => setState(() => _isHovered = true),
|
|
onExit: (_) => setState(() => _isHovered = false),
|
|
cursor: SystemMouseCursors.click,
|
|
child: GestureDetector(
|
|
onTap: widget.onTap,
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
decoration: BoxDecoration(
|
|
color: _isHovered
|
|
? Colors.white.withOpacity(0.1)
|
|
: Colors.white.withOpacity(0.03), // Subtle glass
|
|
borderRadius: BorderRadius.circular(24),
|
|
border: Border.all(
|
|
color: _isHovered
|
|
? AppColors.primary.withOpacity(0.5)
|
|
: Colors.white.withOpacity(0.08),
|
|
width: 1.5,
|
|
),
|
|
boxShadow: _isHovered
|
|
? [
|
|
BoxShadow(
|
|
color: AppColors.primary.withOpacity(0.2),
|
|
blurRadius: 30,
|
|
spreadRadius: -5,
|
|
offset: const Offset(0, 10),
|
|
),
|
|
]
|
|
: [],
|
|
),
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
width: 56,
|
|
height: 56,
|
|
decoration: BoxDecoration(
|
|
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: Icon(
|
|
Icons.playlist_play_rounded,
|
|
size: 32,
|
|
color: _isHovered ? Colors.white : Colors.white70,
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
Text(
|
|
widget.playlist.name,
|
|
style: GoogleFonts.outfit(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
height: 1.2,
|
|
),
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
Uri.tryParse(widget.playlist.dns)?.host ?? widget.playlist.dns,
|
|
style: GoogleFonts.inter(
|
|
fontSize: 13,
|
|
color: Colors.white38,
|
|
letterSpacing: 0.5,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|