mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-18 20:59:59 +02:00
feat: implement IPTV player screen with web-based video playback, controls, and EPG overlay.
This commit is contained in:
1 parent
440f15faa6
commit
aa75347d0a
1 file changed
+213
-143
@@ -323,164 +323,190 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isLiveTV = widget.streamType == StreamType.live;
|
final isLiveTV = widget.streamType == StreamType.live;
|
||||||
|
|
||||||
// LITE PLAYER MODE for Live TV
|
// LITE PLAYER MODE for Live TV - Simplified UI (no BackdropFilter)
|
||||||
if (isLiveTV) {
|
if (isLiveTV) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.black, // Video background
|
backgroundColor: Colors.black,
|
||||||
body: MouseRegion(
|
body: Stack(
|
||||||
onHover: (_) => _onHover(),
|
fit: StackFit.expand,
|
||||||
child: GestureDetector(
|
children: [
|
||||||
onTap: () {
|
// Video Player
|
||||||
if (_showControls) {
|
if (_isInitialized) HtmlElementView(viewType: _viewId),
|
||||||
setState(() => _showControls = false);
|
|
||||||
} else {
|
|
||||||
_onHover();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
if (_isInitialized) HtmlElementView(viewType: _viewId),
|
|
||||||
|
|
||||||
// Top Bar
|
// Control Overlay (sits on top of video, catches all pointer events)
|
||||||
AnimatedPositioned(
|
Positioned.fill(
|
||||||
duration: const Duration(milliseconds: 200),
|
child: PointerInterceptor(
|
||||||
top: _showControls ? 24 : -100,
|
child: MouseRegion(
|
||||||
left: 24,
|
onHover: (_) => _onHover(),
|
||||||
right: 24,
|
child: GestureDetector(
|
||||||
child: PointerInterceptor(
|
behavior: HitTestBehavior.translucent,
|
||||||
child: GlassContainer(
|
onTap: () {
|
||||||
height: 72,
|
if (_showControls) {
|
||||||
borderRadius: 24,
|
setState(() => _showControls = false);
|
||||||
opacity: 0.15,
|
} else {
|
||||||
border: true,
|
_onHover();
|
||||||
borderColor: Colors.white.withOpacity(0.1),
|
}
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
},
|
||||||
child: Row(
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
_buildGlassIconButton(
|
// Top Bar
|
||||||
icon: Icons.arrow_back_rounded,
|
AnimatedPositioned(
|
||||||
onTap: () => Navigator.pop(context),
|
duration: const Duration(milliseconds: 200),
|
||||||
),
|
top: _showControls ? 0 : -100,
|
||||||
const SizedBox(width: 16),
|
left: 0,
|
||||||
Expanded(
|
right: 0,
|
||||||
child: Column(
|
child: Container(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
padding: const EdgeInsets.symmetric(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
horizontal: 16, vertical: 12),
|
||||||
children: [
|
decoration: BoxDecoration(
|
||||||
Text(
|
gradient: LinearGradient(
|
||||||
widget.channels != null
|
begin: Alignment.topCenter,
|
||||||
? widget.channels![_currentIndex].name
|
end: Alignment.bottomCenter,
|
||||||
: widget.title,
|
colors: [
|
||||||
style: GoogleFonts.outfit(
|
Colors.black.withOpacity(0.8),
|
||||||
color: Colors.white,
|
Colors.transparent,
|
||||||
fontSize: 18,
|
],
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
if (widget.channels != null)
|
),
|
||||||
Text(
|
child: SafeArea(
|
||||||
'Live TV',
|
bottom: false,
|
||||||
style: GoogleFonts.inter(
|
child: Row(
|
||||||
color: AppColors.primary,
|
children: [
|
||||||
fontSize: 12,
|
_buildSimpleIconButton(
|
||||||
fontWeight: FontWeight.bold,
|
icon: Icons.arrow_back_rounded,
|
||||||
letterSpacing: 1.0,
|
onTap: () => Navigator.pop(context),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 16),
|
||||||
],
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
widget.channels != null
|
||||||
|
? widget
|
||||||
|
.channels![_currentIndex]
|
||||||
|
.name
|
||||||
|
: widget.title,
|
||||||
|
style: GoogleFonts.outfit(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Live TV',
|
||||||
|
style: GoogleFonts.inter(
|
||||||
|
color: AppColors.primary,
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_buildSimpleIconButton(
|
||||||
|
icon: _isMuted
|
||||||
|
? Icons.volume_off_rounded
|
||||||
|
: Icons.volume_up_rounded,
|
||||||
|
onTap: _toggleMute,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
|
||||||
_buildGlassIconButton(
|
// Bottom Controls
|
||||||
icon: _isMuted
|
AnimatedPositioned(
|
||||||
? Icons.volume_off_rounded
|
duration: const Duration(milliseconds: 200),
|
||||||
: Icons.volume_up_rounded,
|
bottom: _showControls ? 0 : -150,
|
||||||
onTap: _toggleMute,
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24, vertical: 24),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.bottomCenter,
|
||||||
|
end: Alignment.topCenter,
|
||||||
|
colors: [
|
||||||
|
Colors.black.withOpacity(0.8),
|
||||||
|
Colors.transparent,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: SafeArea(
|
||||||
|
top: false,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
// Previous Channel
|
||||||
|
if (widget.channels != null &&
|
||||||
|
widget.channels!.length > 1)
|
||||||
|
_buildSimpleIconButton(
|
||||||
|
icon: Icons.skip_previous_rounded,
|
||||||
|
onTap: _previousChannel,
|
||||||
|
size: 48,
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(width: 32),
|
||||||
|
|
||||||
|
// Play/Pause (Large)
|
||||||
|
_buildSimpleIconButton(
|
||||||
|
icon: _isPlaying
|
||||||
|
? Icons.pause_rounded
|
||||||
|
: Icons.play_arrow_rounded,
|
||||||
|
onTap: _togglePlayPause,
|
||||||
|
size: 64,
|
||||||
|
iconSize: 36,
|
||||||
|
highlighted: true,
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(width: 32),
|
||||||
|
|
||||||
|
// Next Channel
|
||||||
|
if (widget.channels != null &&
|
||||||
|
widget.channels!.length > 1)
|
||||||
|
_buildSimpleIconButton(
|
||||||
|
icon: Icons.skip_next_rounded,
|
||||||
|
onTap: _nextChannel,
|
||||||
|
size: 48,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
// Bottom Controls for Live TV (Channel Zapping + Play/Pause)
|
|
||||||
if (_showControls)
|
|
||||||
AnimatedPositioned(
|
|
||||||
duration: const Duration(milliseconds: 200),
|
|
||||||
bottom: 40,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: PointerInterceptor(
|
|
||||||
child: Center(
|
|
||||||
child: GlassContainer(
|
|
||||||
borderRadius: 30,
|
|
||||||
opacity: 0.15,
|
|
||||||
border: true,
|
|
||||||
borderColor: Colors.white.withOpacity(0.1),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 24, vertical: 12),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
// Previous Channel
|
|
||||||
if (widget.channels != null &&
|
|
||||||
widget.channels!.length > 1) ...[
|
|
||||||
_buildGlassIconButton(
|
|
||||||
icon: Icons.skip_previous_rounded,
|
|
||||||
onTap: _previousChannel,
|
|
||||||
transparent: true,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 24),
|
|
||||||
],
|
|
||||||
|
|
||||||
// Play/Pause
|
|
||||||
_buildGlassIconButton(
|
|
||||||
icon: _isPlaying
|
|
||||||
? Icons.pause_rounded
|
|
||||||
: Icons.play_arrow_rounded,
|
|
||||||
onTap: _togglePlayPause,
|
|
||||||
size: 56,
|
|
||||||
iconSize: 32,
|
|
||||||
),
|
|
||||||
|
|
||||||
// Next Channel
|
|
||||||
if (widget.channels != null &&
|
|
||||||
widget.channels!.length > 1) ...[
|
|
||||||
const SizedBox(width: 24),
|
|
||||||
_buildGlassIconButton(
|
|
||||||
icon: Icons.skip_next_rounded,
|
|
||||||
onTap: _nextChannel,
|
|
||||||
transparent: true,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// EPG Overlay
|
|
||||||
if (widget.streamType == StreamType.live)
|
|
||||||
AnimatedPositioned(
|
|
||||||
duration: const Duration(milliseconds: 200),
|
|
||||||
bottom: _showControls ? 40 : -140,
|
|
||||||
left: 24,
|
|
||||||
right: 24,
|
|
||||||
child: PointerInterceptor(
|
|
||||||
child: EpgOverlay(
|
|
||||||
playlist: widget.playlist,
|
|
||||||
streamId: widget.channels != null
|
|
||||||
? widget.channels![_currentIndex].streamId
|
|
||||||
: widget.streamId,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
// EPG Overlay (outside the main PointerInterceptor)
|
||||||
|
if (widget.streamType == StreamType.live)
|
||||||
|
AnimatedPositioned(
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
bottom: _showControls ? 120 : -140,
|
||||||
|
left: 24,
|
||||||
|
right: 24,
|
||||||
|
child: PointerInterceptor(
|
||||||
|
child: EpgOverlay(
|
||||||
|
playlist: widget.playlist,
|
||||||
|
streamId: widget.channels != null
|
||||||
|
? widget.channels![_currentIndex].streamId
|
||||||
|
: widget.streamId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -753,4 +779,48 @@ class _PlayerScreenState extends ConsumerState<PlayerScreen> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simple Icon Button for Live TV player (no BackdropFilter issues)
|
||||||
|
Widget _buildSimpleIconButton({
|
||||||
|
required IconData icon,
|
||||||
|
required VoidCallback onTap,
|
||||||
|
double size = 48,
|
||||||
|
double iconSize = 24,
|
||||||
|
bool highlighted = false,
|
||||||
|
}) {
|
||||||
|
return Material(
|
||||||
|
color: highlighted
|
||||||
|
? AppColors.primary.withOpacity(0.2)
|
||||||
|
: Colors.white.withOpacity(0.1),
|
||||||
|
shape: const CircleBorder(),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
print('[PlayerScreen] Simple button tapped: $icon');
|
||||||
|
onTap();
|
||||||
|
},
|
||||||
|
customBorder: const CircleBorder(),
|
||||||
|
splashColor: AppColors.primary.withOpacity(0.3),
|
||||||
|
highlightColor: AppColors.primary.withOpacity(0.1),
|
||||||
|
child: Container(
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(
|
||||||
|
color: highlighted
|
||||||
|
? AppColors.primary.withOpacity(0.5)
|
||||||
|
: Colors.white.withOpacity(0.2),
|
||||||
|
width: highlighted ? 2 : 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
icon,
|
||||||
|
color: highlighted ? AppColors.primary : Colors.white,
|
||||||
|
size: iconSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user