mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-22 06:28:04 +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>
228 lines
8.1 KiB
Dart
228 lines
8.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import '../../../core/theme/app_colors.dart';
|
|
import '../../../core/theme/app_theme.dart';
|
|
|
|
class ChannelCard extends StatefulWidget {
|
|
final String channelNumber;
|
|
final String channelName;
|
|
final String? channelLogo;
|
|
final String? currentProgram;
|
|
final String? programTime;
|
|
final bool isFavorite;
|
|
final VoidCallback? onTap;
|
|
final VoidCallback? onFavoriteTap;
|
|
final bool isActive;
|
|
|
|
const ChannelCard({
|
|
super.key,
|
|
required this.channelNumber,
|
|
required this.channelName,
|
|
this.channelLogo,
|
|
this.currentProgram,
|
|
this.programTime,
|
|
this.isFavorite = false,
|
|
this.onTap,
|
|
this.onFavoriteTap,
|
|
this.isActive = false,
|
|
});
|
|
|
|
@override
|
|
State<ChannelCard> createState() => _ChannelCardState();
|
|
}
|
|
|
|
class _ChannelCardState extends State<ChannelCard>
|
|
with SingleTickerProviderStateMixin {
|
|
late AnimationController _pulseController;
|
|
late Animation<double> _pulseAnimation;
|
|
bool _isHovered = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_pulseController = AnimationController(
|
|
vsync: this,
|
|
duration: AppTheme.durationMd,
|
|
)..repeat(reverse: true);
|
|
|
|
_pulseAnimation = Tween<double>(begin: 1.0, end: 1.05).animate(
|
|
CurvedAnimation(parent: _pulseController, curve: AppTheme.curveSmooth),
|
|
);
|
|
|
|
if (widget.isActive) {
|
|
_pulseController.forward();
|
|
}
|
|
}
|
|
|
|
@override
|
|
void didUpdateWidget(ChannelCard oldWidget) {
|
|
super.didUpdateWidget(oldWidget);
|
|
if (widget.isActive && !oldWidget.isActive) {
|
|
_pulseController.forward();
|
|
} else if (!widget.isActive && oldWidget.isActive) {
|
|
_pulseController.reverse();
|
|
}
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_pulseController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MouseRegion(
|
|
cursor: SystemMouseCursors.click,
|
|
onEnter: (_) => setState(() => _isHovered = true),
|
|
onExit: (_) => setState(() => _isHovered = false),
|
|
child: GestureDetector(
|
|
onTap: widget.onTap,
|
|
child: ScaleTransition(
|
|
scale: widget.isActive
|
|
? _pulseAnimation
|
|
: const AlwaysStoppedAnimation(1.0),
|
|
child: AnimatedContainer(
|
|
duration: AppTheme.durationMd,
|
|
curve: AppTheme.curveDefault,
|
|
decoration: BoxDecoration(
|
|
color: widget.isActive
|
|
? AppColors.primary.withOpacity(0.15)
|
|
: AppColors.surface,
|
|
border: Border.all(
|
|
color: widget.isActive
|
|
? AppColors.primary
|
|
: (_isHovered
|
|
? AppColors.border
|
|
: AppColors.border.withOpacity(0.5)),
|
|
width: widget.isActive ? 2.5 : 1.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(AppTheme.radiusMd),
|
|
boxShadow: [
|
|
if (_isHovered || widget.isActive)
|
|
BoxShadow(
|
|
color: widget.isActive
|
|
? AppColors.primary.withOpacity(0.25)
|
|
: AppColors.primary.withOpacity(0.1),
|
|
blurRadius: 12,
|
|
offset: const Offset(0, 4),
|
|
spreadRadius: 1,
|
|
),
|
|
],
|
|
),
|
|
child: Stack(
|
|
fit: StackFit.expand,
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsets.all(AppTheme.spacingMd),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
widget.channelNumber,
|
|
style: GoogleFonts.karla(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.textSecondary,
|
|
letterSpacing: 0.5,
|
|
),
|
|
),
|
|
SizedBox(height: AppTheme.spacingXs),
|
|
Text(
|
|
widget.channelName,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: GoogleFonts.karla(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w700,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: widget.onFavoriteTap,
|
|
child: AnimatedScale(
|
|
scale: widget.isFavorite ? 1.1 : 1.0,
|
|
duration: AppTheme.durationXs,
|
|
child: Icon(
|
|
widget.isFavorite
|
|
? Icons.favorite
|
|
: Icons.favorite_border,
|
|
color: widget.isFavorite
|
|
? AppColors.secondary
|
|
: AppColors.textSecondary,
|
|
size: 20,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: AppTheme.spacingSm),
|
|
if (widget.currentProgram != null)
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
widget.currentProgram!,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: GoogleFonts.karla(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.textSecondary,
|
|
),
|
|
),
|
|
if (widget.programTime != null) ...[
|
|
SizedBox(height: AppTheme.spacingXs),
|
|
Text(
|
|
widget.programTime!,
|
|
style: GoogleFonts.karla(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w400,
|
|
color: AppColors.textTertiary,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (widget.isActive)
|
|
Positioned(
|
|
top: AppTheme.spacingSm,
|
|
right: AppTheme.spacingSm,
|
|
child: Container(
|
|
width: 8,
|
|
height: 8,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.primary,
|
|
shape: BoxShape.circle,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: AppColors.primary.withOpacity(0.6),
|
|
blurRadius: 8,
|
|
spreadRadius: 2,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|