mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-23 15:08:07 +02:00
commit
3dd4952f82
9 files changed
+347
-204
No files matched your search
@@ -10,6 +10,7 @@ import '../models/playlist_config.dart';
|
|||||||
import '../../mobile/features/auth/screens/mobile_login_screen.dart';
|
import '../../mobile/features/auth/screens/mobile_login_screen.dart';
|
||||||
import '../../mobile/features/iptv/screens/mobile_playlist_selection_screen.dart';
|
import '../../mobile/features/iptv/screens/mobile_playlist_selection_screen.dart';
|
||||||
import '../../mobile/features/iptv/screens/mobile_dashboard_screen.dart';
|
import '../../mobile/features/iptv/screens/mobile_dashboard_screen.dart';
|
||||||
|
import '../widgets/themed_loading_screen.dart';
|
||||||
|
|
||||||
final routerProvider = Provider<GoRouter>((ref) {
|
final routerProvider = Provider<GoRouter>((ref) {
|
||||||
final authState = ref.watch(authProvider);
|
final authState = ref.watch(authProvider);
|
||||||
@@ -71,7 +72,7 @@ final routerProvider = Provider<GoRouter>((ref) {
|
|||||||
context.go('/playlists');
|
context.go('/playlists');
|
||||||
});
|
});
|
||||||
return const Scaffold(
|
return const Scaffold(
|
||||||
body: Center(child: CircularProgressIndicator()),
|
body: ThemedLoading(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../theme/app_colors.dart';
|
||||||
|
|
||||||
|
class ThemedLoading extends StatelessWidget {
|
||||||
|
const ThemedLoading({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
gradient: RadialGradient(
|
||||||
|
center: Alignment(0, -0.2),
|
||||||
|
radius: 1.5,
|
||||||
|
colors: [
|
||||||
|
Color(0xFF2C2C2E),
|
||||||
|
Color(0xFF000000),
|
||||||
|
],
|
||||||
|
stops: [0.0, 1.0],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: const Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.white,
|
||||||
|
strokeWidth: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,29 +17,9 @@ final usersProvider = FutureProvider<List<AppUser>>((ref) async {
|
|||||||
return service.getAllUsers();
|
return service.getAllUsers();
|
||||||
});
|
});
|
||||||
|
|
||||||
class AdminPanel extends ConsumerStatefulWidget {
|
class AdminPanel extends StatelessWidget {
|
||||||
const AdminPanel({super.key});
|
const AdminPanel({super.key});
|
||||||
|
|
||||||
@override
|
|
||||||
ConsumerState<AdminPanel> createState() => _AdminPanelState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AdminPanelState extends ConsumerState<AdminPanel>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
late TabController _tabController;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_tabController = TabController(length: 2, vsync: this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_tabController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -56,64 +36,94 @@ class _AdminPanelState extends ConsumerState<AdminPanel>
|
|||||||
stops: [0.0, 1.0],
|
stops: [0.0, 1.0],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
child: const AdminContent(),
|
||||||
child: Column(
|
),
|
||||||
children: [
|
);
|
||||||
// Custom Glass Header
|
}
|
||||||
Container(
|
}
|
||||||
padding: const EdgeInsets.all(24),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
GlassCard(
|
|
||||||
borderRadius: 12,
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
showBorder: false,
|
|
||||||
onTap: () => context.go('/playlists'),
|
|
||||||
child: const Icon(Icons.arrow_back, color: Colors.white70),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Text(
|
|
||||||
'Administration',
|
|
||||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
|
||||||
color: Colors.white,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
// Custom Tab Bar Indicator
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: AppColors.surface,
|
|
||||||
borderRadius: BorderRadius.circular(50),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
_buildTabButton(0, 'Playlists', Icons.playlist_play),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
_buildTabButton(1, 'Users', Icons.people),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// Content
|
class AdminContent extends ConsumerStatefulWidget {
|
||||||
Expanded(
|
const AdminContent({super.key});
|
||||||
child: TabBarView(
|
|
||||||
controller: _tabController,
|
@override
|
||||||
physics: const NeverScrollableScrollPhysics(), // Custom tabs handle ref
|
ConsumerState<AdminContent> createState() => _AdminContentState();
|
||||||
children: const [
|
}
|
||||||
_PlaylistsTab(),
|
|
||||||
_UsersTab(),
|
class _AdminContentState extends ConsumerState<AdminContent>
|
||||||
],
|
with SingleTickerProviderStateMixin {
|
||||||
|
late TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(length: 2, vsync: this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_tabController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// Custom Glass Header
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// Back button only if standalone (optional, keeping for now)
|
||||||
|
GlassCard(
|
||||||
|
borderRadius: 12,
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
showBorder: false,
|
||||||
|
onTap: () => context.go('/playlists'),
|
||||||
|
child: const Icon(Icons.arrow_back, color: Colors.white70),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 16),
|
||||||
],
|
Text(
|
||||||
|
'Administration',
|
||||||
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
// Custom Tab Bar Indicator
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.surface,
|
||||||
|
borderRadius: BorderRadius.circular(50),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
_buildTabButton(0, 'Playlists', Icons.playlist_play),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
_buildTabButton(1, 'Users', Icons.people),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
// Content
|
||||||
|
Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
controller: _tabController,
|
||||||
|
physics: const NeverScrollableScrollPhysics(), // Custom tabs handle ref
|
||||||
|
children: const [
|
||||||
|
_PlaylistsTab(),
|
||||||
|
_UsersTab(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,12 +140,25 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
|
|||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _usernameController,
|
controller: _usernameController,
|
||||||
style: const TextStyle(color: AppColors.textPrimary),
|
style: const TextStyle(color: Colors.white),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Username',
|
labelText: 'Username',
|
||||||
prefixIcon: const Icon(Icons.person_outline),
|
labelStyle: const TextStyle(color: Colors.white70),
|
||||||
fillColor: AppColors.surface,
|
prefixIcon: const Icon(Icons.person_outline, color: Colors.white70),
|
||||||
hoverColor: AppColors.surface.withOpacity(0.8),
|
filled: true,
|
||||||
|
fillColor: Colors.white.withOpacity(0.05),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(color: Colors.white.withOpacity(0.1)),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(color: Colors.white.withOpacity(0.1)),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: const BorderSide(color: AppColors.primary),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.trim().isEmpty) {
|
if (value == null || value.trim().isEmpty) {
|
||||||
@@ -160,16 +173,31 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
|
|||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
obscureText: _obscurePassword,
|
obscureText: _obscurePassword,
|
||||||
style: const TextStyle(color: AppColors.textPrimary),
|
style: const TextStyle(color: Colors.white),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
prefixIcon: const Icon(Icons.lock_outline),
|
labelStyle: const TextStyle(color: Colors.white70),
|
||||||
fillColor: AppColors.surface,
|
prefixIcon: const Icon(Icons.lock_outline, color: Colors.white70),
|
||||||
|
filled: true,
|
||||||
|
fillColor: Colors.white.withOpacity(0.05),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(color: Colors.white.withOpacity(0.1)),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: BorderSide(color: Colors.white.withOpacity(0.1)),
|
||||||
|
),
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
borderSide: const BorderSide(color: AppColors.primary),
|
||||||
|
),
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
_obscurePassword
|
_obscurePassword
|
||||||
? Icons.visibility_outlined
|
? Icons.visibility_outlined
|
||||||
: Icons.visibility_off_outlined,
|
: Icons.visibility_off_outlined,
|
||||||
|
color: Colors.white70,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import '../providers/playback_positions_provider.dart';
|
|||||||
import '../providers/settings_provider.dart';
|
import '../providers/settings_provider.dart';
|
||||||
import '../widgets/epg_overlay.dart';
|
import '../widgets/epg_overlay.dart';
|
||||||
import '../../../core/models/playlist_config.dart';
|
import '../../../core/models/playlist_config.dart';
|
||||||
|
import '../../../core/models/iptv_models.dart';
|
||||||
|
import '../../../core/widgets/themed_loading_screen.dart';
|
||||||
|
|
||||||
/// Stream type enum for player
|
/// Stream type enum for player
|
||||||
enum StreamType { live, vod, series }
|
enum StreamType { live, vod, series }
|
||||||
@@ -21,6 +23,8 @@ class PlayerScreen extends ConsumerStatefulWidget {
|
|||||||
final StreamType streamType;
|
final StreamType streamType;
|
||||||
final String containerExtension;
|
final String containerExtension;
|
||||||
final PlaylistConfig playlist;
|
final PlaylistConfig playlist;
|
||||||
|
final List<Channel>? channels;
|
||||||
|
final int initialIndex;
|
||||||
|
|
||||||
const PlayerScreen({
|
const PlayerScreen({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -29,6 +33,8 @@ class PlayerScreen extends ConsumerStatefulWidget {
|
|||||||
required this.playlist,
|
required this.playlist,
|
||||||
this.streamType = StreamType.live,
|
this.streamType = StreamType.live,
|
||||||
this.containerExtension = 'mp4',
|
this.containerExtension = 'mp4',
|
||||||
|
this.channels,
|
||||||
|
this.initialIndex = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -41,18 +47,19 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
String? _statusMessage;
|
String? _statusMessage;
|
||||||
late String _viewId;
|
late String _viewId;
|
||||||
late String _contentId;
|
late String _contentId;
|
||||||
|
late int _currentIndex;
|
||||||
bool _isInitialized = false;
|
bool _isInitialized = false;
|
||||||
bool _isLoading = true;
|
bool _isLoading = true;
|
||||||
|
bool _showControls = false;
|
||||||
|
Timer? _controlsTimer;
|
||||||
StreamSubscription? _messageSubscription;
|
StreamSubscription? _messageSubscription;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_currentIndex = widget.initialIndex;
|
||||||
_viewId = 'iptv-player-${widget.streamId}-${DateTime.now().millisecondsSinceEpoch}';
|
_viewId = 'iptv-player-${widget.streamId}-${DateTime.now().millisecondsSinceEpoch}';
|
||||||
// Content ID for resume feature
|
|
||||||
_contentId = widget.streamType == StreamType.live
|
|
||||||
? '' // Live streams don't need resume
|
|
||||||
: '${widget.streamType.name}_${widget.streamId}';
|
|
||||||
_initializePlayer();
|
_initializePlayer();
|
||||||
_setupMessageListener();
|
_setupMessageListener();
|
||||||
}
|
}
|
||||||
@@ -84,9 +91,50 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_messageSubscription?.cancel();
|
_messageSubscription?.cancel();
|
||||||
|
_controlsTimer?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _hideControls() {
|
||||||
|
if (!mounted) return;
|
||||||
|
setState(() {
|
||||||
|
_showControls = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onHover() {
|
||||||
|
if (!_showControls) {
|
||||||
|
setState(() {
|
||||||
|
_showControls = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
_controlsTimer?.cancel();
|
||||||
|
_controlsTimer = Timer(const Duration(seconds: 3), _hideControls);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _playNext() {
|
||||||
|
if (widget.channels == null || widget.channels!.isEmpty) return;
|
||||||
|
final nextIndex = (_currentIndex + 1) % widget.channels!.length;
|
||||||
|
_switchChannel(nextIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _playPrevious() {
|
||||||
|
if (widget.channels == null || widget.channels!.isEmpty) return;
|
||||||
|
final prevIndex = (_currentIndex - 1 + widget.channels!.length) % widget.channels!.length;
|
||||||
|
_switchChannel(prevIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _switchChannel(int index) {
|
||||||
|
setState(() {
|
||||||
|
_currentIndex = index;
|
||||||
|
_isLoading = true;
|
||||||
|
_isInitialized = false;
|
||||||
|
_errorMessage = null;
|
||||||
|
});
|
||||||
|
// Give UI a moment to clear before re-initializing
|
||||||
|
Future.microtask(() => _initializePlayer());
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _initializePlayer() async {
|
Future<void> _initializePlayer() async {
|
||||||
try {
|
try {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -104,6 +152,16 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
final xtreamService = ref.read(xtreamServiceProvider(widget.playlist));
|
final xtreamService = ref.read(xtreamServiceProvider(widget.playlist));
|
||||||
xtreamService.setPlaylist(widget.playlist);
|
xtreamService.setPlaylist(widget.playlist);
|
||||||
|
|
||||||
|
// Determine effective Stream ID (from navigation or initial)
|
||||||
|
final currentStreamId = widget.channels != null && widget.channels!.isNotEmpty
|
||||||
|
? widget.channels![_currentIndex].streamId
|
||||||
|
: widget.streamId;
|
||||||
|
|
||||||
|
// Set content ID for resume features
|
||||||
|
_contentId = widget.streamType == StreamType.live
|
||||||
|
? ''
|
||||||
|
: '${widget.streamType.name}_$currentStreamId';
|
||||||
|
|
||||||
String hlsUrl;
|
String hlsUrl;
|
||||||
|
|
||||||
if (widget.streamType == StreamType.live) {
|
if (widget.streamType == StreamType.live) {
|
||||||
@@ -115,7 +173,7 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
// Build the FFmpeg endpoint URL with streaming settings
|
// Build the FFmpeg endpoint URL with streaming settings
|
||||||
final settings = ref.read(iptvSettingsProvider);
|
final settings = ref.read(iptvSettingsProvider);
|
||||||
final baseUrl = html.window.location.origin;
|
final baseUrl = html.window.location.origin;
|
||||||
final iptvUrl = '${widget.playlist.dns}/live/${widget.playlist.username}/${widget.playlist.password}/${widget.streamId}.ts';
|
final iptvUrl = '${widget.playlist.dns}/live/${widget.playlist.username}/${widget.playlist.password}/$currentStreamId.ts';
|
||||||
final encodedUrl = Uri.encodeComponent(iptvUrl);
|
final encodedUrl = Uri.encodeComponent(iptvUrl);
|
||||||
|
|
||||||
// Map enum values to string params
|
// Map enum values to string params
|
||||||
@@ -137,21 +195,16 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
final modeParam = settings.modeString; // direct, transcode, or auto
|
final modeParam = settings.modeString; // direct, transcode, or auto
|
||||||
|
|
||||||
// Construct the stream URL directly using MPEG-TS format
|
// Construct the stream URL directly using MPEG-TS format
|
||||||
// We add &ext=.ts to force the web player to use mpegts.js which is perfect for low-latency live streams
|
final streamEndpoint = '$baseUrl/api/stream/$currentStreamId?url=$encodedUrl&quality=$qualityParam&buffer=$bufferParam&timeout=$timeoutParam&mode=$modeParam&ext=.ts';
|
||||||
final streamEndpoint = '$baseUrl/api/stream/${widget.streamId}?url=$encodedUrl&quality=$qualityParam&buffer=$bufferParam&timeout=$timeoutParam&mode=$modeParam&ext=.ts';
|
|
||||||
|
|
||||||
debugPrint('PlayerScreen: Starting Direct Stream: $streamEndpoint');
|
debugPrint('PlayerScreen: Starting Direct Stream: $streamEndpoint');
|
||||||
|
|
||||||
// Use the stream endpoint directly as the video source
|
|
||||||
// The server now pipelines fMP4 directly to this URL
|
|
||||||
hlsUrl = streamEndpoint;
|
hlsUrl = streamEndpoint;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// For VOD and Series - use direct proxy streaming with Range support
|
// For VOD and Series - use direct proxy streaming with Range support
|
||||||
// This allows seeking via Range requests
|
|
||||||
final streamUrl = widget.streamType == StreamType.vod
|
final streamUrl = widget.streamType == StreamType.vod
|
||||||
? xtreamService.getVodStreamUrl(widget.streamId, widget.containerExtension)
|
? xtreamService.getVodStreamUrl(currentStreamId, widget.containerExtension)
|
||||||
: xtreamService.getSeriesStreamUrl(widget.streamId, widget.containerExtension);
|
: xtreamService.getSeriesStreamUrl(currentStreamId, widget.containerExtension);
|
||||||
hlsUrl = streamUrl;
|
hlsUrl = streamUrl;
|
||||||
debugPrint('PlayerScreen: Direct playback URL: $hlsUrl');
|
debugPrint('PlayerScreen: Direct playback URL: $hlsUrl');
|
||||||
}
|
}
|
||||||
@@ -211,89 +264,112 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: _showControls ? AppBar(
|
||||||
title: Text(widget.title),
|
title: Text(widget.channels != null && widget.channels!.isNotEmpty
|
||||||
backgroundColor: Colors.black,
|
? widget.channels![_currentIndex].name
|
||||||
|
: widget.title),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
),
|
elevation: 0,
|
||||||
|
) : null,
|
||||||
|
extendBodyBehindAppBar: true,
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
body: _errorMessage != null
|
body: MouseRegion(
|
||||||
? Center(
|
onHover: (_) => _onHover(),
|
||||||
child: Column(
|
child: _errorMessage != null
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
? Center(
|
||||||
children: [
|
child: Column(
|
||||||
const Icon(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
Icons.error_outline,
|
children: [
|
||||||
size: 64,
|
const Icon(Icons.error_outline, size: 64, color: Colors.red),
|
||||||
color: Colors.red,
|
const SizedBox(height: 16),
|
||||||
),
|
const Text('Failed to load stream', style: TextStyle(color: Colors.white, fontSize: 18)),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 8),
|
||||||
const Text(
|
Text(_errorMessage!, style: const TextStyle(color: Colors.white70)),
|
||||||
'Failed to load stream',
|
const SizedBox(height: 24),
|
||||||
style: TextStyle(
|
ElevatedButton(
|
||||||
color: Colors.white,
|
onPressed: () {
|
||||||
fontSize: 18,
|
setState(() {
|
||||||
fontWeight: FontWeight.bold,
|
_errorMessage = null;
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
_initializePlayer();
|
||||||
|
},
|
||||||
|
child: const Text('Retry'),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
const SizedBox(height: 8),
|
),
|
||||||
Padding(
|
)
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
: _isLoading
|
||||||
child: Text(
|
? const ThemedLoading()
|
||||||
_errorMessage!,
|
: !_isInitialized
|
||||||
style: const TextStyle(color: Colors.white70),
|
? const ThemedLoading()
|
||||||
textAlign: TextAlign.center,
|
: Stack(
|
||||||
),
|
children: [
|
||||||
),
|
// HTML5 video player via iframe
|
||||||
const SizedBox(height: 24),
|
HtmlElementView(viewType: _viewId),
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () {
|
// Hover Controls Layer
|
||||||
setState(() {
|
if (_showControls) ...[
|
||||||
_errorMessage = null;
|
// Previous Channel (Left Zone)
|
||||||
_isLoading = true;
|
if (widget.channels != null && widget.channels!.isNotEmpty)
|
||||||
});
|
Positioned(
|
||||||
_initializePlayer();
|
left: 0,
|
||||||
},
|
top: 0,
|
||||||
child: const Text('Retry'),
|
bottom: 0,
|
||||||
),
|
width: 100,
|
||||||
],
|
child: InkWell(
|
||||||
),
|
onTap: _playPrevious,
|
||||||
)
|
hoverColor: Colors.black12,
|
||||||
: _isLoading
|
child: const Center(
|
||||||
? Center(
|
child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 48),
|
||||||
child: Column(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
children: [
|
),
|
||||||
const CircularProgressIndicator(),
|
|
||||||
const SizedBox(height: 16),
|
// Next Channel (Right Zone)
|
||||||
Text(
|
if (widget.channels != null && widget.channels!.isNotEmpty)
|
||||||
_statusMessage ?? 'Loading...',
|
Positioned(
|
||||||
style: const TextStyle(color: Colors.white70),
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
width: 100,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: _playNext,
|
||||||
|
hoverColor: Colors.black12,
|
||||||
|
child: const Center(
|
||||||
|
child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 48),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// EPG Overlay
|
||||||
|
if (widget.streamType == StreamType.live)
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.bottomCenter,
|
||||||
|
end: Alignment.topCenter,
|
||||||
|
colors: [Colors.black87, Colors.transparent],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: EpgOverlay(
|
||||||
|
streamId: widget.channels != null
|
||||||
|
? widget.channels![_currentIndex].streamId
|
||||||
|
: widget.streamId,
|
||||||
|
playlist: widget.playlist,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
|
||||||
)
|
|
||||||
: !_isInitialized
|
|
||||||
? const Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
)
|
|
||||||
: Stack(
|
|
||||||
children: [
|
|
||||||
// HTML5 video player via iframe
|
|
||||||
HtmlElementView(viewType: _viewId),
|
|
||||||
// EPG overlay for live streams
|
|
||||||
if (widget.streamType == StreamType.live)
|
|
||||||
Positioned(
|
|
||||||
bottom: 80,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: EpgOverlay(
|
|
||||||
streamId: widget.streamId,
|
|
||||||
playlist: widget.playlist,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ import '../../../core/theme/app_colors.dart';
|
|||||||
import '../../../core/theme/app_theme.dart';
|
import '../../../core/theme/app_theme.dart';
|
||||||
import '../../../core/utils/responsive_layout.dart';
|
import '../../../core/utils/responsive_layout.dart';
|
||||||
import '../../../core/widgets/components/ui_components.dart';
|
import '../../../core/widgets/components/ui_components.dart';
|
||||||
|
import '../../../core/widgets/themed_loading_screen.dart';
|
||||||
import 'channel_card.dart';
|
import 'channel_card.dart';
|
||||||
|
|
||||||
/// Live TV tab - Apple TV Style with Horizontal Category Filter
|
/// Live TV tab - Apple TV Style with Horizontal Category Filter
|
||||||
@@ -69,7 +70,7 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
body: channelsAsync.when(
|
body: channelsAsync.when(
|
||||||
loading: () => const Center(child: CircularProgressIndicator()),
|
loading: () => const ThemedLoading(),
|
||||||
error: (e, s) => Center(child: Text('Error: $e')),
|
error: (e, s) => Center(child: Text('Error: $e')),
|
||||||
data: (groupedChannels) {
|
data: (groupedChannels) {
|
||||||
// Groups
|
// Groups
|
||||||
@@ -337,7 +338,7 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
|||||||
iconUrl: _getProxiedIconUrl(channel.streamIcon),
|
iconUrl: _getProxiedIconUrl(channel.streamIcon),
|
||||||
currentProgram: null,
|
currentProgram: null,
|
||||||
playlist: widget.playlist,
|
playlist: widget.playlist,
|
||||||
onTap: () => _playChannel(channel),
|
onTap: () => _playChannel(channel, channels),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -360,7 +361,7 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
|||||||
height: 70,
|
height: 70,
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
playlist: widget.playlist,
|
playlist: widget.playlist,
|
||||||
onTap: () => _playChannel(channel),
|
onTap: () => _playChannel(channel, channels),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -375,7 +376,8 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
|||||||
return originalUrl;
|
return originalUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _playChannel(Channel channel) {
|
void _playChannel(Channel channel, List<Channel> contextList) {
|
||||||
|
final index = contextList.indexOf(channel);
|
||||||
Navigator.of(context).push(
|
Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => PlayerScreen(
|
builder: (context) => PlayerScreen(
|
||||||
@@ -383,6 +385,8 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
|||||||
title: channel.name,
|
title: channel.name,
|
||||||
playlist: widget.playlist,
|
playlist: widget.playlist,
|
||||||
streamType: StreamType.live,
|
streamType: StreamType.live,
|
||||||
|
channels: contextList,
|
||||||
|
initialIndex: index,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import '../../../core/theme/app_theme.dart';
|
|||||||
import '../../../core/utils/responsive_layout.dart';
|
import '../../../core/utils/responsive_layout.dart';
|
||||||
import '../../../core/widgets/components/hero_carousel.dart';
|
import '../../../core/widgets/components/hero_carousel.dart';
|
||||||
import '../../../core/widgets/components/ui_components.dart';
|
import '../../../core/widgets/components/ui_components.dart';
|
||||||
|
import '../../../core/widgets/themed_loading_screen.dart';
|
||||||
import '../providers/watch_history_provider.dart';
|
import '../providers/watch_history_provider.dart';
|
||||||
import '../models/xtream_models.dart';
|
import '../models/xtream_models.dart';
|
||||||
import '../providers/xtream_provider.dart';
|
import '../providers/xtream_provider.dart';
|
||||||
@@ -301,7 +302,7 @@ class _MoviesTabState extends ConsumerState<MoviesTab> {
|
|||||||
const SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(24),
|
padding: EdgeInsets.all(24),
|
||||||
child: Center(child: CircularProgressIndicator()),
|
child: ThemedLoading(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import '../../../core/theme/app_theme.dart';
|
|||||||
import '../../../core/utils/responsive_layout.dart';
|
import '../../../core/utils/responsive_layout.dart';
|
||||||
import '../../../core/widgets/components/hero_carousel.dart';
|
import '../../../core/widgets/components/hero_carousel.dart';
|
||||||
import '../../../core/widgets/components/ui_components.dart';
|
import '../../../core/widgets/components/ui_components.dart';
|
||||||
|
import '../../../core/widgets/themed_loading_screen.dart';
|
||||||
|
|
||||||
import '../models/xtream_models.dart';
|
import '../models/xtream_models.dart';
|
||||||
import '../providers/xtream_provider.dart';
|
import '../providers/xtream_provider.dart';
|
||||||
import '../providers/settings_provider.dart';
|
import '../providers/settings_provider.dart';
|
||||||
@@ -287,7 +289,7 @@ class _SeriesTabState extends ConsumerState<SeriesTab> {
|
|||||||
const SliverToBoxAdapter(
|
const SliverToBoxAdapter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(24),
|
padding: EdgeInsets.all(24),
|
||||||
child: Center(child: CircularProgressIndicator()),
|
child: ThemedLoading(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import '../providers/settings_provider.dart';
|
|||||||
import 'streaming_settings_tab.dart';
|
import 'streaming_settings_tab.dart';
|
||||||
import '../../../core/providers/theme_provider.dart';
|
import '../../../core/providers/theme_provider.dart';
|
||||||
import '../../../core/theme/app_colors.dart';
|
import '../../../core/theme/app_colors.dart';
|
||||||
|
import '../../admin/screens/admin_panel.dart';
|
||||||
|
|
||||||
/// Main Settings tab with sub-tabs for Filters, Streaming, and Appearance
|
/// Main Settings tab with sub-tabs for Filters, Streaming, and Appearance
|
||||||
class SettingsTab extends ConsumerStatefulWidget {
|
class SettingsTab extends ConsumerStatefulWidget {
|
||||||
@@ -26,7 +27,8 @@ class _SettingsTabState extends ConsumerState<SettingsTab> with SingleTickerProv
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_tabController = TabController(length: 3, vsync: this);
|
final isAdmin = ref.read(authProvider).currentUser?.isAdmin ?? false;
|
||||||
|
_tabController = TabController(length: isAdmin ? 4 : 3, vsync: this);
|
||||||
_liveTvController = TextEditingController();
|
_liveTvController = TextEditingController();
|
||||||
_moviesController = TextEditingController();
|
_moviesController = TextEditingController();
|
||||||
_seriesController = TextEditingController();
|
_seriesController = TextEditingController();
|
||||||
@@ -83,10 +85,12 @@ class _SettingsTabState extends ConsumerState<SettingsTab> with SingleTickerProv
|
|||||||
unselectedLabelColor: Colors.white54,
|
unselectedLabelColor: Colors.white54,
|
||||||
dividerColor: Colors.transparent,
|
dividerColor: Colors.transparent,
|
||||||
overlayColor: MaterialStateProperty.all(Colors.transparent),
|
overlayColor: MaterialStateProperty.all(Colors.transparent),
|
||||||
tabs: const [
|
tabs: [
|
||||||
Tab(icon: Icon(Icons.filter_list), text: 'Filtres'),
|
const Tab(icon: Icon(Icons.filter_list), text: 'Filtres'),
|
||||||
Tab(icon: Icon(Icons.stream), text: 'Streaming'),
|
const Tab(icon: Icon(Icons.stream), text: 'Streaming'),
|
||||||
Tab(icon: Icon(Icons.palette), text: 'Apparence'),
|
const Tab(icon: Icon(Icons.palette), text: 'Apparence'),
|
||||||
|
if (currentUser?.isAdmin ?? false)
|
||||||
|
const Tab(icon: Icon(Icons.admin_panel_settings), text: 'Administration'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -104,6 +108,10 @@ class _SettingsTabState extends ConsumerState<SettingsTab> with SingleTickerProv
|
|||||||
|
|
||||||
// Appearance Tab
|
// Appearance Tab
|
||||||
_buildAppearanceTab(context),
|
_buildAppearanceTab(context),
|
||||||
|
|
||||||
|
// Admin Tab
|
||||||
|
if (currentUser?.isAdmin ?? false)
|
||||||
|
const AdminContent(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -389,23 +397,7 @@ class _SettingsTabState extends ConsumerState<SettingsTab> with SingleTickerProv
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// Admin panel
|
|
||||||
if (currentUser?.isAdmin ?? false) ...[
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white.withOpacity(0.05),
|
|
||||||
borderRadius: BorderRadius.circular(16),
|
|
||||||
border: Border.all(color: Colors.white.withOpacity(0.1)),
|
|
||||||
),
|
|
||||||
child: ListTile(
|
|
||||||
leading: const Icon(Icons.admin_panel_settings, color: Colors.white),
|
|
||||||
title: Text('Panneau Admin', style: GoogleFonts.roboto(color: Colors.white)),
|
|
||||||
trailing: const Icon(Icons.chevron_right, color: Colors.white54),
|
|
||||||
onTap: () => context.go('/admin'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
],
|
|
||||||
|
|
||||||
// Change playlist
|
// Change playlist
|
||||||
Container(
|
Container(
|
||||||
|
|||||||
Reference in new issue
Block a user