mirror of
https://github.com/R0m1k3/xtremobile.git
synced 2026-10-21 06:08:15 +02:00
init: Initial Flutter project setup with Android and iOS platform files.
This commit is contained in:
1 parent
0dd3edfc79
commit
d0c5c4ff3a
73 files changed
+3288
-329
No files matched your search
@@ -1,15 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../../../features/iptv/providers/xtream_provider.dart';
|
||||
import '../../../../features/iptv/providers/settings_provider.dart';
|
||||
import '../../../../features/iptv/providers/favorites_provider.dart';
|
||||
import '../screens/mobile_player_screen.dart';
|
||||
import '../../../providers/mobile_xtream_providers.dart';
|
||||
import '../../../providers/mobile_settings_providers.dart';
|
||||
import '../screens/native_player_screen.dart';
|
||||
import '../../../../core/models/iptv_models.dart';
|
||||
import '../../../../core/models/playlist_config.dart';
|
||||
import '../../../../core/theme/app_colors.dart';
|
||||
import '../../../theme/mobile_theme.dart';
|
||||
import '../../../../core/widgets/components/ui_components.dart'; // For images/CachedNetworkImage if needed
|
||||
|
||||
class MobileLiveTVTab extends ConsumerStatefulWidget {
|
||||
final PlaylistConfig playlist;
|
||||
@@ -43,9 +41,9 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final channelsAsync = ref.watch(liveChannelsByPlaylistProvider(widget.playlist));
|
||||
final favorites = ref.watch(favoritesProvider);
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
final channelsAsync = ref.watch(mobileLiveChannelsProvider(widget.playlist));
|
||||
final favorites = ref.watch(mobileFavoritesProvider);
|
||||
final settings = ref.watch(mobileSettingsProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
@@ -216,7 +214,7 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
void _playChannel(BuildContext context, Channel channel) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MobilePlayerScreen(
|
||||
builder: (context) => NativePlayerScreen(
|
||||
streamId: channel.streamId,
|
||||
title: channel.name,
|
||||
playlist: widget.playlist,
|
||||
@@ -235,8 +233,9 @@ class _MobileChannelTile extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// On mobile, use direct URL (no proxy needed)
|
||||
final iconUrl = channel.streamIcon.isNotEmpty && channel.streamIcon.startsWith('http')
|
||||
? '/api/xtream/${channel.streamIcon}'
|
||||
? channel.streamIcon
|
||||
: null;
|
||||
|
||||
return InkWell(
|
||||
|
||||
@@ -5,11 +5,10 @@ import '../../../../core/models/playlist_config.dart';
|
||||
import '../../../../core/theme/app_colors.dart';
|
||||
import '../../../../core/widgets/components/hero_carousel.dart';
|
||||
import '../../../../core/widgets/components/ui_components.dart';
|
||||
import '../../../../features/iptv/providers/watch_history_provider.dart';
|
||||
import '../../../../features/iptv/models/xtream_models.dart';
|
||||
import '../../../../features/iptv/providers/xtream_provider.dart';
|
||||
import '../../../../features/iptv/providers/settings_provider.dart';
|
||||
import '../screens/mobile_player_screen.dart';
|
||||
import '../../../providers/mobile_settings_providers.dart';
|
||||
import '../../../providers/mobile_xtream_providers.dart';
|
||||
import '../../../../features/iptv/services/xtream_service_mobile.dart';
|
||||
import '../screens/native_player_screen.dart';
|
||||
|
||||
class MobileMoviesTab extends ConsumerStatefulWidget {
|
||||
final PlaylistConfig playlist;
|
||||
@@ -78,7 +77,7 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
setState(() => _isSearching = true);
|
||||
|
||||
try {
|
||||
final service = ref.read(xtreamServiceProvider(widget.playlist));
|
||||
final service = ref.read(mobileXtreamServiceProvider(widget.playlist));
|
||||
final results = await service.searchMovies(query);
|
||||
|
||||
if (mounted && _searchQuery == query) {
|
||||
@@ -99,7 +98,7 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
try {
|
||||
final service = ref.read(xtreamServiceProvider(widget.playlist));
|
||||
final service = ref.read(mobileXtreamServiceProvider(widget.playlist));
|
||||
final newMovies = await service.getMoviesPaginated(
|
||||
offset: _currentOffset,
|
||||
limit: _pageSize,
|
||||
@@ -129,22 +128,19 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
return rating;
|
||||
}
|
||||
|
||||
/// Proxy HTTP images through backend to avoid CORS/mixed-content issues
|
||||
String _getProxiedImageUrl(String? originalUrl) {
|
||||
/// On mobile, use direct URLs (no proxy needed)
|
||||
String _getImageUrl(String? originalUrl) {
|
||||
if (originalUrl == null || originalUrl.isEmpty) return '';
|
||||
if (originalUrl.startsWith('http://')) {
|
||||
return '/api/xtream/$originalUrl';
|
||||
}
|
||||
return originalUrl;
|
||||
}
|
||||
|
||||
void _playMovie(Movie movie) {
|
||||
ref.read(watchHistoryProvider.notifier).markMovieWatched(movie.streamId);
|
||||
ref.read(mobileWatchHistoryProvider.notifier).markMovieWatched(movie.streamId);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MobilePlayerScreen(
|
||||
builder: (context) => NativePlayerScreen(
|
||||
streamId: movie.streamId,
|
||||
title: movie.name,
|
||||
playlist: widget.playlist,
|
||||
@@ -157,8 +153,8 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
final watchHistory = ref.watch(watchHistoryProvider);
|
||||
final settings = ref.watch(mobileSettingsProvider);
|
||||
final watchHistory = ref.watch(mobileWatchHistoryProvider);
|
||||
|
||||
List<Movie> displayMovies;
|
||||
if (_searchQuery.isNotEmpty && _searchResults != null) {
|
||||
@@ -173,7 +169,7 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
final heroItems = displayMovies.take(3).map((m) => HeroItem(
|
||||
id: m.streamId,
|
||||
title: m.name,
|
||||
imageUrl: _getProxiedImageUrl(m.streamIcon),
|
||||
imageUrl: _getImageUrl(m.streamIcon),
|
||||
subtitle: m.rating != null ? '${_formatRating(m.rating)} ★' : null,
|
||||
onMoreInfo: () => _playMovie(m),
|
||||
)).toList();
|
||||
@@ -264,14 +260,14 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
|
||||
return MediaCard(
|
||||
title: movie.name,
|
||||
imageUrl: _getProxiedImageUrl(movie.streamIcon),
|
||||
imageUrl: _getImageUrl(movie.streamIcon),
|
||||
|
||||
subtitle: movie.rating != null ? '${_formatRating(movie.rating)} ★' : null,
|
||||
rating: _formatRating(movie.rating),
|
||||
isWatched: isWatched,
|
||||
onTap: () => _playMovie(movie),
|
||||
onLongPress: () {
|
||||
ref.read(watchHistoryProvider.notifier).toggleMovieWatched(movie.streamId);
|
||||
ref.read(mobileWatchHistoryProvider.notifier).toggleMovieWatched(movie.streamId);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@@ -3,12 +3,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../../core/models/playlist_config.dart';
|
||||
import '../../../../core/theme/app_colors.dart';
|
||||
|
||||
import '../../../../core/widgets/components/hero_carousel.dart';
|
||||
import '../../../../core/widgets/components/ui_components.dart';
|
||||
import '../../../../features/iptv/models/xtream_models.dart';
|
||||
import '../../../../features/iptv/providers/xtream_provider.dart';
|
||||
import '../../../../features/iptv/providers/settings_provider.dart';
|
||||
import '../../../providers/mobile_settings_providers.dart';
|
||||
import '../../../providers/mobile_xtream_providers.dart';
|
||||
import '../../../../features/iptv/services/xtream_service_mobile.dart';
|
||||
import '../screens/mobile_series_detail_screen.dart';
|
||||
|
||||
class MobileSeriesTab extends ConsumerStatefulWidget {
|
||||
@@ -78,7 +77,7 @@ class _MobileSeriesTabState extends ConsumerState<MobileSeriesTab> {
|
||||
setState(() => _isSearching = true);
|
||||
|
||||
try {
|
||||
final service = ref.read(xtreamServiceProvider(widget.playlist));
|
||||
final service = ref.read(mobileXtreamServiceProvider(widget.playlist));
|
||||
final results = await service.searchSeries(query);
|
||||
|
||||
if (mounted && _searchQuery == query) {
|
||||
@@ -99,7 +98,7 @@ class _MobileSeriesTabState extends ConsumerState<MobileSeriesTab> {
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
try {
|
||||
final service = ref.read(xtreamServiceProvider(widget.playlist));
|
||||
final service = ref.read(mobileXtreamServiceProvider(widget.playlist));
|
||||
final newSeries = await service.getSeriesPaginated(
|
||||
offset: _currentOffset,
|
||||
limit: _pageSize,
|
||||
@@ -129,12 +128,9 @@ class _MobileSeriesTabState extends ConsumerState<MobileSeriesTab> {
|
||||
return rating;
|
||||
}
|
||||
|
||||
/// Proxy HTTP images through backend to avoid CORS/mixed-content issues
|
||||
String _getProxiedImageUrl(String? originalUrl) {
|
||||
/// On mobile, use direct URLs (no proxy needed)
|
||||
String _getImageUrl(String? originalUrl) {
|
||||
if (originalUrl == null || originalUrl.isEmpty) return '';
|
||||
if (originalUrl.startsWith('http://')) {
|
||||
return '/api/xtream/$originalUrl';
|
||||
}
|
||||
return originalUrl;
|
||||
}
|
||||
|
||||
@@ -152,7 +148,7 @@ class _MobileSeriesTabState extends ConsumerState<MobileSeriesTab> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
final settings = ref.watch(mobileSettingsProvider);
|
||||
|
||||
List<Series> displaySeries;
|
||||
if (_searchQuery.isNotEmpty && _searchResults != null) {
|
||||
@@ -167,7 +163,7 @@ class _MobileSeriesTabState extends ConsumerState<MobileSeriesTab> {
|
||||
final heroItems = displaySeries.take(3).map((s) => HeroItem(
|
||||
id: s.seriesId.toString(),
|
||||
title: s.name,
|
||||
imageUrl: _getProxiedImageUrl(s.cover),
|
||||
imageUrl: _getImageUrl(s.cover),
|
||||
subtitle: s.rating != null ? '${_formatRating(s.rating)} ★' : null,
|
||||
onMoreInfo: () => _openSeries(s),
|
||||
)).toList();
|
||||
@@ -265,7 +261,7 @@ class _MobileSeriesTabState extends ConsumerState<MobileSeriesTab> {
|
||||
|
||||
return MediaCard(
|
||||
title: series.name,
|
||||
imageUrl: _getProxiedImageUrl(series.cover),
|
||||
imageUrl: _getImageUrl(series.cover),
|
||||
|
||||
subtitle: series.rating != null ? '${_formatRating(series.rating)} ★' : null,
|
||||
rating: _formatRating(series.rating),
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
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 '../../../../features/auth/providers/auth_provider.dart';
|
||||
import '../../../../features/iptv/providers/settings_provider.dart';
|
||||
import '../../../providers/mobile_settings_providers.dart';
|
||||
import '../../../../core/providers/theme_provider.dart';
|
||||
import '../../../../core/theme/app_colors.dart';
|
||||
|
||||
/// Simplified mobile settings tab - no auth, local storage only
|
||||
class MobileSettingsTab extends ConsumerStatefulWidget {
|
||||
const MobileSettingsTab({super.key});
|
||||
|
||||
@@ -36,23 +35,22 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _syncControllers(IptvSettings settings) {
|
||||
if (!_initialized || _liveTvController.text != settings.liveTvCategoryFilter) {
|
||||
_liveTvController.text = settings.liveTvCategoryFilter;
|
||||
void _syncControllers(MobileSettings settings) {
|
||||
if (!_initialized) {
|
||||
_liveTvController.text = settings.liveTvKeywords.join(', ');
|
||||
_moviesController.text = settings.moviesKeywords.join(', ');
|
||||
_seriesController.text = settings.seriesKeywords.join(', ');
|
||||
_initialized = true;
|
||||
}
|
||||
if (!_initialized || _moviesController.text != settings.moviesCategoryFilter) {
|
||||
_moviesController.text = settings.moviesCategoryFilter;
|
||||
}
|
||||
if (!_initialized || _seriesController.text != settings.seriesCategoryFilter) {
|
||||
_seriesController.text = settings.seriesCategoryFilter;
|
||||
}
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
List<String> _parseKeywords(String text) {
|
||||
return text.split(',').map((s) => s.trim()).where((s) => s.isNotEmpty).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final currentUser = ref.watch(authProvider).currentUser;
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
final settings = ref.watch(mobileSettingsProvider);
|
||||
final themeState = ref.watch(themeProvider);
|
||||
final themeNotifier = ref.read(themeProvider.notifier);
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
@@ -66,15 +64,17 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
// Header
|
||||
Padding(
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
child: Text(
|
||||
'Settings',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
'Paramètres',
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// User Profile
|
||||
// App Info
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -83,36 +83,37 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor: AppColors.primary.withOpacity(0.2),
|
||||
child: Text(
|
||||
currentUser?.username.substring(0, 1).toUpperCase() ?? 'U',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, color: AppColors.primary),
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Icon(Icons.play_circle_filled,
|
||||
color: AppColors.primary, size: 28),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
currentUser?.username ?? 'Guest',
|
||||
style: const TextStyle(
|
||||
'XtremFlow Mobile',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
if (currentUser?.isAdmin ?? false)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 4),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Text('ADMIN', style: TextStyle(fontSize: 10, color: AppColors.primary, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 4),
|
||||
Text(
|
||||
'Version 1.0.0 (Local)',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -122,108 +123,26 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Appearance
|
||||
const _SectionHeader(title: 'Appearance'),
|
||||
const _SectionHeader(title: 'Apparence'),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SwitchListTile(
|
||||
title: const Text('Dark Mode', style: TextStyle(color: AppColors.textPrimary)),
|
||||
secondary: Icon(isDark ? Icons.dark_mode : Icons.light_mode, color: AppColors.primary),
|
||||
value: isDark,
|
||||
onChanged: (_) => themeNotifier.toggleTheme(),
|
||||
activeColor: AppColors.primary,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
SwitchListTile(
|
||||
title: const Text('Show Clock', style: TextStyle(color: AppColors.textPrimary)),
|
||||
secondary: const Icon(Icons.access_time, color: AppColors.primary),
|
||||
value: settings.showClock,
|
||||
onChanged: (val) => ref.read(iptvSettingsProvider.notifier).setShowClock(val),
|
||||
activeColor: AppColors.primary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Streaming Settings
|
||||
const _SectionHeader(title: 'Streaming'),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Column(
|
||||
children: [
|
||||
_DropdownSetting<StreamQuality>(
|
||||
label: 'Quality',
|
||||
icon: Icons.high_quality,
|
||||
value: settings.streamQuality,
|
||||
items: StreamQuality.values,
|
||||
labelBuilder: (v) => v.name.toUpperCase(),
|
||||
onChanged: (v) {
|
||||
if (v != null) ref.read(iptvSettingsProvider.notifier).setStreamQuality(v);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_DropdownSetting<BufferSize>(
|
||||
label: 'Buffer Size',
|
||||
icon: Icons.memory,
|
||||
value: settings.bufferSize,
|
||||
items: BufferSize.values,
|
||||
labelBuilder: (v) => v.name.toUpperCase(),
|
||||
onChanged: (v) {
|
||||
if (v != null) ref.read(iptvSettingsProvider.notifier).setBufferSize(v);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_DropdownSetting<ConnectionTimeout>(
|
||||
label: 'Timeout',
|
||||
icon: Icons.timer,
|
||||
value: settings.connectionTimeout,
|
||||
items: ConnectionTimeout.values,
|
||||
labelBuilder: (v) => '${v.name.toUpperCase()} (${ref.read(iptvSettingsProvider).timeoutSeconds}s)',
|
||||
onChanged: (v) {
|
||||
if (v != null) ref.read(iptvSettingsProvider.notifier).setConnectionTimeout(v);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_DropdownSetting<TranscodingMode>(
|
||||
label: 'Mode',
|
||||
icon: Icons.settings_input_component,
|
||||
value: settings.transcodingMode,
|
||||
items: TranscodingMode.values,
|
||||
labelBuilder: (v) {
|
||||
switch (v) {
|
||||
case TranscodingMode.auto: return 'AUTO';
|
||||
case TranscodingMode.forced: return 'TRANSCODE';
|
||||
case TranscodingMode.disabled: return 'DIRECT';
|
||||
}
|
||||
},
|
||||
onChanged: (v) {
|
||||
if (v != null) ref.read(iptvSettingsProvider.notifier).setTranscodingMode(v);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
SwitchListTile(
|
||||
title: const Text('Auto Reconnect', style: TextStyle(color: AppColors.textPrimary)),
|
||||
secondary: const Icon(Icons.refresh, color: AppColors.primary),
|
||||
value: settings.autoReconnect,
|
||||
onChanged: (val) => ref.read(iptvSettingsProvider.notifier).setAutoReconnect(val),
|
||||
activeColor: AppColors.primary,
|
||||
),
|
||||
],
|
||||
child: SwitchListTile(
|
||||
title: const Text('Mode Sombre',
|
||||
style: TextStyle(color: AppColors.textPrimary)),
|
||||
secondary: Icon(isDark ? Icons.dark_mode : Icons.light_mode,
|
||||
color: AppColors.primary),
|
||||
value: isDark,
|
||||
onChanged: (_) => themeNotifier.toggleTheme(),
|
||||
activeColor: AppColors.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Content Filters
|
||||
const _SectionHeader(title: 'Content Filters'),
|
||||
const _SectionHeader(title: 'Filtres de Contenu'),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
@@ -231,59 +150,82 @@ class _MobileSettingsTabState extends ConsumerState<MobileSettingsTab> {
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'Utilisez des mots-clés pour filtrer les catégories (séparés par des virgules)',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_FilterInput(
|
||||
label: 'Live TV Keywords',
|
||||
label: 'TV en Direct',
|
||||
hint: 'Ex: FR, HD, SPORT',
|
||||
icon: Icons.live_tv,
|
||||
controller: _liveTvController,
|
||||
onChanged: (val) => ref.read(iptvSettingsProvider.notifier).setLiveTvFilter(val),
|
||||
onChanged: (val) {
|
||||
ref.read(mobileSettingsProvider.notifier)
|
||||
.setLiveTvKeywords(_parseKeywords(val));
|
||||
},
|
||||
),
|
||||
const Divider(height: 24),
|
||||
const SizedBox(height: 16),
|
||||
_FilterInput(
|
||||
label: 'Movies Keywords',
|
||||
label: 'Films',
|
||||
hint: 'Ex: FR, VF, 4K',
|
||||
icon: Icons.movie,
|
||||
controller: _moviesController,
|
||||
onChanged: (val) => ref.read(iptvSettingsProvider.notifier).setMoviesFilter(val),
|
||||
onChanged: (val) {
|
||||
ref.read(mobileSettingsProvider.notifier)
|
||||
.setMoviesKeywords(_parseKeywords(val));
|
||||
},
|
||||
),
|
||||
const Divider(height: 24),
|
||||
const SizedBox(height: 16),
|
||||
_FilterInput(
|
||||
label: 'Series Keywords',
|
||||
label: 'Séries',
|
||||
hint: 'Ex: FR, VF',
|
||||
icon: Icons.tv,
|
||||
controller: _seriesController,
|
||||
onChanged: (val) => ref.read(iptvSettingsProvider.notifier).setSeriesFilter(val),
|
||||
onChanged: (val) {
|
||||
ref.read(mobileSettingsProvider.notifier)
|
||||
.setSeriesKeywords(_parseKeywords(val));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Actions
|
||||
if (currentUser?.isAdmin ?? false)
|
||||
_SettingsButton(
|
||||
icon: Icons.admin_panel_settings,
|
||||
label: 'Admin Panel',
|
||||
onTap: () => context.go('/admin'),
|
||||
// Change Playlist
|
||||
InkWell(
|
||||
onTap: () {
|
||||
// Navigate back to playlist selection
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.playlist_play, color: AppColors.textPrimary),
|
||||
SizedBox(width: 16),
|
||||
Text(
|
||||
'Changer de Playlist',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Icon(Icons.chevron_right, color: AppColors.textSecondary),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_SettingsButton(
|
||||
icon: Icons.playlist_play,
|
||||
label: 'Change Playlist',
|
||||
onTap: () => context.go('/playlists'),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
FilledButton.icon(
|
||||
onPressed: () {
|
||||
ref.read(authProvider.notifier).logout();
|
||||
context.go('/login');
|
||||
},
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: AppColors.error.withOpacity(0.1),
|
||||
foregroundColor: AppColors.error,
|
||||
minimumSize: const Size(double.infinity, 50),
|
||||
),
|
||||
icon: const Icon(Icons.logout),
|
||||
label: const Text('Logout'),
|
||||
),
|
||||
const SizedBox(height: 100),
|
||||
],
|
||||
@@ -314,12 +256,14 @@ class _SectionHeader extends StatelessWidget {
|
||||
|
||||
class _FilterInput extends StatelessWidget {
|
||||
final String label;
|
||||
final String hint;
|
||||
final IconData icon;
|
||||
final TextEditingController controller;
|
||||
final ValueChanged<String> onChanged;
|
||||
|
||||
const _FilterInput({
|
||||
required this.label,
|
||||
required this.hint,
|
||||
required this.icon,
|
||||
required this.controller,
|
||||
required this.onChanged,
|
||||
@@ -327,126 +271,42 @@ class _FilterInput extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(icon, size: 20, color: AppColors.textSecondary),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label, style: const TextStyle(fontSize: 12, color: AppColors.textSecondary)),
|
||||
TextField(
|
||||
controller: controller,
|
||||
style: const TextStyle(fontSize: 14, color: AppColors.textPrimary),
|
||||
decoration: const InputDecoration(
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 4),
|
||||
border: InputBorder.none,
|
||||
hintText: 'e.g. FR, HD',
|
||||
),
|
||||
onChanged: onChanged,
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: AppColors.primary),
|
||||
const SizedBox(width: 8),
|
||||
Text(label,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: controller,
|
||||
style: const TextStyle(fontSize: 14, color: AppColors.textPrimary),
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
hintText: hint,
|
||||
hintStyle: const TextStyle(color: AppColors.textTertiary),
|
||||
filled: true,
|
||||
fillColor: AppColors.background,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12, vertical: 10),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
),
|
||||
onChanged: onChanged,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SettingsButton extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _SettingsButton({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: AppColors.textPrimary),
|
||||
const SizedBox(width: 16),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
const Icon(Icons.chevron_right, color: AppColors.textSecondary),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DropdownSetting<T> extends StatelessWidget {
|
||||
final String label;
|
||||
final IconData icon;
|
||||
final T value;
|
||||
final List<T> items;
|
||||
final String Function(T) labelBuilder;
|
||||
final ValueChanged<T?> onChanged;
|
||||
|
||||
const _DropdownSetting({
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.value,
|
||||
required this.items,
|
||||
required this.labelBuilder,
|
||||
required this.onChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon, color: AppColors.primary),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
DropdownButton<T>(
|
||||
value: value,
|
||||
underline: const SizedBox(),
|
||||
dropdownColor: AppColors.surfaceVariant,
|
||||
icon: const Icon(Icons.arrow_drop_down, color: AppColors.textSecondary),
|
||||
style: const TextStyle(color: AppColors.textPrimary),
|
||||
items: items.map((item) {
|
||||
return DropdownMenuItem<T>(
|
||||
value: item,
|
||||
child: Text(labelBuilder(item)),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: onChanged,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user