mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
feat: Implement streaming handlers for live MPEG-TS proxy and VOD HLS transcoding via FFmpeg, and add a release build script.
This commit is contained in:
1 parent
c7ba52b88d
commit
8128174ac3
26 files changed
+1529
-927
No files matched your search
@@ -193,7 +193,7 @@ class _MobileLoginScreenState extends ConsumerState<MobileLoginScreen> {
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
elevation: 0,
|
||||
).copyWith(
|
||||
overlayColor: MaterialStateProperty.all(Colors.black12),
|
||||
overlayColor: WidgetStateProperty.all(Colors.black12),
|
||||
),
|
||||
child: authState.isLoading
|
||||
? const SizedBox(
|
||||
|
||||
@@ -6,7 +6,7 @@ import '../../../../core/models/playlist_config.dart';
|
||||
import '../../../../features/iptv/models/xtream_models.dart';
|
||||
import '../../../../features/iptv/providers/xtream_provider.dart';
|
||||
import '../../../../features/iptv/providers/watch_history_provider.dart';
|
||||
import '../../../../features/iptv/screens/player_screen.dart'; // Explicit import for StreamType
|
||||
// Explicit import for StreamType
|
||||
import 'mobile_player_screen.dart';
|
||||
import '../../../../core/theme/app_colors.dart';
|
||||
import '../../../../core/widgets/glass_container.dart';
|
||||
@@ -22,10 +22,12 @@ class MobileSeriesDetailScreen extends ConsumerStatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
ConsumerState<MobileSeriesDetailScreen> createState() => _MobileSeriesDetailScreenState();
|
||||
ConsumerState<MobileSeriesDetailScreen> createState() =>
|
||||
_MobileSeriesDetailScreenState();
|
||||
}
|
||||
|
||||
class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScreen> {
|
||||
class _MobileSeriesDetailScreenState
|
||||
extends ConsumerState<MobileSeriesDetailScreen> {
|
||||
SeriesInfo? _seriesInfo;
|
||||
bool _isLoading = true;
|
||||
String? _error;
|
||||
@@ -83,7 +85,7 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
// Global Background
|
||||
Container(
|
||||
Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
center: Alignment.center,
|
||||
@@ -92,18 +94,21 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
if (_isLoading)
|
||||
const Center(child: CircularProgressIndicator(color: Colors.white))
|
||||
else if (_error != null)
|
||||
Center(
|
||||
Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 48, color: AppColors.error),
|
||||
const Icon(Icons.error_outline,
|
||||
size: 48, color: AppColors.error),
|
||||
const SizedBox(height: 16),
|
||||
Text('Error: $_error', style: GoogleFonts.inter(color: Colors.white70)),
|
||||
TextButton(onPressed: _loadSeriesInfo, child: const Text('Retry')),
|
||||
Text('Error: $_error',
|
||||
style: GoogleFonts.inter(color: Colors.white70)),
|
||||
TextButton(
|
||||
onPressed: _loadSeriesInfo, child: const Text('Retry')),
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -145,7 +150,8 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
CachedNetworkImage(
|
||||
imageUrl: _seriesInfo!.cover!,
|
||||
fit: BoxFit.cover,
|
||||
errorWidget: (_, __, ___) => Container(color: Colors.grey.shade900),
|
||||
errorWidget: (_, __, ___) =>
|
||||
Container(color: Colors.grey.shade900),
|
||||
),
|
||||
// Gradient Overlay
|
||||
Container(
|
||||
@@ -164,7 +170,9 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
),
|
||||
// Info Overlay
|
||||
Positioned(
|
||||
bottom: 16, left: 16, right: 16,
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -181,17 +189,20 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
Row(
|
||||
children: [
|
||||
if (_seriesInfo!.rating != null) ...[
|
||||
const Icon(Icons.star, size: 16, color: Colors.amber),
|
||||
const Icon(Icons.star,
|
||||
size: 16, color: Colors.amber),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
_formatRating(_seriesInfo!.rating!)!,
|
||||
style: GoogleFonts.inter(color: Colors.white70, fontSize: 13),
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.white70, fontSize: 13),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
Text(
|
||||
'${_seriesInfo!.episodes.keys.length} Seasons',
|
||||
style: GoogleFonts.inter(color: Colors.white70, fontSize: 13),
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.white70, fontSize: 13),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -241,7 +252,8 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
color: isSelected ? Colors.white : Colors.white70,
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w400,
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
showCheckmark: false,
|
||||
side: BorderSide.none,
|
||||
);
|
||||
@@ -287,7 +299,9 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
padding: EdgeInsets.zero,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
ref.read(watchHistoryProvider.notifier).markEpisodeWatched(episodeKey);
|
||||
ref
|
||||
.read(watchHistoryProvider.notifier)
|
||||
.markEpisodeWatched(episodeKey);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@@ -311,7 +325,9 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: isWatched ? AppColors.primary : Colors.white.withOpacity(0.1),
|
||||
color: isWatched
|
||||
? AppColors.primary
|
||||
: Colors.white.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
@@ -335,10 +351,12 @@ class _MobileSeriesDetailScreenState extends ConsumerState<MobileSeriesDetailScr
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (episode.durationSecs != null && episode.durationSecs! > 0)
|
||||
if (episode.durationSecs != null &&
|
||||
episode.durationSecs! > 0)
|
||||
Text(
|
||||
_formatDuration(episode.durationSecs!),
|
||||
style: GoogleFonts.inter(color: Colors.white54, fontSize: 12),
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.white54, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -34,7 +34,8 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final channelsAsync = ref.watch(liveChannelsByPlaylistProvider(widget.playlist));
|
||||
final channelsAsync =
|
||||
ref.watch(liveChannelsByPlaylistProvider(widget.playlist));
|
||||
final favorites = ref.watch(favoritesProvider);
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
|
||||
@@ -42,26 +43,32 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
backgroundColor: Colors.transparent, // Handled by MobileScaffold
|
||||
body: channelsAsync.when(
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (e, s) => Center(child: Text('Error: $e', style: const TextStyle(color: Colors.white))),
|
||||
error: (e, s) => Center(
|
||||
child:
|
||||
Text('Error: $e', style: const TextStyle(color: Colors.white))),
|
||||
data: (groupedChannels) {
|
||||
var categories = groupedChannels.keys.toList();
|
||||
if (settings.liveTvKeywords.isNotEmpty) {
|
||||
categories = categories.where((cat) => settings.matchesLiveTvFilter(cat)).toList();
|
||||
categories = categories
|
||||
.where((cat) => settings.matchesLiveTvFilter(cat))
|
||||
.toList();
|
||||
}
|
||||
categories.sort();
|
||||
|
||||
List<Channel> displayedChannels = [];
|
||||
if (_searchQuery.isNotEmpty) {
|
||||
displayedChannels = groupedChannels.values.expand((l) => l)
|
||||
displayedChannels = groupedChannels.values
|
||||
.expand((l) => l)
|
||||
.where((c) => c.name.toLowerCase().contains(_searchQuery))
|
||||
.toList();
|
||||
} else if (_showFavoritesOnly) {
|
||||
displayedChannels = groupedChannels.values.expand((l) => l)
|
||||
displayedChannels = groupedChannels.values
|
||||
.expand((l) => l)
|
||||
.where((c) => favorites.contains(c.streamId))
|
||||
.toList();
|
||||
} else {
|
||||
if (_selectedCategory == null && categories.isNotEmpty) {
|
||||
_selectedCategory = categories.first;
|
||||
_selectedCategory = categories.first;
|
||||
}
|
||||
if (_selectedCategory != null) {
|
||||
displayedChannels = groupedChannels[_selectedCategory] ?? [];
|
||||
@@ -78,27 +85,31 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
child: GlassContainer(
|
||||
borderRadius: 16,
|
||||
opacity: 0.1,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
style: GoogleFonts.inter(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search channels...',
|
||||
hintStyle: GoogleFonts.inter(color: Colors.white54),
|
||||
border: InputBorder.none,
|
||||
prefixIcon: const Icon(Icons.search, color: Colors.white54),
|
||||
isDense: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_searchQuery.isNotEmpty)
|
||||
GestureDetector(
|
||||
onTap: () => _searchController.clear(),
|
||||
child: const Icon(Icons.close, color: Colors.white54),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
style: GoogleFonts.inter(color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search channels...',
|
||||
hintStyle:
|
||||
GoogleFonts.inter(color: Colors.white54),
|
||||
border: InputBorder.none,
|
||||
prefixIcon: const Icon(Icons.search,
|
||||
color: Colors.white54),
|
||||
isDense: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_searchQuery.isNotEmpty)
|
||||
GestureDetector(
|
||||
onTap: () => _searchController.clear(),
|
||||
child:
|
||||
const Icon(Icons.close, color: Colors.white54),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -117,19 +128,26 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
final category = categories[index];
|
||||
final isSelected = category == _selectedCategory;
|
||||
return GestureDetector(
|
||||
onTap: () => setState(() => _selectedCategory = category),
|
||||
onTap: () =>
|
||||
setState(() => _selectedCategory = category),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? Colors.white : Colors.black.withOpacity(0.4),
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: Colors.black.withOpacity(0.4),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
category,
|
||||
style: GoogleFonts.inter(
|
||||
color: isSelected ? Colors.black : Colors.white70,
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w500,
|
||||
color:
|
||||
isSelected ? Colors.black : Colors.white70,
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.w500,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
@@ -145,28 +163,39 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
_searchQuery.isNotEmpty ? 'Results' :
|
||||
_showFavoritesOnly ? 'Favorites' :
|
||||
_selectedCategory ?? 'Channels',
|
||||
_searchQuery.isNotEmpty
|
||||
? 'Results'
|
||||
: _showFavoritesOnly
|
||||
? 'Favorites'
|
||||
: _selectedCategory ?? 'Channels',
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.white,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => setState(() => _showFavoritesOnly = !_showFavoritesOnly),
|
||||
onTap: () => setState(
|
||||
() => _showFavoritesOnly = !_showFavoritesOnly),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: _showFavoritesOnly ? AppColors.live.withOpacity(0.2) : Colors.white.withOpacity(0.1),
|
||||
color: _showFavoritesOnly
|
||||
? AppColors.live.withOpacity(0.2)
|
||||
: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: _showFavoritesOnly ? Border.all(color: AppColors.live) : null,
|
||||
border: _showFavoritesOnly
|
||||
? Border.all(color: AppColors.live)
|
||||
: null,
|
||||
),
|
||||
child: Icon(
|
||||
_showFavoritesOnly ? Icons.favorite : Icons.favorite_border,
|
||||
color: _showFavoritesOnly ? AppColors.live : Colors.white,
|
||||
_showFavoritesOnly
|
||||
? Icons.favorite
|
||||
: Icons.favorite_border,
|
||||
color: _showFavoritesOnly
|
||||
? AppColors.live
|
||||
: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
@@ -182,7 +211,8 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.tv_off, color: Colors.white24, size: 48),
|
||||
const Icon(Icons.tv_off,
|
||||
color: Colors.white24, size: 48),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'No channels found',
|
||||
@@ -194,7 +224,8 @@ class _MobileLiveTVTabState extends ConsumerState<MobileLiveTVTab> {
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 100),
|
||||
itemCount: displayedChannels.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 8),
|
||||
separatorBuilder: (_, __) =>
|
||||
const SizedBox(height: 8),
|
||||
itemBuilder: (context, index) {
|
||||
final channel = displayedChannels[index];
|
||||
return _MobileChannelTile(
|
||||
@@ -240,14 +271,17 @@ class _MobileChannelTile extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final iconUrl = channel.streamIcon.isNotEmpty && channel.streamIcon.startsWith('http')
|
||||
? '/api/xtream/${channel.streamIcon}'
|
||||
: null;
|
||||
final iconUrl =
|
||||
channel.streamIcon.isNotEmpty && channel.streamIcon.startsWith('http')
|
||||
? '/api/xtream/${channel.streamIcon}'
|
||||
: null;
|
||||
|
||||
// Fetch EPG
|
||||
final epgAsync = ref.watch(epgByPlaylistProvider(
|
||||
EpgRequestKey(playlist: playlist, streamId: channel.streamId)
|
||||
));
|
||||
final epgAsync = ref.watch(
|
||||
epgByPlaylistProvider(
|
||||
EpgRequestKey(playlist: playlist, streamId: channel.streamId),
|
||||
),
|
||||
);
|
||||
|
||||
return GlassContainer(
|
||||
borderRadius: 12,
|
||||
@@ -270,9 +304,10 @@ class _MobileChannelTile extends ConsumerWidget {
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: iconUrl != null
|
||||
? Image.network(
|
||||
iconUrl,
|
||||
iconUrl,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (_, __, ___) => const Icon(Icons.tv, color: Colors.white24),
|
||||
errorBuilder: (_, __, ___) =>
|
||||
const Icon(Icons.tv, color: Colors.white24),
|
||||
)
|
||||
: const Icon(Icons.tv, color: Colors.white24),
|
||||
),
|
||||
@@ -291,7 +326,7 @@ class _MobileChannelTile extends ConsumerWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
|
||||
// EPG Only (Replaces Channel Number)
|
||||
epgAsync.when(
|
||||
data: (epgList) {
|
||||
@@ -308,7 +343,8 @@ class _MobileChannelTile extends ConsumerWidget {
|
||||
return Text(
|
||||
current.title,
|
||||
style: GoogleFonts.inter(
|
||||
color: const Color(0xFFFFD700), // Gold/Amber for visibility check
|
||||
color: const Color(
|
||||
0xFFFFD700), // Gold/Amber for visibility check
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -316,8 +352,11 @@ class _MobileChannelTile extends ConsumerWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
},
|
||||
loading: () => Text('...', style: TextStyle(color: Colors.white38, fontSize: 12)),
|
||||
error: (err, stack) => Text('Err', style: TextStyle(color: Colors.red, fontSize: 10)),
|
||||
loading: () => const Text('...',
|
||||
style:
|
||||
TextStyle(color: Colors.white38, fontSize: 12)),
|
||||
error: (err, stack) => const Text('Err',
|
||||
style: TextStyle(color: Colors.red, fontSize: 10)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -328,7 +367,8 @@ class _MobileChannelTile extends ConsumerWidget {
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(Icons.play_arrow_rounded, color: Colors.white, size: 16),
|
||||
child: const Icon(Icons.play_arrow_rounded,
|
||||
color: Colors.white, size: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -49,9 +49,10 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
}
|
||||
|
||||
void _onScroll() {
|
||||
if (!_isLoading && _hasMore &&
|
||||
if (!_isLoading &&
|
||||
_hasMore &&
|
||||
_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent * 0.8) {
|
||||
_scrollController.position.maxScrollExtent * 0.8) {
|
||||
_loadMoreMovies();
|
||||
}
|
||||
}
|
||||
@@ -65,7 +66,7 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
_isSearching = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (query.length >= 2) {
|
||||
_searchDebounce = Timer(const Duration(milliseconds: 500), () {
|
||||
_performSearch(query);
|
||||
@@ -76,11 +77,11 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
Future<void> _performSearch(String query) async {
|
||||
if (query.isEmpty) return;
|
||||
setState(() => _isSearching = true);
|
||||
|
||||
|
||||
try {
|
||||
final service = ref.read(xtreamServiceProvider(widget.playlist));
|
||||
final results = await service.searchMovies(query);
|
||||
|
||||
|
||||
if (mounted && _searchQuery == query) {
|
||||
setState(() {
|
||||
_searchResults = results;
|
||||
@@ -138,7 +139,7 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
|
||||
void _playMovie(Movie movie) {
|
||||
ref.read(watchHistoryProvider.notifier).markMovieWatched(movie.streamId);
|
||||
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@@ -157,23 +158,30 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
Widget build(BuildContext context) {
|
||||
final settings = ref.watch(iptvSettingsProvider);
|
||||
final watchHistory = ref.watch(watchHistoryProvider);
|
||||
|
||||
|
||||
List<Movie> displayMovies;
|
||||
if (_searchQuery.isNotEmpty && _searchResults != null) {
|
||||
displayMovies = _searchResults!;
|
||||
} else {
|
||||
displayMovies = settings.moviesKeywords.isEmpty
|
||||
? _movies
|
||||
: _movies.where((m) => settings.matchesMoviesFilter(m.categoryName)).toList();
|
||||
: _movies
|
||||
.where((m) => settings.matchesMoviesFilter(m.categoryName))
|
||||
.toList();
|
||||
}
|
||||
|
||||
final heroItems = displayMovies.take(3).map((m) => HeroItem(
|
||||
id: m.streamId,
|
||||
title: m.name,
|
||||
imageUrl: _getProxiedImageUrl(m.streamIcon),
|
||||
subtitle: m.rating != null ? '${_formatRating(m.rating)} ★' : null,
|
||||
onMoreInfo: () => _playMovie(m),
|
||||
)).toList();
|
||||
final heroItems = displayMovies
|
||||
.take(3)
|
||||
.map(
|
||||
(m) => HeroItem(
|
||||
id: m.streamId,
|
||||
title: m.name,
|
||||
imageUrl: _getProxiedImageUrl(m.streamIcon),
|
||||
subtitle: m.rating != null ? '${_formatRating(m.rating)} ★' : null,
|
||||
onMoreInfo: () => _playMovie(m),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
|
||||
return SafeArea(
|
||||
bottom: false,
|
||||
@@ -187,7 +195,8 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
child: GlassContainer(
|
||||
borderRadius: 100,
|
||||
opacity: 0.1, // Glass
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.search, size: 20, color: Colors.white54),
|
||||
@@ -195,7 +204,8 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
style: GoogleFonts.inter(fontSize: 14, color: Colors.white),
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 14, color: Colors.white),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search Movies...',
|
||||
hintStyle: GoogleFonts.inter(color: Colors.white54),
|
||||
@@ -207,14 +217,19 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
),
|
||||
),
|
||||
if (_isSearching)
|
||||
const SizedBox(width: 12, height: 12, child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white)),
|
||||
const SizedBox(
|
||||
width: 12,
|
||||
height: 12,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2, color: Colors.white)),
|
||||
if (_searchQuery.isNotEmpty)
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
_searchController.clear();
|
||||
_onSearchChanged('');
|
||||
_searchController.clear();
|
||||
_onSearchChanged('');
|
||||
},
|
||||
child: const Icon(Icons.close, size: 16, color: Colors.white),
|
||||
child: const Icon(Icons.close,
|
||||
size: 16, color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -228,18 +243,19 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
child: SizedBox(
|
||||
height: 250,
|
||||
child: HeroCarousel(
|
||||
items: heroItems,
|
||||
onTap: (item) {
|
||||
final movie = _movies.firstWhere((element) => element.streamId == item.id);
|
||||
_playMovie(movie);
|
||||
},
|
||||
),
|
||||
height: 250,
|
||||
child: HeroCarousel(
|
||||
items: heroItems,
|
||||
onTap: (item) {
|
||||
final movie = _movies
|
||||
.firstWhere((element) => element.streamId == item.id);
|
||||
_playMovie(movie);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
// Grid
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 80),
|
||||
@@ -255,11 +271,13 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
if (index >= displayMovies.length) return null;
|
||||
final movie = displayMovies[index];
|
||||
final isWatched = watchHistory.isMovieWatched(movie.streamId);
|
||||
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => _playMovie(movie),
|
||||
onLongPress: () {
|
||||
ref.read(watchHistoryProvider.notifier).toggleMovieWatched(movie.streamId);
|
||||
ref
|
||||
.read(watchHistoryProvider.notifier)
|
||||
.toggleMovieWatched(movie.streamId);
|
||||
},
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
@@ -267,46 +285,66 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
// Poster
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: movie.streamIcon != null && movie.streamIcon!.isNotEmpty
|
||||
? Image.network(
|
||||
_getProxiedImageUrl(movie.streamIcon),
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) => Container(color: Colors.white10),
|
||||
)
|
||||
: Container(color: Colors.white10, child: const Icon(Icons.movie, color: Colors.white24)),
|
||||
child: movie.streamIcon != null &&
|
||||
movie.streamIcon!.isNotEmpty
|
||||
? Image.network(
|
||||
_getProxiedImageUrl(movie.streamIcon),
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) =>
|
||||
Container(color: Colors.white10),
|
||||
)
|
||||
: Container(
|
||||
color: Colors.white10,
|
||||
child: const Icon(Icons.movie,
|
||||
color: Colors.white24)),
|
||||
),
|
||||
|
||||
|
||||
// Gradient Overlay
|
||||
Positioned(
|
||||
bottom: 0, left: 0, right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 80,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Colors.transparent, Colors.black.withOpacity(0.9)],
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
Colors.black.withOpacity(0.9)
|
||||
],
|
||||
),
|
||||
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(16)),
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
bottom: Radius.circular(16)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Title
|
||||
Positioned(
|
||||
bottom: 12, left: 12, right: 12,
|
||||
bottom: 12,
|
||||
left: 12,
|
||||
right: 12,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
movie.name,
|
||||
style: GoogleFonts.inter(color: Colors.white, fontSize: 13, fontWeight: FontWeight.w600),
|
||||
style: GoogleFonts.inter(
|
||||
color: Colors.white,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (isWatched)
|
||||
Text('WATCHED', style: GoogleFonts.inter(color: AppColors.primary, fontSize: 10, fontWeight: FontWeight.bold)),
|
||||
Text('WATCHED',
|
||||
style: GoogleFonts.inter(
|
||||
color: AppColors.primary,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -314,19 +352,25 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
// Rating
|
||||
if (movie.rating != null && movie.rating!.isNotEmpty)
|
||||
Positioned(
|
||||
top: 8, right: 8,
|
||||
top: 8,
|
||||
right: 8,
|
||||
child: GlassContainer(
|
||||
borderRadius: 4,
|
||||
opacity: 0.6,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6, vertical: 2),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.star, size: 10, color: Colors.amber),
|
||||
const Icon(Icons.star,
|
||||
size: 10, color: Colors.amber),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
_formatRating(movie.rating)!,
|
||||
style: GoogleFonts.inter(fontSize: 10, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -340,12 +384,13 @@ class _MobileMoviesTabState extends ConsumerState<MobileMoviesTab> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
if (_isLoading)
|
||||
const SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(24),
|
||||
child: Center(child: CircularProgressIndicator(color: Colors.white)),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user