mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-19 21:18:06 +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>
218 lines
6.5 KiB
Dart
218 lines
6.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../core/theme/app_colors.dart';
|
|
|
|
/// Horizontal carousel for displaying channels by category
|
|
///
|
|
/// Netflix-style horizontal scrolling list with:
|
|
/// - Category title with count
|
|
/// - Smooth horizontal scrolling
|
|
/// - Lazy loading support
|
|
/// - Fade edges for visual polish
|
|
class CategoryCarousel<T> extends StatelessWidget {
|
|
final String title;
|
|
final int? itemCount;
|
|
final List<T> items;
|
|
final Widget Function(BuildContext context, T item, int index) itemBuilder;
|
|
final double itemWidth;
|
|
final double itemHeight;
|
|
final double spacing;
|
|
final EdgeInsets? padding;
|
|
final VoidCallback? onSeeAllTap;
|
|
|
|
const CategoryCarousel({
|
|
super.key,
|
|
required this.title,
|
|
required this.items,
|
|
required this.itemBuilder,
|
|
this.itemCount,
|
|
this.itemWidth = 180,
|
|
this.itemHeight = 120,
|
|
this.spacing = 12,
|
|
this.padding,
|
|
this.onSeeAllTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
|
|
if (items.isEmpty) {
|
|
return const SizedBox.shrink();
|
|
}
|
|
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Category header
|
|
Padding(
|
|
padding: padding ?? const EdgeInsets.symmetric(horizontal: 16),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w700,
|
|
color: colorScheme.onSurface,
|
|
),
|
|
),
|
|
if (itemCount != null) ...[
|
|
const SizedBox(width: 8),
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 8,
|
|
vertical: 2,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: colorScheme.primary.withOpacity(0.15),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Text(
|
|
'$itemCount',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontWeight: FontWeight.w600,
|
|
color: colorScheme.primary,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
if (onSeeAllTap != null)
|
|
TextButton(
|
|
onPressed: onSeeAllTap,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
'Voir tout',
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w600,
|
|
color: colorScheme.primary,
|
|
),
|
|
),
|
|
const SizedBox(width: 4),
|
|
Icon(
|
|
Icons.arrow_forward_ios_rounded,
|
|
size: 12,
|
|
color: colorScheme.primary,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 12),
|
|
|
|
// Horizontal scrolling list with fade edges
|
|
SizedBox(
|
|
height: itemHeight,
|
|
child: ShaderMask(
|
|
shaderCallback: (Rect bounds) {
|
|
return const LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: [
|
|
Colors.transparent,
|
|
AppColors.onSurface,
|
|
AppColors.onSurface,
|
|
Colors.transparent,
|
|
],
|
|
stops: [0.0, 0.02, 0.98, 1.0],
|
|
).createShader(bounds);
|
|
},
|
|
blendMode: BlendMode.dstIn,
|
|
child: ListView.separated(
|
|
scrollDirection: Axis.horizontal,
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: (padding?.left ?? 16),
|
|
),
|
|
physics: const BouncingScrollPhysics(),
|
|
itemCount: items.length,
|
|
separatorBuilder: (_, __) => SizedBox(width: spacing),
|
|
itemBuilder: (context, index) {
|
|
return SizedBox(
|
|
width: itemWidth,
|
|
height: itemHeight,
|
|
child: itemBuilder(context, items[index], index),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Simple category chip for filtering
|
|
class CategoryChipButton extends StatelessWidget {
|
|
final String label;
|
|
final bool isSelected;
|
|
final VoidCallback? onTap;
|
|
final IconData? icon;
|
|
|
|
const CategoryChipButton({
|
|
super.key,
|
|
required this.label,
|
|
this.isSelected = false,
|
|
this.onTap,
|
|
this.icon,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final colorScheme = theme.colorScheme;
|
|
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
|
decoration: BoxDecoration(
|
|
gradient: isSelected ? AppColors.primaryGradient : null,
|
|
color: isSelected ? null : colorScheme.surfaceContainerHighest,
|
|
borderRadius: BorderRadius.circular(20),
|
|
border: Border.all(
|
|
color: isSelected ? Colors.transparent : colorScheme.outlineVariant,
|
|
),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (icon != null) ...[
|
|
Icon(
|
|
icon,
|
|
size: 16,
|
|
color: isSelected
|
|
? colorScheme.onPrimary
|
|
: colorScheme.onSurfaceVariant,
|
|
),
|
|
const SizedBox(width: 6),
|
|
],
|
|
Text(
|
|
label,
|
|
style: TextStyle(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w600,
|
|
color:
|
|
isSelected ? colorScheme.onPrimary : colorScheme.onSurface,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|