mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-19 13:08:05 +02:00
feat: implement core server with API (auth, playlists), static assets, Xtream proxy, media streaming, and icons
This commit is contained in:
1 parent
f064feb22c
commit
85471b5312
10 files changed
+432
-119
No files matched your search
@@ -70,8 +70,8 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
||||
|
||||
// Filter categories based on keywords
|
||||
var categories = groupedChannels.keys.toList();
|
||||
if (settings.filterKeywords.isNotEmpty) {
|
||||
categories = categories.where((cat) => settings.matchesFilter(cat)).toList();
|
||||
if (settings.liveTvKeywords.isNotEmpty) {
|
||||
categories = categories.where((cat) => settings.matchesLiveTvFilter(cat)).toList();
|
||||
}
|
||||
categories.sort();
|
||||
|
||||
@@ -88,7 +88,7 @@ class _LiveTVTabState extends ConsumerState<LiveTVTab>
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Filter: ${settings.categoryFilter}',
|
||||
'Filter: ${settings.liveTvCategoryFilter}',
|
||||
style: GoogleFonts.roboto(fontSize: 12, color: Colors.grey.shade600),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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/settings_provider.dart';
|
||||
import '../screens/player_screen.dart';
|
||||
|
||||
class MoviesTab extends ConsumerStatefulWidget {
|
||||
@@ -78,10 +79,38 @@ class _MoviesTabState extends ConsumerState<MoviesTab> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
|
||||
// Filter movies by category
|
||||
final filteredMovies = settings.moviesKeywords.isEmpty
|
||||
? _movies
|
||||
: _movies.where((m) => settings.matchesMoviesFilter(m.categoryName)).toList();
|
||||
|
||||
if (_movies.isEmpty && !_isLoading) {
|
||||
return const Center(child: Text('No movies available'));
|
||||
}
|
||||
|
||||
if (filteredMovies.isEmpty && _movies.isNotEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.filter_list_off, size: 48, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'No movies match the filter',
|
||||
style: GoogleFonts.roboto(color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Filter: ${settings.moviesCategoryFilter}',
|
||||
style: GoogleFonts.roboto(fontSize: 12, color: Colors.grey.shade600),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return GridView.builder(
|
||||
controller: _scrollController,
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -91,13 +120,13 @@ class _MoviesTabState extends ConsumerState<MoviesTab> {
|
||||
mainAxisSpacing: 6,
|
||||
childAspectRatio: 0.65,
|
||||
),
|
||||
itemCount: _movies.length + (_hasMore ? 1 : 0),
|
||||
itemCount: filteredMovies.length + (_hasMore ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (index >= _movies.length) {
|
||||
if (index >= filteredMovies.length) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
final movie = _movies[index];
|
||||
final movie = filteredMovies[index];
|
||||
return _MovieCard(
|
||||
movie: movie,
|
||||
playlist: widget.playlist,
|
||||
|
||||
@@ -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/settings_provider.dart';
|
||||
import '../screens/series_detail_screen.dart';
|
||||
|
||||
class SeriesTab extends ConsumerStatefulWidget {
|
||||
@@ -78,10 +79,38 @@ class _SeriesTabState extends ConsumerState<SeriesTab> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
|
||||
// Filter series by category
|
||||
final filteredSeries = settings.seriesKeywords.isEmpty
|
||||
? _series
|
||||
: _series.where((s) => settings.matchesSeriesFilter(s.categoryName)).toList();
|
||||
|
||||
if (_series.isEmpty && !_isLoading) {
|
||||
return const Center(child: Text('No series available'));
|
||||
}
|
||||
|
||||
if (filteredSeries.isEmpty && _series.isNotEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.filter_list_off, size: 48, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'No series match the filter',
|
||||
style: GoogleFonts.roboto(color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Filter: ${settings.seriesCategoryFilter}',
|
||||
style: GoogleFonts.roboto(fontSize: 12, color: Colors.grey.shade600),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return GridView.builder(
|
||||
controller: _scrollController,
|
||||
padding: const EdgeInsets.all(8),
|
||||
@@ -91,13 +120,13 @@ class _SeriesTabState extends ConsumerState<SeriesTab> {
|
||||
mainAxisSpacing: 6,
|
||||
childAspectRatio: 0.65,
|
||||
),
|
||||
itemCount: _series.length + (_hasMore ? 1 : 0),
|
||||
itemCount: filteredSeries.length + (_hasMore ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (index >= _series.length) {
|
||||
if (index >= filteredSeries.length) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
final serie = _series[index];
|
||||
final serie = filteredSeries[index];
|
||||
return _SeriesCard(series: serie, playlist: widget.playlist);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -13,29 +13,49 @@ class SettingsTab extends ConsumerStatefulWidget {
|
||||
}
|
||||
|
||||
class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
late TextEditingController _filterController;
|
||||
late TextEditingController _liveTvController;
|
||||
late TextEditingController _moviesController;
|
||||
late TextEditingController _seriesController;
|
||||
bool _initialized = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_filterController = TextEditingController();
|
||||
_liveTvController = TextEditingController();
|
||||
_moviesController = TextEditingController();
|
||||
_seriesController = TextEditingController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_filterController.dispose();
|
||||
_liveTvController.dispose();
|
||||
_moviesController.dispose();
|
||||
_seriesController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _syncControllers(IptvSettings settings) {
|
||||
if (!_initialized || _liveTvController.text != settings.liveTvCategoryFilter) {
|
||||
_liveTvController.text = settings.liveTvCategoryFilter;
|
||||
}
|
||||
if (!_initialized || _moviesController.text != settings.moviesCategoryFilter) {
|
||||
_moviesController.text = settings.moviesCategoryFilter;
|
||||
}
|
||||
if (!_initialized || _seriesController.text != settings.seriesCategoryFilter) {
|
||||
_seriesController.text = settings.seriesCategoryFilter;
|
||||
}
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final currentUser = ref.watch(authProvider).currentUser;
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
|
||||
// Sync controller with state
|
||||
if (_filterController.text != settings.categoryFilter) {
|
||||
_filterController.text = settings.categoryFilter;
|
||||
}
|
||||
// Sync controllers with persisted state (only on first load)
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!_initialized) _syncControllers(settings);
|
||||
});
|
||||
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -62,84 +82,70 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Category filter section
|
||||
Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.filter_list, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Live TV Category Filter',
|
||||
style: GoogleFonts.roboto(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Enter keywords separated by commas. Only categories containing one of these words will be shown.',
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: _filterController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Ex: FR,FRANCE,HD,SPORT',
|
||||
hintStyle: GoogleFonts.roboto(fontSize: 13),
|
||||
border: const OutlineInputBorder(),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 10,
|
||||
),
|
||||
suffixIcon: _filterController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear, size: 18),
|
||||
onPressed: () {
|
||||
_filterController.clear();
|
||||
ref.read(iptvSettingsProvider.notifier)
|
||||
.clearCategoryFilter();
|
||||
},
|
||||
)
|
||||
: null,
|
||||
),
|
||||
style: GoogleFonts.roboto(fontSize: 13),
|
||||
onChanged: (value) {
|
||||
ref.read(iptvSettingsProvider.notifier)
|
||||
.setCategoryFilter(value);
|
||||
},
|
||||
),
|
||||
if (settings.filterKeywords.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: settings.filterKeywords.map((keyword) {
|
||||
return Chip(
|
||||
label: Text(
|
||||
keyword,
|
||||
style: GoogleFonts.roboto(fontSize: 11),
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
visualDensity: VisualDensity.compact,
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
// Category filters section
|
||||
Text(
|
||||
'Category Filters',
|
||||
style: GoogleFonts.roboto(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Only categories containing one of these keywords will be shown. Separate with commas.',
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Live TV Filter
|
||||
_buildFilterCard(
|
||||
title: 'Live TV Filter',
|
||||
icon: Icons.live_tv,
|
||||
controller: _liveTvController,
|
||||
keywords: settings.liveTvKeywords,
|
||||
onChanged: (value) {
|
||||
ref.read(iptvSettingsProvider.notifier).setLiveTvFilter(value);
|
||||
},
|
||||
onClear: () {
|
||||
_liveTvController.clear();
|
||||
ref.read(iptvSettingsProvider.notifier).clearLiveTvFilter();
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Movies Filter
|
||||
_buildFilterCard(
|
||||
title: 'Movies Filter',
|
||||
icon: Icons.movie,
|
||||
controller: _moviesController,
|
||||
keywords: settings.moviesKeywords,
|
||||
onChanged: (value) {
|
||||
ref.read(iptvSettingsProvider.notifier).setMoviesFilter(value);
|
||||
},
|
||||
onClear: () {
|
||||
_moviesController.clear();
|
||||
ref.read(iptvSettingsProvider.notifier).clearMoviesFilter();
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Series Filter
|
||||
_buildFilterCard(
|
||||
title: 'Series Filter',
|
||||
icon: Icons.tv,
|
||||
controller: _seriesController,
|
||||
keywords: settings.seriesKeywords,
|
||||
onChanged: (value) {
|
||||
ref.read(iptvSettingsProvider.notifier).setSeriesFilter(value);
|
||||
},
|
||||
onClear: () {
|
||||
_seriesController.clear();
|
||||
ref.read(iptvSettingsProvider.notifier).clearSeriesFilter();
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Admin panel
|
||||
@@ -195,4 +201,79 @@ class _SettingsTabState extends ConsumerState<SettingsTab> {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFilterCard({
|
||||
required String title,
|
||||
required IconData icon,
|
||||
required TextEditingController controller,
|
||||
required List<String> keywords,
|
||||
required ValueChanged<String> onChanged,
|
||||
required VoidCallback onClear,
|
||||
}) {
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: Colors.blue.shade700),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
title,
|
||||
style: GoogleFonts.roboto(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Ex: FR,FRANCE,HD,SPORT',
|
||||
hintStyle: GoogleFonts.roboto(fontSize: 12),
|
||||
border: const OutlineInputBorder(),
|
||||
isDense: true,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 8,
|
||||
),
|
||||
suffixIcon: controller.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const Icon(Icons.clear, size: 16),
|
||||
onPressed: onClear,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
style: GoogleFonts.roboto(fontSize: 12),
|
||||
onChanged: onChanged,
|
||||
),
|
||||
if (keywords.isNotEmpty) ...[
|
||||
const SizedBox(height: 6),
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: keywords.map((keyword) {
|
||||
return Chip(
|
||||
label: Text(
|
||||
keyword,
|
||||
style: GoogleFonts.roboto(fontSize: 10),
|
||||
),
|
||||
padding: EdgeInsets.zero,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
visualDensity: VisualDensity.compact,
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user