mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-18 04:39:41 +02:00
Full visual overhaul from Cyber-Cinematic Glass to "Warm Cinema": warm charcoal (#0B0908), cream (#F3E9DF), ember (#D9541F). Fraunces (editorial serif) for display, Karla for body/UI. Design - app_colors: new palette, all existing token names preserved, plus posterScrim/heroScrim gradients and lift()/emberFocus() shadows - app_theme: new type scale, tighter radii, 20+ component themes - mobile_theme aligned on the same tokens - glass_container: opaque layered surfaces replace glassmorphism; adds GlassCard (hover + remote-focus states) and CinemaBackdrop - players and boot splash restyled (film-leader motif, no web fonts) Performance - remove every BackdropFilter (33 call sites): backdrop blur forced a full framebuffer read per frame per card, the main scroll jank source - bundle Fraunces/Karla as assets: google_fonts no longer fetches from fonts.gstatic.com at startup - drop the blocking hls.js CDN script from index.html; no Dart code ever used it, only the player iframes need it - self-host hls.js/mpegts.js and load them on demand, so ~213 KB of mpegts is never downloaded for HLS streams - bound image decode size on 10 sites: a 40-poster grid drops from ~240 MB to a few tens of MB of GPU memory Players (new shared engine: web/xf-player-core.js) - event-driven start instead of a 200 ms buffer poll plus a 1.5 s wait - initialLiveManifestSize 3 -> 1, liveSyncDurationCount 10 -> 2, startFragPrefetch on, testBandwidth off - MPEG-TS initial stash 512 KB -> 64 KB - adaptive escalation fast -> balanced -> safe on repeated stalls (60 s rolling window), applied live for HLS so there is no visible cut Pre-existing build breakage fixed along the way - undefined AppColors.shimmer, AppTheme.durationXs and spacing8/12/16/32 - broken relative imports in channel_card and quality_selector_widget - missing GlassCard widget and hasBorder/showShadow parameters Also resolves a leftover unmerged .claude/settings.local.json by keeping the remote version. Still broken (pre-existing, dead code, not reachable from main.dart): recommendations_provider.dart and continue_watching_widget.dart import a models/playlist.dart that no longer exists. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
170 lines
4.7 KiB
Dart
170 lines
4.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import '../../../core/models/playlist_config.dart';
|
|
import '../providers/xtream_provider.dart';
|
|
import '../models/xtream_models.dart';
|
|
import '../../../core/theme/app_colors.dart';
|
|
|
|
class EPGWidget extends ConsumerStatefulWidget {
|
|
final String channelId;
|
|
final PlaylistConfig playlist;
|
|
|
|
const EPGWidget({
|
|
super.key,
|
|
required this.channelId,
|
|
required this.playlist,
|
|
});
|
|
|
|
@override
|
|
ConsumerState<EPGWidget> createState() => _EPGWidgetState();
|
|
}
|
|
|
|
class _EPGWidgetState extends ConsumerState<EPGWidget> {
|
|
ShortEPG? _epg;
|
|
bool _isLoading = true;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_loadEPG();
|
|
}
|
|
|
|
Future<void> _loadEPG() async {
|
|
try {
|
|
final service = ref.read(xtreamServiceProvider(widget.playlist));
|
|
final epg = await service.getShortEPG(widget.channelId);
|
|
|
|
if (mounted) {
|
|
setState(() {
|
|
_epg = epg;
|
|
_isLoading = false;
|
|
});
|
|
}
|
|
} catch (e) {
|
|
if (mounted) {
|
|
setState(() {
|
|
_isLoading = false;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (_isLoading) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(8),
|
|
child: const Row(
|
|
children: [
|
|
SizedBox(
|
|
width: 12,
|
|
height: 12,
|
|
child: CircularProgressIndicator(strokeWidth: 1.5),
|
|
),
|
|
SizedBox(width: 8),
|
|
Text('Loading EPG...', style: TextStyle(fontSize: 10)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
if (_epg == null ||
|
|
(_epg!.nowPlaying == null && _epg!.nextPlaying == null)) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
|
|
return Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.background.withOpacity(0.6),
|
|
borderRadius: BorderRadius.circular(4),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// Now Playing
|
|
if (_epg!.nowPlaying != null) ...[
|
|
Row(
|
|
children: [
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 6,
|
|
vertical: 2,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.error,
|
|
borderRadius: BorderRadius.circular(3),
|
|
),
|
|
child: Text(
|
|
'LIVE',
|
|
style: GoogleFonts.karla(
|
|
fontSize: 9,
|
|
fontWeight: FontWeight.bold,
|
|
color: AppColors.onSurface,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 6),
|
|
Expanded(
|
|
child: Text(
|
|
_epg!.nowPlaying!,
|
|
style: GoogleFonts.karla(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.onSurface,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
|
|
// Progress bar
|
|
if (_epg!.progress != null) ...[
|
|
const SizedBox(height: 4),
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(2),
|
|
child: LinearProgressIndicator(
|
|
value: _epg!.progress!.clamp(0.0, 1.0),
|
|
backgroundColor: AppColors.outlineVariant,
|
|
valueColor: const AlwaysStoppedAnimation<Color>(AppColors.error),
|
|
minHeight: 3,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
|
|
// Next Playing
|
|
if (_epg!.nextPlaying != null) ...[
|
|
const SizedBox(height: 6),
|
|
Row(
|
|
children: [
|
|
Icon(
|
|
Icons.upcoming,
|
|
size: 12,
|
|
color: AppColors.outline,
|
|
),
|
|
const SizedBox(width: 6),
|
|
Expanded(
|
|
child: Text(
|
|
'Next: ${_epg!.nextPlaying}',
|
|
style: GoogleFonts.karla(
|
|
fontSize: 10,
|
|
color: AppColors.outline,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|