mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-17 20:29:30 +02:00
Merge remote-tracking branch 'origin/main' into claude/lecture-video
# Conflicts: # CHANGELOG.md
This commit is contained in:
35 files changed
+3146
-533
No files matched your search
@@ -0,0 +1,42 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'authed_http.dart';
|
||||
|
||||
/// Point d'entrée unique pour créer un enregistrement via POST /api/recordings.
|
||||
///
|
||||
/// Le backend exige désormais des dates ISO-8601 AVEC fuseau (suffixe 'Z' ou
|
||||
/// offset) et rejette les dates naïves en 400 : trois conventions d'envoi
|
||||
/// coexistaient dans l'app (UTC, local naïf, UTC naïf), d'où des
|
||||
/// enregistrements décalés de 1-2 h selon l'écran utilisé.
|
||||
///
|
||||
/// [wallClockIsUtc] : les horaires issus de l'EPG sont des heures UTC
|
||||
/// « naïves » (parsées sans fuseau par Dart mais comparées à `now.toUtc()`
|
||||
/// partout dans l'app). true les re-tague en UTC sans décalage ; false (par
|
||||
/// défaut) convertit depuis l'heure locale réelle (cas d'un DateTime.now()).
|
||||
Future<http.Response> postRecording({
|
||||
required String channelId,
|
||||
required String title,
|
||||
required DateTime start,
|
||||
required DateTime end,
|
||||
String? streamUrl,
|
||||
bool wallClockIsUtc = false,
|
||||
}) {
|
||||
DateTime asUtc(DateTime d) {
|
||||
if (d.isUtc) return d;
|
||||
return wallClockIsUtc
|
||||
? DateTime.utc(d.year, d.month, d.day, d.hour, d.minute, d.second)
|
||||
: d.toUtc();
|
||||
}
|
||||
|
||||
return AuthedHttp.post(
|
||||
Uri.parse('/api/recordings'),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: json.encode({
|
||||
'channel_id': channelId,
|
||||
'stream_url': streamUrl ?? '/api/live/$channelId.ts',
|
||||
'title': title,
|
||||
'start_time': asUtc(start).toIso8601String(),
|
||||
'end_time': asUtc(end).toIso8601String(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../auth/providers/auth_provider.dart';
|
||||
import '../../../core/models/playlist_config.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
@@ -200,13 +201,61 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
|
||||
const Spacer(),
|
||||
|
||||
// Settings / Profile
|
||||
// Profil : nom d'utilisateur + déconnexion. L'avatar était
|
||||
// un bouton mort (onTap vide) — aucune déconnexion possible
|
||||
// depuis le dashboard desktop.
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
child: TvFocusableCard(
|
||||
onTap: () {},
|
||||
borderRadius: 50,
|
||||
scaleFactor: 1.1,
|
||||
child: PopupMenuButton<String>(
|
||||
tooltip: 'Profil',
|
||||
color: AppColors.surfaceContainerHigh,
|
||||
offset: const Offset(56, -12),
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem<String>(
|
||||
enabled: false,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.person,
|
||||
size: 18,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
ref.read(authProvider).currentUser?.username ??
|
||||
'Utilisateur',
|
||||
style: const TextStyle(
|
||||
color: AppColors.onSurface,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
const PopupMenuItem<String>(
|
||||
value: 'logout',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.logout,
|
||||
size: 18,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'Déconnexion',
|
||||
style: TextStyle(color: AppColors.onSurface),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
onSelected: (value) {
|
||||
if (value == 'logout') {
|
||||
ref.read(authProvider.notifier).logout();
|
||||
}
|
||||
},
|
||||
child: const CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: AppColors.surfaceContainerHigh,
|
||||
|
||||
@@ -270,8 +270,10 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
// Update watch history if relevant
|
||||
if (currentTime > 0) {
|
||||
// Update watch history if relevant. Jamais en live : la « position »
|
||||
// d'un flux continu n'a pas de sens et polluait le stockage avec une
|
||||
// entrée bidon par chaîne zappée.
|
||||
if (currentTime > 0 && widget.streamType != StreamType.live) {
|
||||
ref.read(playbackPositionsProvider.notifier).savePosition(
|
||||
widget.streamId,
|
||||
currentTime,
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../core/models/playlist_config.dart';
|
||||
import '../models/xtream_models.dart';
|
||||
import '../providers/xtream_provider.dart';
|
||||
import '../providers/playback_positions_provider.dart';
|
||||
import '../providers/watch_history_provider.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import 'player_screen.dart';
|
||||
@@ -287,7 +288,14 @@ class _SeriesDetailScreenState extends ConsumerState<SeriesDetailScreen> {
|
||||
}
|
||||
|
||||
if (!context.mounted) return;
|
||||
|
||||
|
||||
// Reprise de lecture : le player sauvegarde la position sous
|
||||
// episode.id, on la relit ici pour reprendre où on s'était arrêté.
|
||||
final positions = ref.read(playbackPositionsProvider);
|
||||
final resumeAt = positions.hasPosition(episode.id)
|
||||
? positions.getPosition(episode.id)
|
||||
: null;
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@@ -298,6 +306,7 @@ class _SeriesDetailScreenState extends ConsumerState<SeriesDetailScreen> {
|
||||
streamType: StreamType.series,
|
||||
containerExtension: episode.containerExtension ?? 'mkv',
|
||||
duration: episodeDuration,
|
||||
startTime: resumeAt,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -63,8 +63,23 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
||||
body: channelsAsync.when(
|
||||
loading: () => const ThemedLoading(),
|
||||
error: (e, s) => Center(
|
||||
child: Text('Error: $e',
|
||||
style: const TextStyle(color: AppColors.onSurface)),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text(
|
||||
'Impossible de charger les chaînes',
|
||||
style: TextStyle(color: AppColors.onSurface),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
OutlinedButton.icon(
|
||||
icon: const Icon(Icons.refresh, size: 18),
|
||||
label: const Text('Réessayer'),
|
||||
onPressed: () => ref.invalidate(
|
||||
liveChannelsByPlaylistProvider(widget.playlist),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
data: (groupedChannels) {
|
||||
var categories = groupedChannels.keys.toList();
|
||||
@@ -515,6 +530,43 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
||||
),
|
||||
],
|
||||
),
|
||||
// Favori (Positioned top left) — toggleFavorite n'était appelé
|
||||
// nulle part : le filtre « Favoris » affichait toujours vide.
|
||||
Positioned(
|
||||
top: 8,
|
||||
left: 8,
|
||||
child: Consumer(
|
||||
builder: (context, ref, _) {
|
||||
final isFav = ref
|
||||
.watch(favoritesProvider)
|
||||
.contains(channel.streamId);
|
||||
return TvFocusableCard(
|
||||
onTap: () => ref
|
||||
.read(favoritesProvider.notifier)
|
||||
.toggleFavorite(channel.streamId),
|
||||
borderRadius: 20,
|
||||
scaleFactor: 1.2,
|
||||
semanticLabel: isFav
|
||||
? 'Retirer ${channel.name} des favoris'
|
||||
: 'Ajouter ${channel.name} aux favoris',
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
isFav ? Icons.favorite : Icons.favorite_border,
|
||||
color: isFav
|
||||
? AppColors.primary
|
||||
: AppColors.onSurface54,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// Record Button Icon Overlay (Positioned top right)
|
||||
Positioned(
|
||||
top: 8,
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../../../core/utils/responsive_layout.dart';
|
||||
import '../../../core/widgets/hero_carousel.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
import '../../../core/widgets/tv_focusable_card.dart';
|
||||
import '../providers/playback_positions_provider.dart';
|
||||
import '../providers/watch_history_provider.dart';
|
||||
import '../models/xtream_models.dart';
|
||||
import '../providers/xtream_provider.dart';
|
||||
@@ -163,6 +164,13 @@ class _MoviesTabState extends ConsumerState<MoviesTab> {
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
// Reprise de lecture : les positions étaient sauvegardées par le player
|
||||
// mais jamais relues — le film repartait systématiquement de zéro.
|
||||
final positions = ref.read(playbackPositionsProvider);
|
||||
final resumeAt = positions.hasPosition(movie.streamId)
|
||||
? positions.getPosition(movie.streamId)
|
||||
: null;
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@@ -173,6 +181,7 @@ class _MoviesTabState extends ConsumerState<MoviesTab> {
|
||||
streamType: StreamType.vod,
|
||||
containerExtension: movie.containerExtension ?? 'mp4',
|
||||
duration: movieDuration,
|
||||
startTime: resumeAt,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../core/api/authed_http.dart';
|
||||
import '../../../core/api/recording_requests.dart';
|
||||
import '../../../core/models/iptv_models.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/widgets/glass_container.dart';
|
||||
@@ -43,20 +42,15 @@ class _RecordingModalState extends State<RecordingModal> {
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
final endTime = _startTime.add(Duration(minutes: _durationMinutes));
|
||||
|
||||
|
||||
try {
|
||||
// Utilisation d'une URL relative en Web (ou d'une configuration pour autres plateformes)
|
||||
final response = await AuthedHttp.post(
|
||||
Uri.parse('/api/recordings'),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: json.encode({
|
||||
'channel_id': widget.channel.streamId,
|
||||
'stream_url': '/api/live/${widget.channel.streamId}.ts',
|
||||
'title': widget.channel.name,
|
||||
// Forcer UTC pour éviter le décalage +01:00 (France) vs UTC (serveur Docker)
|
||||
'start_time': _startTime.toUtc().toIso8601String(),
|
||||
'end_time': endTime.toUtc().toIso8601String(),
|
||||
}),
|
||||
// _startTime est une vraie heure locale (pickers) : postRecording la
|
||||
// convertit en UTC — seule convention acceptée par le backend.
|
||||
final response = await postRecording(
|
||||
channelId: widget.channel.streamId,
|
||||
title: widget.channel.name,
|
||||
start: _startTime,
|
||||
end: endTime,
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../core/api/authed_http.dart';
|
||||
import '../../../core/api/recording_requests.dart';
|
||||
import '../../../core/models/iptv_models.dart';
|
||||
import '../../../core/models/playlist_config.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
@@ -14,6 +15,10 @@ import '../screens/player_screen.dart';
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// ENTRÉE — Onglet "Enregistrements"
|
||||
// Trois vues : Guide TV (programmer depuis l'EPG), Enregistrements (liste),
|
||||
// Season Passes (enregistrements récurrents). _EpgGuideView et
|
||||
// _SeasonPassesView existaient déjà mais n'étaient plus instanciés depuis
|
||||
// une refonte : les fonctions étaient codées mais inaccessibles.
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
class RecordingsTab extends StatefulWidget {
|
||||
@@ -24,7 +29,24 @@ class RecordingsTab extends StatefulWidget {
|
||||
State<RecordingsTab> createState() => _RecordingsTabState();
|
||||
}
|
||||
|
||||
class _RecordingsTabState extends State<RecordingsTab> {
|
||||
class _RecordingsTabState extends State<RecordingsTab>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late final TabController _tabController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// Ouvrir sur la liste des enregistrements (onglet du milieu), l'usage le
|
||||
// plus fréquent ; le guide sert à en programmer de nouveaux.
|
||||
_tabController = TabController(length: 3, vsync: this, initialIndex: 1);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -32,25 +54,59 @@ class _RecordingsTabState extends State<RecordingsTab> {
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(24, 24, 24, 16),
|
||||
padding: const EdgeInsets.fromLTRB(24, 24, 24, 0),
|
||||
color: Colors.grey[900],
|
||||
child: const Row(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.videocam, color: AppColors.onSurface, size: 28),
|
||||
SizedBox(width: 12),
|
||||
Text(
|
||||
'Enregistrements',
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.onSurface,
|
||||
),
|
||||
const Row(
|
||||
children: [
|
||||
Icon(Icons.videocam, color: AppColors.onSurface, size: 28),
|
||||
SizedBox(width: 12),
|
||||
Text(
|
||||
'Enregistrements',
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TabBar(
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
indicatorColor: AppColors.primary,
|
||||
labelColor: AppColors.onSurface,
|
||||
unselectedLabelColor: AppColors.onSurface54,
|
||||
tabs: const [
|
||||
Tab(
|
||||
icon: Icon(Icons.calendar_month, size: 18),
|
||||
text: 'Guide TV',
|
||||
),
|
||||
Tab(
|
||||
icon: Icon(Icons.fiber_manual_record, size: 18),
|
||||
text: 'Enregistrements',
|
||||
),
|
||||
Tab(
|
||||
icon: Icon(Icons.repeat, size: 18),
|
||||
text: 'Season Passes',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: _RecordingsListView(playlist: widget.playlist),
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
_EpgGuideView(playlist: widget.playlist),
|
||||
_RecordingsListView(playlist: widget.playlist),
|
||||
const _SeasonPassesView(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -594,16 +650,15 @@ class _ProgrammeCard extends StatelessWidget {
|
||||
DateTime end,
|
||||
) async {
|
||||
try {
|
||||
final response = await AuthedHttp.post(
|
||||
Uri.parse('/api/recordings'),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: json.encode({
|
||||
'channel_id': channel.streamId,
|
||||
'stream_url': '/api/live/${channel.streamId}.ts',
|
||||
'title': title,
|
||||
'start_time': start.toIso8601String(),
|
||||
'end_time': end.toIso8601String(),
|
||||
}),
|
||||
// Les horaires EPG sont des heures UTC naïves : wallClockIsUtc les
|
||||
// re-tague sans décalage (l'ancien envoi naïf était interprété dans le
|
||||
// fuseau du serveur → enregistrement décalé de 1-2 h).
|
||||
final response = await postRecording(
|
||||
channelId: channel.streamId,
|
||||
title: title,
|
||||
start: start,
|
||||
end: end,
|
||||
wallClockIsUtc: true,
|
||||
);
|
||||
if (response.statusCode == 200) notifyRecordingsChanged();
|
||||
if (context.mounted) {
|
||||
@@ -825,7 +880,39 @@ class _RecordingsListViewState extends State<_RecordingsListView> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _deleteRecording(String id) async {
|
||||
/// Demande confirmation avant suppression : l'ancienne corbeille supprimait
|
||||
/// immédiatement, sans retour ni possibilité d'annuler.
|
||||
Future<void> _deleteRecording(String id, String title) async {
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: AppColors.surfaceContainer,
|
||||
title: Text(
|
||||
'Supprimer l\'enregistrement ?',
|
||||
style: GoogleFonts.fraunces(color: AppColors.onSurface, fontSize: 18),
|
||||
),
|
||||
content: Text(
|
||||
'« $title » et son fichier seront définitivement supprimés.',
|
||||
style: const TextStyle(color: AppColors.onSurfaceVariant),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
child: const Text('Annuler'),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.errorContainer,
|
||||
foregroundColor: AppColors.onErrorContainer,
|
||||
),
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
child: const Text('Supprimer'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (confirmed != true) return;
|
||||
|
||||
await AuthedHttp.delete(Uri.parse('/api/recordings/$id'));
|
||||
_fetchRecordings();
|
||||
}
|
||||
@@ -914,6 +1001,7 @@ class _RecordingsListViewState extends State<_RecordingsListView> {
|
||||
'recording' => AppColors.live,
|
||||
'completed' => AppColors.success,
|
||||
'failed' => AppColors.warning,
|
||||
'cancelled' => AppColors.onSurface38,
|
||||
_ => AppColors.primaryContainer,
|
||||
};
|
||||
|
||||
@@ -922,9 +1010,20 @@ class _RecordingsListViewState extends State<_RecordingsListView> {
|
||||
'recording' => '● En cours',
|
||||
'completed' => 'Terminé',
|
||||
'failed' => 'Échoué',
|
||||
'cancelled' => 'Annulé',
|
||||
_ => status,
|
||||
};
|
||||
|
||||
String _fmtSize(int bytes) {
|
||||
if (bytes >= 1024 * 1024 * 1024) {
|
||||
return '${(bytes / (1024 * 1024 * 1024)).toStringAsFixed(1)} Go';
|
||||
}
|
||||
if (bytes >= 1024 * 1024) {
|
||||
return '${(bytes / (1024 * 1024)).toStringAsFixed(0)} Mo';
|
||||
}
|
||||
return '${(bytes / 1024).toStringAsFixed(0)} Ko';
|
||||
}
|
||||
|
||||
String _fmtDate(dynamic raw) {
|
||||
if (raw == null) return '?';
|
||||
try {
|
||||
@@ -974,9 +1073,20 @@ class _RecordingsListViewState extends State<_RecordingsListView> {
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: _error != null
|
||||
? Center(
|
||||
child: Text(
|
||||
_error ?? 'Erreur',
|
||||
style: const TextStyle(color: AppColors.live),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text(
|
||||
'Impossible de charger les enregistrements',
|
||||
style: TextStyle(color: AppColors.live),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
OutlinedButton.icon(
|
||||
icon: const Icon(Icons.refresh, size: 18),
|
||||
label: const Text('Réessayer'),
|
||||
onPressed: _fetchRecordings,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: _recordings.isEmpty
|
||||
@@ -1040,12 +1150,34 @@ class _RecordingsListViewState extends State<_RecordingsListView> {
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${_fmtDate(rec['start_time'])} → ${_fmtDate(rec['end_time'])}',
|
||||
'${_fmtDate(rec['start_time'])} → ${_fmtDate(rec['end_time'])}'
|
||||
'${rec['file_size_bytes'] is int ? ' · ${_fmtSize(rec['file_size_bytes'] as int)}' : ''}',
|
||||
style: const TextStyle(
|
||||
color: AppColors.onSurface54,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
if (status == 'recording' &&
|
||||
rec['progress_pct'] is int) ...[
|
||||
const SizedBox(height: 6),
|
||||
ClipRRect(
|
||||
borderRadius:
|
||||
BorderRadius.circular(3),
|
||||
child: LinearProgressIndicator(
|
||||
value:
|
||||
(rec['progress_pct'] as int) /
|
||||
100,
|
||||
minHeight: 4,
|
||||
backgroundColor: AppColors
|
||||
.onSurface
|
||||
.withOpacity(0.1),
|
||||
valueColor:
|
||||
const AlwaysStoppedAnimation(
|
||||
AppColors.live,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
if (rec['error_reason'] != null)
|
||||
Text(
|
||||
'⚠ ${rec['error_reason']}',
|
||||
@@ -1123,8 +1255,10 @@ class _RecordingsListViewState extends State<_RecordingsListView> {
|
||||
size: 20,
|
||||
),
|
||||
tooltip: 'Supprimer',
|
||||
onPressed: () =>
|
||||
_deleteRecording(rec['id']),
|
||||
onPressed: () => _deleteRecording(
|
||||
rec['id'],
|
||||
rec['title'] ?? '',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../../core/models/playlist_config.dart';
|
||||
import '../../../widgets/mobile_scaffold.dart';
|
||||
import '../../../theme/mobile_theme.dart';
|
||||
import '../../../../features/iptv/widgets/recordings_tab.dart';
|
||||
import '../widgets/mobile_live_tv_tab.dart';
|
||||
import '../widgets/mobile_movies_tab.dart';
|
||||
import '../widgets/mobile_series_tab.dart';
|
||||
@@ -34,23 +35,20 @@ class _MobileDashboardScreenState extends ConsumerState<MobileDashboardScreen> {
|
||||
_currentIndex = index;
|
||||
});
|
||||
},
|
||||
child: _buildActiveTab(),
|
||||
// IndexedStack conserve l'état des onglets (position de scroll,
|
||||
// catalogues chargés) : l'ancien switch reconstruisait tout à chaque
|
||||
// changement d'onglet. Même approche que le dashboard desktop.
|
||||
child: IndexedStack(
|
||||
index: _currentIndex,
|
||||
children: [
|
||||
MobileLiveTVTab(playlist: widget.playlist),
|
||||
MobileMoviesTab(playlist: widget.playlist),
|
||||
MobileSeriesTab(playlist: widget.playlist),
|
||||
RecordingsTab(playlist: widget.playlist),
|
||||
const MobileSettingsTab(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActiveTab() {
|
||||
switch (_currentIndex) {
|
||||
case 0:
|
||||
return MobileLiveTVTab(playlist: widget.playlist);
|
||||
case 1:
|
||||
return MobileMoviesTab(playlist: widget.playlist);
|
||||
case 2:
|
||||
return MobileSeriesTab(playlist: widget.playlist);
|
||||
case 3:
|
||||
return const MobileSettingsTab();
|
||||
default:
|
||||
return MobileLiveTVTab(playlist: widget.playlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
}
|
||||
}
|
||||
|
||||
class _MobileChannelTile extends StatelessWidget {
|
||||
class _MobileChannelTile extends ConsumerWidget {
|
||||
final Channel channel;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@@ -345,7 +345,10 @@ class _MobileChannelTile extends StatelessWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// Sans ce bouton, aucun moyen d'ajouter un favori : le filtre « Favoris »
|
||||
// de l'en-tête affichait toujours une liste vide.
|
||||
final isFav = ref.watch(favoritesProvider).contains(channel.streamId);
|
||||
final iconUrl =
|
||||
channel.streamIcon.isNotEmpty && channel.streamIcon.startsWith('http')
|
||||
? '/api/xtream/${channel.streamIcon}'
|
||||
@@ -393,6 +396,18 @@ class _MobileChannelTile extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
tooltip: isFav ? 'Retirer des favoris' : 'Ajouter aux favoris',
|
||||
icon: Icon(
|
||||
isFav ? Icons.favorite : Icons.favorite_border,
|
||||
color: isFav ? AppColors.primary : AppColors.onSurface54,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: () => ref
|
||||
.read(favoritesProvider.notifier)
|
||||
.toggleFavorite(channel.streamId),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@@ -78,6 +78,11 @@ class MobileScaffold extends ConsumerWidget {
|
||||
activeIcon: Icon(Icons.video_library_rounded),
|
||||
label: 'Series',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.videocam_outlined),
|
||||
activeIcon: Icon(Icons.videocam_rounded),
|
||||
label: 'REC',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.settings_outlined),
|
||||
activeIcon: Icon(Icons.settings_rounded),
|
||||
|
||||
Reference in new issue
Block a user