Files
xtremflow/lib/features/iptv/widgets/quality_selector_widget.dart
T
MichaelandClaude Opus 5 1feeaae78a feat(design): Warm Cinema theme + event-driven adaptive players
Replaces the Projector Noir palette with "Warm Cinema" and rebuilds the
web players around a shared, event-driven engine.

Design
- app_colors: warm charcoal (#0B0908), cream (#F3E9DF), ember (#D9541F);
  adds posterScrim/heroScrim gradients, lift()/emberFocus() shadows,
  const cream-alpha tokens replacing Colors.whiteNN, and primaryFill,
  a deeper ember reserved for text-bearing fills so white labels clear
  the 4.5:1 AA threshold that #D9541F alone does not
- app_theme / mobile_theme: Fraunces (display serif) + Karla (body),
  tighter radii, 20+ component themes
- glass_container: opaque layered surfaces replace the blurred glass
- themed_loading_screen restyled; players and boot splash follow

Performance
- drop every BackdropFilter: backdrop blur forced a full framebuffer
  read per frame per card, the main source of scroll jank
- bundle Fraunces/Karla as assets so google_fonts stops fetching from
  fonts.gstatic.com at startup
- bound image decode size on 12 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)
- start on media events instead of polling the buffer every 100-200 ms
- hls.js/mpegts.js loaded on demand, so ~213 KB of mpegts is never
  fetched for HLS streams
- liveSyncDurationCount 10 -> 2, startFragPrefetch on, testBandwidth
  off, MPEG-TS initial stash 512 KB -> 64 KB
- adaptive escalation fast -> balanced -> safe after repeated stalls in
  a 60 s window, applied live for HLS so there is no visible cut

Preserved from the recent streaming work on main: server-side quality
selection, stable player viewId, the turbo direct MPEG-TS path, vendored
library cache headers and the CI/Docker changes. Only the theme layer and
the player front-end were replaced; GlassCard stays in ui_components.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 21:42:56 +02:00

108 lines
3.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../../core/theme/app_colors.dart';
/// Stream quality presets handled server-side by FFmpeg
/// (see bin/api/streaming_handler.dart).
enum StreamQuality {
source('source', 'Source', 'Flux direct, zéro transcodage'),
high('high', 'Haute', '1080p · 6-8 Mbps'),
medium('medium', 'Moyenne', '3 Mbps'),
low('low', 'Basse', '720p · 1.5 Mbps');
const StreamQuality(this.value, this.label, this.description);
final String value;
final String label;
final String description;
}
/// Popup button to switch the transcoding quality of the current stream.
class QualitySelectorButton extends StatelessWidget {
final StreamQuality current;
final ValueChanged<StreamQuality> onSelected;
final double size;
const QualitySelectorButton({
super.key,
required this.current,
required this.onSelected,
this.size = 44,
});
@override
Widget build(BuildContext context) {
return Tooltip(
message: 'Qualité : ${current.label}',
child: PopupMenuButton<StreamQuality>(
initialValue: current,
color: AppColors.surfaceContainerHigh,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
onSelected: onSelected,
itemBuilder: (context) => StreamQuality.values
.map(
(q) => PopupMenuItem<StreamQuality>(
value: q,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
q == current
? Icons.radio_button_checked_rounded
: Icons.radio_button_off_rounded,
size: 18,
color: q == current
? AppColors.primary
: AppColors.textTertiary,
),
const SizedBox(width: 12),
Flexible(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
q.label,
overflow: TextOverflow.ellipsis,
style: GoogleFonts.karla(
color: AppColors.textPrimary,
fontWeight: FontWeight.w600,
fontSize: 14,
),
),
Text(
q.description,
overflow: TextOverflow.ellipsis,
style: GoogleFonts.karla(
color: AppColors.textTertiary,
fontSize: 11,
),
),
],
),
),
],
),
),
)
.toList(),
child: Container(
width: size,
height: size,
alignment: Alignment.center,
decoration: BoxDecoration(
color: AppColors.onSurface.withOpacity(0.1),
shape: BoxShape.circle,
border: Border.all(color: AppColors.onSurface.withOpacity(0.2)),
),
child: const Icon(
Icons.high_quality_rounded,
color: AppColors.onSurface,
size: 22,
),
),
),
);
}
}