6 Commits
Author SHA1 Message Date
MichaelandClaude Fable 5 186f9f89f9 chore: bump version to 1.7.1+15
The channel sidebar is an incremental change on top of v1.7.0, so ship it
as a patch release instead of 1.8.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8c4kaH8AXVT5UUie3zR4p
2026-09-01 08:09:13 +02:00
MichaelandClaude Fable 5 3c37c6a6e6 feat(player): channel list sidebar accessible from the live OSD
Add a visible playlist button in both players (native + lite) that opens
the TiviMate-style channel sidebar (channels of the current category).
The sidebar existed in the native player but was only reachable via an
edge swipe or the M/Menu key; the lite player had none.

- New OSD button next to channel zapping (live only)
- Lite player: full sidebar port (swipe from right edge, M/Menu key)
- D-pad support: focus lands on the current channel when the list opens,
  arrows navigate, OK switches channel, Back/Menu closes
- Auto-hide timer (6s) restarted on D-pad focus and touch scroll
- Bump version to 1.8.0+15

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EG1frWE7suYF7hp4q2sDiR
2026-09-01 08:05:34 +02:00
MichaelandClaude Fable 5 c096532fec fix(android): sign release APK with a stable keystore in CI
Release builds were signed with the debug keystore. On the GitHub runner
that keystore is generated fresh on every build, so each CI APK carried a
different signature and Android refused to install it over an existing
version ("App not installed").

- build.gradle.kts: read android/key.properties when present and use it
  as the release signing config; fall back to debug otherwise so local
  `flutter run --release` keeps working.
- build-apk.yml: decode the keystore from ANDROID_KEYSTORE_* secrets into
  android/key.properties before building, and fail early if any secret
  is missing instead of silently signing with a throwaway key.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3E5JovvDaQQ19D4UR258o
2026-08-30 16:21:51 +02:00
LogiFlow 05ca6f85be Merge pull request #1 from R0m1k3/claude/video-app-theme-latency-remote-xczp28
Thème gris Apple Glass, latence live réduite, correctif audio, mémoire de focus télécommande
2026-08-30 08:28:25 +02:00
Claude 04e9ab5730 ci: build release APK and publish a GitHub Release on main
Adds a Build APK workflow: on every push to main it builds the release
APK with Flutter 3.35.3 and publishes it as a GitHub Release tagged
with the pubspec version (v1.7.0 → xtremobile-v1.7.0.apk). On pull
requests and manual runs the APK is built and uploaded as an artifact
only. Bumps app version to 1.7.0+14 for this release.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0156exq7fejVrD3HKU3MmS8X
2026-08-28 07:43:21 +00:00
Claude 9b6b7faf4a feat: Apple glass gray theme, lower live latency, audio fix, remote focus memory
Theme — replace the near-black "Warm Cinema" palette with a neutral
"Apple Glass Gray" system: graphite surfaces (#26262C base, lighter
containers), Apple-white text, Apple system blue accent, white glass
borders/highlights. Noticeably less dark overall; light theme moves
from kraft paper to iOS light gray. All AppColors names kept so no
call site changes.

Player latency — live buffering drops from 8s cache / 10s readahead /
150MB to 3s / 5s / 60MB, keeping enough headroom for network jitter
while staying much closer to the live edge.

Audio — the forced audio filter chain
(af=lavrresample,format=channels=stereo:sample_fmts=s16) mixed FFmpeg
and mpv syntax; when it failed to init for a channel's codec, mpv
muted the stream entirely. Replaced by mpv's native
audio-channels=stereo downmix and AO-negotiated output format. Probe
caps raised (2MB/3s) so late-declared audio tracks (AAC-LATM) are
detected without slowing healthy streams.

Remote control — the player OSD now remembers the last focused button
and restores focus to it whenever the OSD reopens (arrows, OK) and
across channel switches, so one press re-zaps instead of five. On
live TV, OK with hidden controls only reopens the OSD instead of
pausing the stream.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0156exq7fejVrD3HKU3MmS8X
2026-08-28 07:41:18 +00:00
8 changed files with 719 additions and 187 deletions

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
# Construit l'APK release et publie une GitHub Release à chaque mise à jour
# de main (nouvelle version de l'app). Sur une pull request ou un lancement
# manuel (workflow_dispatch), l'APK est seulement construit et déposé en
# artifact — aucune release n'est publiée.
name: Build APK
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.35.3
cache: true
- name: Read app version from pubspec.yaml
id: version
run: echo "version=$(grep '^version:' pubspec.yaml | awk '{print $2}' | cut -d+ -f1)" >> "$GITHUB_OUTPUT"
- run: flutter pub get
# Keystore fixe injecté via secrets : sans lui, Gradle signerait avec une
# clé debug générée sur le runner (différente à chaque build) et l'APK ne
# s'installerait pas par-dessus une version déjà présente sur l'appareil.
- name: Set up release signing
env:
KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
for v in KEYSTORE_BASE64 KEYSTORE_PASSWORD KEY_ALIAS KEY_PASSWORD; do
if [ -z "${!v}" ]; then
echo "::error::Secret ANDROID_$v manquant — impossible de signer l'APK avec une clé stable."
exit 1
fi
done
echo "$KEYSTORE_BASE64" | base64 -d > android/app/release.jks
{
echo "storeFile=release.jks"
echo "storePassword=$KEYSTORE_PASSWORD"
echo "keyAlias=$KEY_ALIAS"
echo "keyPassword=$KEY_PASSWORD"
} > android/key.properties
- name: Build release APK
run: flutter build apk --release
- name: Rename APK with version
run: cp build/app/outputs/flutter-apk/app-release.apk "xtremobile-v${{ steps.version.outputs.version }}.apk"
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: xtremobile-v${{ steps.version.outputs.version }}-apk
path: xtremobile-v${{ steps.version.outputs.version }}.apk
# La release n'est créée que sur main : un même numéro de version met à
# jour la release existante au lieu d'en créer une seconde.
- name: Publish GitHub Release
if: github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: XtremMobile v${{ steps.version.outputs.version }}
files: xtremobile-v${{ steps.version.outputs.version }}.apk
generate_release_notes: true
+30 -3
View File
@@ -1,3 +1,5 @@
import java.util.Properties
plugins {
id("com.android.application")
id("kotlin-android")
@@ -5,6 +7,18 @@ plugins {
id("dev.flutter.flutter-gradle-plugin")
}
// Signature release stable : android/key.properties (ignoré par git) pointe vers
// un keystore fixe. Sans ce fichier, on retombe sur la clé debug locale pour que
// `flutter run --release` continue de marcher. La CI DOIT fournir key.properties,
// sinon chaque build serait signé avec une clé debug aléatoire et l'APK ne
// s'installerait pas par-dessus une version existante.
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
val hasReleaseKeystore = keystorePropertiesFile.exists()
if (hasReleaseKeystore) {
keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) }
}
android {
namespace = "com.example.xtremflow"
compileSdk = flutter.compileSdkVersion
@@ -30,11 +44,24 @@ android {
versionName = flutter.versionName
}
signingConfigs {
if (hasReleaseKeystore) {
create("release") {
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
}
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
signingConfig = if (hasReleaseKeystore) {
signingConfigs.getByName("release")
} else {
signingConfigs.getByName("debug")
}
}
}
}
+123 -125
View File
@@ -1,124 +1,121 @@
import 'package:flutter/material.dart';
/// XtremFlow — "Warm Cinema" Design System (ported from the web app)
/// XtremFlow — "Apple Glass Gray" Design System
///
/// Palette: charbon chaud + crème + orange brûlé (ember).
/// Inspiration: salle de projection, pellicule, affiches 70s.
/// Palette : graphite neutre + blanc cassé + bleu système Apple.
/// Inspiration : verre dépoli iOS/visionOS — des gris francs, jamais un noir
/// pur, pour une interface nettement moins sombre que l'ancien thème.
///
/// Règle de perf : AUCUNE couleur de surface n'est translucide. La profondeur
/// vient des ombres et du contraste, pas du flou — pas de `BackdropFilter`,
/// coûteux à chaque frame sur les Android d'entrée de gamme.
///
/// Les noms hérités de l'ancienne charte Apple TV (`appleBlue`,
/// `glossyCardGradient`, `appleTvGradient`, …) sont conservés en alias pour ne
/// pas casser les sites d'appel existants ; ils pointent désormais vers les
/// teintes chaudes.
/// coûteux à chaque frame sur les Android d'entrée de gamme. L'effet "glass"
/// est simulé par des gris élevés + liserés blancs à faible opacité.
class AppColors {
AppColors._();
// ============ BASE LEVEL 0 ============
/// Noir chaud — le "noir de salle", jamais un noir pur bleuté.
static const Color baseLevel0 = Color(0xFF0B0908);
/// Graphite profond — le niveau le plus bas, jamais un noir pur.
static const Color baseLevel0 = Color(0xFF1B1B1F);
// ============ BACKGROUNDS ============
static const Color background = Color(0xFF100C0A);
static const Color onBackground = Color(0xFFF3E9DF);
static const Color background = Color(0xFF26262C);
static const Color onBackground = Color(0xFFF5F5F7);
static const Color surface = Color(0xFF100C0A);
static const Color surfaceDim = Color(0xFF0B0908);
static const Color surfaceBright = Color(0xFF3C322C);
static const Color surface = Color(0xFF26262C);
static const Color surfaceDim = Color(0xFF1F1F24);
static const Color surfaceBright = Color(0xFF54545E);
// Surface Containers (hiérarchie Material 3, toutes opaques)
static const Color surfaceContainerLowest = Color(0xFF070505);
static const Color surfaceContainerLow = Color(0xFF181310);
static const Color surfaceContainer = Color(0xFF1F1815);
static const Color surfaceContainerHigh = Color(0xFF2A211C);
static const Color surfaceContainerHighest = Color(0xFF352A24);
static const Color surfaceVariant = Color(0xFF1F1815);
static const Color surfaceContainerLowest = Color(0xFF1B1B1F);
static const Color surfaceContainerLow = Color(0xFF2C2C33);
static const Color surfaceContainer = Color(0xFF32323A);
static const Color surfaceContainerHigh = Color(0xFF3B3B44);
static const Color surfaceContainerHighest = Color(0xFF45454F);
static const Color surfaceVariant = Color(0xFF32323A);
// ============ SURFACE / ON SURFACE ============
static const Color onSurface = Color(0xFFF3E9DF); // crème
static const Color onSurfaceVariant = Color(0xFFC5B3A5); // crème atténué
static const Color onSurface = Color(0xFFF5F5F7); // blanc Apple
static const Color onSurfaceVariant = Color(0xFFC7C7CE); // gris clair
// ============ PRIMARY (Ember / orange brûlé) ============
static const Color primary = Color(0xFFFFB68C); // texte & icônes sur sombre
static const Color onPrimary = Color(0xFF521B00);
static const Color primaryContainer = Color(0xFFD9541F); // remplissage ember
static const Color onPrimaryContainer = Color(0xFF2B0A00);
static const Color inversePrimary = Color(0xFFA63B10);
// ============ PRIMARY (Bleu système Apple) ============
static const Color primary = Color(0xFF8AB9FF); // texte & icônes sur sombre
static const Color onPrimary = Color(0xFF00295C);
static const Color primaryContainer = Color(0xFF0A84FF); // remplissage bleu
static const Color onPrimaryContainer = Color(0xFFEAF2FF);
static const Color inversePrimary = Color(0xFF0066CC);
/// Braise profonde — réservée aux **remplissages portant du texte**.
/// `primaryContainer` (#D9541F) est trop lumineux : du blanc dessus plafonne
/// vers 3,9:1, sous le seuil AA de 4,5:1. Cette variante passe le seuil tout
/// en restant la même couleur perçue.
static const Color primaryFill = Color(0xFFA8360C);
/// Bleu profond — réservé aux **remplissages portant du texte**.
/// `primaryContainer` (#0A84FF) est trop lumineux : du blanc dessus plafonne
/// sous le seuil AA de 4,5:1. Cette variante passe le seuil tout en restant
/// la même couleur perçue.
static const Color primaryFill = Color(0xFF0A6FDC);
/// Encre chaude — remplace le noir pur pour du texte/des icônes posés sur un
/// remplissage clair (crème, ember clair). Un noir pur sur une teinte chaude
/// paraît sale ; ce brun très sombre garde le contraste sans le décalage.
static const Color onPrimaryFixed = Color(0xFF360F00);
static const Color primaryFixed = Color(0xFFFFDBC8);
static const Color primaryFixedDim = Color(0xFFFFB68C);
static const Color onPrimaryFixedVariant = Color(0xFF7A2C08);
/// Encre froide — remplace le noir pur pour du texte/des icônes posés sur un
/// remplissage clair (blanc cassé, bleu clair). Garde le contraste sans le
/// décalage d'un noir pur.
static const Color onPrimaryFixed = Color(0xFF002451);
static const Color primaryFixed = Color(0xFFD6E5FF);
static const Color primaryFixedDim = Color(0xFF8AB9FF);
static const Color onPrimaryFixedVariant = Color(0xFF0A5BB5);
// ============ SECONDARY (Terre cuite / argile) ============
static const Color secondary = Color(0xFFE7C3AC);
static const Color onSecondary = Color(0xFF442A1B);
static const Color secondaryContainer = Color(0xFF5D4030);
static const Color onSecondaryContainer = Color(0xFFFFDCC8);
// ============ SECONDARY (Argent / gris clair) ============
static const Color secondary = Color(0xFFD1D1D6);
static const Color onSecondary = Color(0xFF303036);
static const Color secondaryContainer = Color(0xFF44444D);
static const Color onSecondaryContainer = Color(0xFFE8E8ED);
// ============ TERTIARY (Laiton / doré patiné) ============
static const Color tertiary = Color(0xFFD9C88C);
static const Color onTertiary = Color(0xFF3A3016);
static const Color tertiaryContainer = Color(0xFF52472A);
static const Color onTertiaryContainer = Color(0xFFF6E4A6);
// ============ TERTIARY (Cyan glacé) ============
static const Color tertiary = Color(0xFF7DD3F2);
static const Color onTertiary = Color(0xFF003544);
static const Color tertiaryContainer = Color(0xFF1C4D60);
static const Color onTertiaryContainer = Color(0xFFC8ECFA);
// ============ ERROR ============
static const Color error = Color(0xFFFFB4A6);
static const Color onError = Color(0xFF5F1409);
static const Color errorContainer = Color(0xFF8C2416);
static const Color onErrorContainer = Color(0xFFFFDAD4);
static const Color error = Color(0xFFFFB4AB);
static const Color onError = Color(0xFF690005);
static const Color errorContainer = Color(0xFF93000A);
static const Color onErrorContainer = Color(0xFFFFDAD6);
// ============ OUTLINE ============
static const Color outline = Color(0xFF9C8878);
static const Color outlineVariant = Color(0xFF4A3C33);
static const Color outline = Color(0xFF8E8E93);
static const Color outlineVariant = Color(0xFF48484E);
// ============ INVERSE SURFACE ============
static const Color inverseSurface = Color(0xFFF3E9DF);
static const Color inverseOnSurface = Color(0xFF2A211C);
static const Color surfaceTint = Color(0xFFFFB68C);
static const Color inverseSurface = Color(0xFFF2F2F7);
static const Color inverseOnSurface = Color(0xFF2C2C31);
static const Color surfaceTint = Color(0xFF8AB9FF);
// ============ TEXT / CONTENT ============
static const Color textPrimary = Color(0xFFF3E9DF);
static const Color textSecondary = Color(0xFFC5B3A5);
static const Color textTertiary = Color(0xFF9C8878);
static const Color textPrimary = Color(0xFFF5F5F7);
static const Color textSecondary = Color(0xFFC7C7CE);
static const Color textTertiary = Color(0xFF98989F);
// ============ CRÈME À OPACITÉ ============
// Un blanc pur sur fond chaud tire vers le bleu : on décline la crème.
static const Color onSurface06 = Color(0x0FF3E9DF);
static const Color onSurface12 = Color(0x1FF3E9DF);
static const Color onSurface24 = Color(0x3DF3E9DF);
static const Color onSurface38 = Color(0x61F3E9DF);
static const Color onSurface54 = Color(0x8AF3E9DF);
static const Color onSurface70 = Color(0xB3F3E9DF);
// ============ BLANC À OPACITÉ ============
// Blanc Apple (#F5F5F7) décliné en opacités pour rester cohérent partout.
static const Color onSurface06 = Color(0x0FF5F5F7);
static const Color onSurface12 = Color(0x1FF5F5F7);
static const Color onSurface24 = Color(0x3DF5F5F7);
static const Color onSurface38 = Color(0x61F5F5F7);
static const Color onSurface54 = Color(0x8AF5F5F7);
static const Color onSurface70 = Color(0xB3F5F5F7);
// ============ STATUS ============
static const Color success = Color(0xFF9BC46A); // olive lumineux
static const Color warning = Color(0xFFE9B23C); // ambre
static const Color info = Color(0xFFA3B8C4); // bleu-gris fumé
static const Color success = Color(0xFF32D74B); // vert système
static const Color warning = Color(0xFFFFD60A); // jaune système
static const Color info = Color(0xFF64D2FF); // cyan système
// ============ CATÉGORIES ============
static const Color live = Color(0xFFE5484D); // rouge enseigne
static const Color movies = Color(0xFFD9541F); // ember
static const Color series = Color(0xFFD9C88C); // laiton
static const Color live = Color(0xFFFF453A); // rouge système
static const Color movies = Color(0xFF0A84FF); // bleu système
static const Color series = Color(0xFFBF5AF2); // violet système
// ============ RATING / PREMIUM ============
static const Color ratingGold = Color(0xFFE9B23C);
static const Color premiumGold = Color(0xFFC9922A);
static const Color ratingGold = Color(0xFFFFD60A);
static const Color premiumGold = Color(0xFFE0B84C);
// ============ SHIMMER (placeholders de chargement) ============
static const Color shimmer = Color(0xFF2A211C);
static const Color shimmerHighlight = Color(0xFF3C302A);
static const Color shimmer = Color(0xFF32323A);
static const Color shimmerHighlight = Color(0xFF45454F);
// ============ BORDERS / FOCUS ============
static const Color border = outlineVariant;
@@ -126,61 +123,62 @@ class AppColors {
static const Color focusBorder = primaryContainer;
static const Color borderFocused = primaryContainer;
/// Liseré crème 8 % — définit l'arête d'une surface sans la faire flotter.
static const Color glassBorderColor = Color(0x14F3E9DF);
/// Liseré blanc 10 % — définit l'arête d'une surface "verre" sans la faire
/// flotter.
static const Color glassBorderColor = Color(0x1AFFFFFF);
// ============ SURFACES "GLASS" — OPAQUES ============
static const Color glassLevel1Bg = Color(0xFF181310);
static const Color glassLevel1Border = Color(0x14F3E9DF); // crème 8 %
static const Color glassLevel2Bg = Color(0xFF1F1815);
static const Color glassLevel2Border = Color(0x1FF3E9DF); // crème 12 %
static const Color glassLevel2InnerGlow = Color(0x3DD9541F); // ember 24 %
static const Color glassLevel1Bg = Color(0xFF2C2C33);
static const Color glassLevel1Border = Color(0x1AFFFFFF); // blanc 10 %
static const Color glassLevel2Bg = Color(0xFF32323A);
static const Color glassLevel2Border = Color(0x26FFFFFF); // blanc 15 %
static const Color glassLevel2InnerGlow = Color(0x3D0A84FF); // bleu 24 %
static const Color glassBackground = glassLevel2Bg;
static const Color glassBorder = glassLevel2Border;
// ============ GRADIENTS ============
/// Braise : orange brûlé vers rouge profond.
/// Bleu système : clair vers profond.
static const LinearGradient primaryGradient = LinearGradient(
colors: [Color(0xFFE9701F), Color(0xFFC13A1C)],
colors: [Color(0xFF4DA2FF), Color(0xFF0A6FDC)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
);
/// Fond de salle : projecteur chaud en haut, obscurité en bas.
/// Fond "verre dépoli" : gris clair en haut, graphite en bas.
static const LinearGradient backgroundGradient = LinearGradient(
colors: [Color(0xFF1A1310), Color(0xFF0B0908)],
colors: [Color(0xFF303038), Color(0xFF1F1F24)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
);
/// Halo de projection depuis le centre de l'écran.
/// Halo doux depuis le centre de l'écran.
static const RadialGradient projectorGradient = RadialGradient(
center: Alignment.center,
radius: 1.5,
colors: [Color(0xFF1A1310), Color(0xFF0B0908)],
colors: [Color(0xFF303038), Color(0xFF1F1F24)],
stops: [0.0, 1.0],
);
/// Carte : arête éclairée en haut, matière sombre en bas.
/// Carte : arête éclairée en haut, matière grise en bas.
static const LinearGradient cardGradient = LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF352A24), Color(0xFF181310)],
colors: [Color(0xFF45454F), Color(0xFF2C2C33)],
stops: [0.0, 1.0],
);
/// Reflet chaud posé sur le haut d'une carte.
/// Reflet posé sur le haut d'une carte — l'effet "verre".
static const LinearGradient cardHighlight = LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0x1FF3E9DF), Color(0x00F3E9DF)],
colors: [Color(0x29FFFFFF), Color(0x00FFFFFF)],
stops: [0.0, 0.5],
);
/// Voile d'affiche : lecture du texte par-dessus une jaquette.
static const LinearGradient posterScrim = LinearGradient(
colors: [Color(0x000B0908), Color(0xCC0B0908), Color(0xFF0B0908)],
colors: [Color(0x001F1F24), Color(0xCC1F1F24), Color(0xFF1F1F24)],
stops: [0.0, 0.55, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
@@ -188,7 +186,7 @@ class AppColors {
/// Voile latéral pour les héros pleine largeur.
static const LinearGradient heroScrim = LinearGradient(
colors: [Color(0xF20B0908), Color(0x990B0908), Color(0x000B0908)],
colors: [Color(0xF21F1F24), Color(0x991F1F24), Color(0x001F1F24)],
stops: [0.0, 0.45, 1.0],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
@@ -196,43 +194,43 @@ class AppColors {
// ============ GLOW / OMBRES ============
static Color glowPrimary(double opacity) =>
const Color(0xFFD9541F).withValues(alpha: opacity);
const Color(0xFF0A84FF).withValues(alpha: opacity);
static Color glowPrimaryDim(double opacity) =>
const Color(0xFFFFB68C).withValues(alpha: opacity);
const Color(0xFF8AB9FF).withValues(alpha: opacity);
/// Ombre portée « projecteur » : profonde, chaude, jamais grise.
/// Ombre portée douce — moins dense qu'avant : le fond est plus clair.
static List<BoxShadow> lift({double intensity = 1.0}) => [
BoxShadow(
color: const Color(0xFF000000).withValues(alpha: 0.55 * intensity),
color: const Color(0xFF000000).withValues(alpha: 0.40 * intensity),
blurRadius: 28 * intensity,
spreadRadius: -8,
offset: Offset(0, 12 * intensity),
),
];
/// Halo ember pour l'élément focalisé (navigation TV / télécommande).
/// Halo bleu pour l'élément focalisé (navigation TV / télécommande).
/// Le nom historique `emberFocus` est conservé pour les sites d'appel.
static List<BoxShadow> emberFocus({double intensity = 1.0}) => [
BoxShadow(
color: const Color(0xFFD9541F).withValues(alpha: 0.45 * intensity),
color: const Color(0xFF0A84FF).withValues(alpha: 0.45 * intensity),
blurRadius: 32 * intensity,
spreadRadius: -4,
),
BoxShadow(
color: const Color(0xFF000000).withValues(alpha: 0.6),
color: const Color(0xFF000000).withValues(alpha: 0.45),
blurRadius: 24,
spreadRadius: -10,
offset: const Offset(0, 14),
),
];
// ============ ALIAS DE COMPATIBILITÉ (ancienne charte Apple TV) ============
// Conservés pour ne pas casser les sites d'appel ; remappés sur les teintes
// chaudes. À retirer au fil des réécritures d'écrans.
// ============ ALIAS DE COMPATIBILITÉ ============
// Conservés pour ne pas casser les sites d'appel.
static const Color backgroundSecondary = surfaceContainerLow;
static const Color surfaceElevated = surfaceContainerHigh;
static const Color accent = secondary;
/// Ancien accent bleu Apple → braise portant du texte blanc (contraste AA).
/// Accent bleu Apple portant du texte blanc (contraste AA).
static const Color appleBlue = primaryFill;
static const RadialGradient appleTvGradient = projectorGradient;
@@ -275,27 +273,27 @@ class AppColors {
brightness: Brightness.dark,
);
/// Thème clair : « papier kraft » — même famille chaude, inversée.
/// Thème clair : gris système iOS, même famille neutre.
static ColorScheme get lightColorScheme => const ColorScheme.light(
primary: Color(0xFFA63B10),
primary: Color(0xFF0066CC),
onPrimary: Colors.white,
primaryContainer: Color(0xFFFFDBC8),
onPrimaryContainer: Color(0xFF360F00),
secondary: Color(0xFF765847),
primaryContainer: Color(0xFFD6E5FF),
onPrimaryContainer: Color(0xFF002451),
secondary: Color(0xFF54545E),
onSecondary: Colors.white,
secondaryContainer: Color(0xFFFFDCC8),
onSecondaryContainer: Color(0xFF2B160A),
tertiary: Color(0xFF6A5F3F),
secondaryContainer: Color(0xFFE3E3E8),
onSecondaryContainer: Color(0xFF1B1B1F),
tertiary: Color(0xFF00658E),
onTertiary: Colors.white,
error: Color(0xFFB3261E),
onError: Colors.white,
errorContainer: Color(0xFFFFDAD4),
onErrorContainer: Color(0xFF410E05),
surface: Color(0xFFFBF3EC),
onSurface: Color(0xFF201A16),
onSurfaceVariant: Color(0xFF52443B),
outline: Color(0xFF847369),
outlineVariant: Color(0xFFD6C3B7),
surface: Color(0xFFF2F2F7),
onSurface: Color(0xFF1C1C1E),
onSurfaceVariant: Color(0xFF48484E),
outline: Color(0xFF8E8E93),
outlineVariant: Color(0xFFD1D1D6),
brightness: Brightness.light,
);
}
+11 -12
View File
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'app_colors.dart';
/// XtremFlow — "Warm Cinema" theme (ported from the web app).
/// XtremFlow — "Apple Glass Gray" theme.
///
/// Typography: **Fraunces** (serif éditorial) for display/headline, **Karla**
/// (humaniste chaud) for UI and body — very legible at TV distance and on a
@@ -217,10 +217,9 @@ class AppTheme {
secondary: AppColors.textSecondary,
),
// Curseur crème — un curseur blanc pur jure sur fond chaud.
textSelectionTheme: const TextSelectionThemeData(
cursorColor: AppColors.primary,
selectionColor: Color(0x59D9541F),
selectionColor: Color(0x590A84FF),
selectionHandleColor: AppColors.primaryContainer,
),
@@ -334,7 +333,7 @@ class AppTheme {
activeTrackColor: AppColors.primaryContainer,
inactiveTrackColor: AppColors.onSurface24,
thumbColor: AppColors.primary,
overlayColor: Color(0x29D9541F),
overlayColor: Color(0x290A84FF),
),
progressIndicatorTheme: const ProgressIndicatorThemeData(
@@ -362,17 +361,17 @@ class AppTheme {
);
}
// ============ LIGHT THEME (« papier kraft ») ============
// ============ LIGHT THEME (gris système clair) ============
static ThemeData get lightTheme {
final baseTheme = ThemeData.light(useMaterial3: true);
const bgColor = Color(0xFFFBF3EC);
const bgColor = Color(0xFFF2F2F7);
const surfaceColor = Color(0xFFFFFFFF);
const primaryColor = Color(0xFFA63B10);
const textPrimaryColor = Color(0xFF201A16);
const textSecondaryColor = Color(0xFF52443B);
const textTertiaryColor = Color(0xFF847369);
const borderColor = Color(0xFFD6C3B7);
const primaryColor = Color(0xFF0066CC);
const textPrimaryColor = Color(0xFF1C1C1E);
const textSecondaryColor = Color(0xFF48484E);
const textTertiaryColor = Color(0xFF8E8E93);
const borderColor = Color(0xFFD8D8DE);
return baseTheme.copyWith(
colorScheme: AppColors.lightColorScheme,
@@ -386,7 +385,7 @@ class AppTheme {
textSelectionTheme: const TextSelectionThemeData(
cursorColor: primaryColor,
selectionColor: Color(0x4DA63B10),
selectionColor: Color(0x4D0066CC),
selectionHandleColor: primaryColor,
),
@@ -80,6 +80,16 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
final FocusNode _playPauseFocusNode = FocusNode();
final FocusNode _prevFocusNode = FocusNode();
final FocusNode _nextFocusNode = FocusNode();
final FocusNode _channelListButtonFocusNode = FocusNode();
/// Focus D-pad de la chaîne active dans la sidebar : permet d'atterrir
/// directement dessus à l'ouverture de la liste.
final FocusNode _channelListItemFocusNode = FocusNode();
// [TiviMate] Channel List Sidebar
bool _showChannelList = false;
Timer? _channelListTimer;
final ScrollController _channelListScrollController = ScrollController();
@override
void initState() {
@@ -132,6 +142,8 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
_controlsTimer = null;
_stabilizationTimer?.cancel();
_stabilizationTimer = null;
_channelListTimer?.cancel();
_channelListTimer = null;
final controller = _controller;
_controller = null;
@@ -339,15 +351,95 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
void _switchChannel(int index) {
if (widget.channels == null) return;
setState(() => _currentIndex = index);
setState(() {
_currentIndex = index;
_showChannelList = false; // close sidebar on switch
});
_channelListTimer?.cancel();
_onUserInteraction(); // Ensure OSD shows up and timer resets on channel change
_loadStream();
}
/// Open/close the channel list sidebar
void _toggleChannelList() {
setState(() => _showChannelList = !_showChannelList);
if (_showChannelList) {
_scrollToCurrentChannel();
_restartChannelListTimer();
// Focus direct sur la chaîne en cours : la télécommande navigue dans la
// liste sans étape intermédiaire. Second essai après l'animation de
// scroll (300 ms), l'item actif pouvant ne pas encore être construit.
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && _showChannelList) {
_channelListItemFocusNode.requestFocus();
}
});
Future.delayed(const Duration(milliseconds: 400), () {
if (mounted &&
_showChannelList &&
!_channelListItemFocusNode.hasFocus) {
_channelListItemFocusNode.requestFocus();
}
});
} else {
_channelListTimer?.cancel();
}
}
/// (Re)arme l'auto-fermeture de la sidebar. Relancé à chaque interaction
/// (focus D-pad, scroll) pour ne pas fermer la liste sous les doigts.
void _restartChannelListTimer() {
_channelListTimer?.cancel();
_channelListTimer = Timer(const Duration(seconds: 6), () {
if (mounted) setState(() => _showChannelList = false);
});
}
/// Scroll channel list to keep current channel visible
void _scrollToCurrentChannel() {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!_channelListScrollController.hasClients) return;
const itemHeight = 64.0;
final offset = (_currentIndex * itemHeight) -
(_channelListScrollController.position.viewportDimension / 2) +
(itemHeight / 2);
_channelListScrollController.animateTo(
offset.clamp(0, _channelListScrollController.position.maxScrollExtent),
duration: const Duration(milliseconds: 300),
curve: Curves.easeOut,
);
});
}
bool _handleKeyEvent(KeyEvent event) {
if (event is! KeyDownEvent) return false;
final key = event.logicalKey;
// Sidebar ouverte : Back/Menu la ferment, le reste part au système de
// Focus (navigation + OK sur un item). On relance juste l'auto-fermeture.
if (_showChannelList) {
if (key == LogicalKeyboardKey.escape ||
key == LogicalKeyboardKey.goBack ||
key == LogicalKeyboardKey.contextMenu ||
key == LogicalKeyboardKey.keyM) {
_channelListTimer?.cancel();
setState(() => _showChannelList = false);
return true;
}
_restartChannelListTimer();
return false;
}
// Menu key or 'M' → toggle channel list sidebar
if (key == LogicalKeyboardKey.contextMenu ||
key == LogicalKeyboardKey.keyM) {
if (widget.streamType == model.StreamType.live &&
widget.channels != null) {
_toggleChannelList();
return true;
}
}
if (key == LogicalKeyboardKey.channelUp) {
if (widget.channels != null) {
_switchChannel((_currentIndex + 1) % widget.channels!.length);
@@ -397,6 +489,8 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
_epgTimer?.cancel();
_controlsTimer?.cancel();
_stabilizationTimer?.cancel();
_channelListTimer?.cancel();
_channelListScrollController.dispose();
_controller?.pause(); // Force stop audio immediately
_controller?.dispose();
_xtreamService?.dispose();
@@ -404,6 +498,8 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
_playPauseFocusNode.dispose();
_prevFocusNode.dispose();
_nextFocusNode.dispose();
_channelListButtonFocusNode.dispose();
_channelListItemFocusNode.dispose();
super.dispose();
}
@@ -419,7 +515,23 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
// True black behind the video surface, never the warm ink.
backgroundColor: Colors.black,
body: GestureDetector(
onTap: _onUserInteraction,
onTap: () {
if (_showChannelList) {
_channelListTimer?.cancel();
setState(() => _showChannelList = false);
} else {
_onUserInteraction();
}
},
// Swipe from right edge → open channel list
onHorizontalDragEnd: (details) {
if (widget.streamType == model.StreamType.live &&
widget.channels != null &&
details.primaryVelocity != null &&
details.primaryVelocity! < -300) {
_toggleChannelList();
}
},
child: Stack(
children: [
// Video Surface
@@ -509,6 +621,13 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
// OSD (EPG + Controls)
if (_showControls) _buildOSD(title),
// [TiviMate] Channel list sidebar
if (_showChannelList &&
widget.streamType == model.StreamType.live &&
widget.channels != null &&
widget.channels!.isNotEmpty)
_buildChannelListSidebar(),
],
),
),
@@ -611,6 +730,20 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
),
),
const SizedBox(width: 16),
// Channel list sidebar (liste des chaînes de la catégorie)
if (widget.streamType == model.StreamType.live &&
widget.channels != null &&
widget.channels!.isNotEmpty)
TVFocusable(
focusNode: _channelListButtonFocusNode,
onPressed: _toggleChannelList,
child: const Icon(
Icons.playlist_play_rounded,
color: AppColors.onSurface,
size: 36,
),
),
const SizedBox(width: 16),
// Deinterlace Button (Switches to Native Player with forced Deinterlace)
TVFocusable(
@@ -774,4 +907,178 @@ class _LitePlayerScreenState extends ConsumerState<LitePlayerScreen>
),
);
}
/// [TiviMate] Channel list sidebar — slide-in panel on the right
Widget _buildChannelListSidebar() {
final channels = widget.channels!;
return Positioned(
top: 0,
bottom: 0,
right: 0,
child: Container(
width: 280,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerRight,
end: Alignment.centerLeft,
colors: [Color(0xE6000000), Color(0x99000000)],
),
),
child: SafeArea(
child: Column(
children: [
// Header
Container(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(color: AppColors.onSurface12),
),
),
child: Row(
children: [
const Icon(Icons.list,
color: AppColors.onSurface70, size: 18),
const SizedBox(width: 8),
const Expanded(
child: Text(
'Chaînes',
style: TextStyle(
color: AppColors.onSurface,
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
),
GestureDetector(
onTap: () {
_channelListTimer?.cancel();
setState(() => _showChannelList = false);
},
child: const Icon(Icons.close,
color: AppColors.onSurface54, size: 18),
),
],
),
),
// Channel list
Expanded(
child: NotificationListener<ScrollNotification>(
onNotification: (_) {
_restartChannelListTimer();
return false;
},
child: ListView.builder(
controller: _channelListScrollController,
itemCount: channels.length,
itemExtent: 64.0,
itemBuilder: (context, index) {
final ch = channels[index];
final isActive = index == _currentIndex;
return TVFocusable(
// Le focusNode externe n'est posé que sur la chaîne
// active ; la clé force un remontage quand isActive
// change (TVFocusable ne gère pas didUpdateWidget).
key: ValueKey('sidebar-ch-$index-$isActive'),
focusNode: isActive ? _channelListItemFocusNode : null,
scale: 1.0,
borderRadius: BorderRadius.zero,
onFocus: _restartChannelListTimer,
onPressed: () {
_channelListTimer?.cancel();
_switchChannel(index);
},
child: Container(
decoration: BoxDecoration(
color: isActive
? AppColors.primaryFill.withValues(alpha: 0.6)
: Colors.transparent,
border: isActive
? const Border(
left: BorderSide(
color: AppColors.primary,
width: 3,
),
)
: null,
),
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
child: Row(
children: [
// Logo
Container(
width: 40,
height: 40,
margin: const EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: AppColors.onSurface12,
borderRadius: BorderRadius.circular(6),
),
child: ch.streamIcon.isNotEmpty
? ClipRRect(
borderRadius: BorderRadius.circular(6),
child: CachedNetworkImage(
imageUrl: ch.streamIcon,
fit: BoxFit.contain,
errorWidget: (_, __, ___) =>
const Icon(Icons.tv,
color: AppColors.onSurface38,
size: 20),
),
)
: const Icon(Icons.tv,
color: AppColors.onSurface38, size: 20),
),
// Name + num
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
ch.name,
style: TextStyle(
color: isActive
? AppColors.onSurface
: AppColors.onSurface70,
fontSize: 13,
fontWeight: isActive
? FontWeight.bold
: FontWeight.normal,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
'CH ${index + 1}',
style: const TextStyle(
color: AppColors.onSurface38,
fontSize: 11,
),
),
],
),
),
// Active indicator
if (isActive)
const Icon(
Icons.play_arrow,
color: AppColors.primary,
size: 18,
),
],
),
),
);
},
),
),
),
],
),
),
),
);
}
}
@@ -73,6 +73,11 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
final FocusNode _sliderFocusNode = FocusNode();
final FocusNode _backFocusNode = FocusNode();
final FocusNode _audioFocusNode = FocusNode();
final FocusNode _channelListButtonFocusNode = FocusNode();
/// Focus D-pad de la chaîne active dans la sidebar : permet d'atterrir
/// directement dessus à l'ouverture de la liste.
final FocusNode _channelListItemFocusNode = FocusNode();
bool _isLoading = true;
bool _isFirstLoad = true; // true = black overlay; false = silent spinner
@@ -135,6 +140,35 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
_resetControlsTimer();
}
/// Dernier contrôle de l'OSD qui avait le focus télécommande.
///
/// Quand l'OSD se masque (auto-hide 5s), ses FocusNodes sont démontés et le
/// focus part « on ne sait où » : à la réouverture l'utilisateur devait
/// re-naviguer depuis un point aléatoire jusqu'au bouton de zapping. On
/// mémorise donc le dernier bouton utilisé pour le re-focaliser d'office.
FocusNode? _lastFocusedControl;
void _noteFocus(FocusNode node) {
_lastFocusedControl = node;
_resetControlsTimer();
}
/// Réaffiche l'OSD en redonnant le focus au dernier contrôle utilisé
/// (Play/Pause par défaut) — un seul appui suffit alors pour re-zapper.
void _showControlsRestoringFocus() {
setState(() => _showControls = true);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted || !_showControls) return;
final target = _lastFocusedControl ?? _playPauseFocusNode;
if (target.canRequestFocus) {
target.requestFocus();
} else {
_playPauseFocusNode.requestFocus();
}
});
_resetControlsTimer();
}
@override
void initState() {
super.initState();
@@ -189,10 +223,13 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
// Principe TiviMate : jouer à partir de là où on est, JAMAIS chasser le live edge.
// ExoPlayer n'utilise pas les PTS du stream pour se recaler — on fait pareil.
// --- Buffering stable (TiviMate Medium ~ 8-10s) ---
(_player.platform as dynamic)?.setProperty('cache-secs', '8');
(_player.platform as dynamic)?.setProperty('demuxer-max-bytes', '150000000'); // 150MB RAM max
(_player.platform as dynamic)?.setProperty('demuxer-readahead-secs', '10');
// --- Buffering basse latence (TiviMate Low ~ 3-5s) ---
// 8s/10s de readahead ajoutaient autant de retard sur le direct : 3s de
// cache + 5s de readahead suffisent à absorber la gigue réseau tout en
// restant nettement plus près du live edge.
(_player.platform as dynamic)?.setProperty('cache-secs', '3');
(_player.platform as dynamic)?.setProperty('demuxer-max-bytes', '60000000'); // 60MB RAM max
(_player.platform as dynamic)?.setProperty('demuxer-readahead-secs', '5');
(_player.platform as dynamic)?.setProperty('demuxer-thread', 'yes');
// --- Plafond du buffer ARRIÈRE (stabilité longue durée) ---
// mpv garde par défaut 50 Mio de flux déjà lu pour permettre un retour
@@ -234,15 +271,19 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
(_player.platform as dynamic)?.setProperty('video-sync', 'audio');
}
// [V11.0 Perfect Restoration] Recovering settings from working commit a1628a6b
// Forced software re-sampling handles ANY stubborn 5.1/LATM/24-bit audio track.
// [Audio Fix] L'ancienne chaîne `af=lavrresample,format=channels=stereo:
// sample_fmts=s16` mélangeait la syntaxe FFmpeg et mpv : `lavrresample`
// n'existe plus dans les builds récents et `sample_fmts` n'est pas une
// option du filtre `format` de mpv. Quand la chaîne échoue à s'initialiser
// pour un codec donné (AC3/EAC3/LATM selon la chaîne TV), mpv coupe la
// sortie audio ⇒ « certaines chaînes n'ont pas de son ».
// Le downmix natif `audio-channels=stereo` fait la même chose (5.1 → 2.0)
// sans chaîne de filtres fragile, et l'AO négocie lui-même le format.
(_player.platform as dynamic)?.setProperty('ad', 'lavc:*');
(_player.platform as dynamic)?.setProperty('af', 'lavrresample,format=channels=stereo:sample_fmts=s16');
(_player.platform as dynamic)?.setProperty('audio-format', 's16');
(_player.platform as dynamic)?.setProperty('audio-channels', 'stereo');
(_player.platform as dynamic)?.setProperty('ao', 'audiotrack');
(_player.platform as dynamic)?.setProperty('audio-pitch-correction', 'no');
(_player.platform as dynamic)?.setProperty('audio-buffer', '0.2'); // Live: buffer audio court (réduit le désync pendant les cache-pauses)
(_player.platform as dynamic)?.setProperty('audio-samplerate', '48000');
(_player.platform as dynamic)?.setProperty('aid', 'auto');
// --- Seeking & Sync globaux ---
@@ -270,11 +311,14 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
);
// --- Probing du flux (une seule entrée, consolidée) ---
// Précédent : 2 setProperty('demuxer-lavf-o') en conflit
// fflags=+discardcorrupt supprimé : peut causer des skips sur certains streams IPTV
// Ces valeurs sont des PLAFONDS : FFmpeg s'arrête dès que toutes les pistes
// sont identifiées, donc les relever ne ralentit pas les flux sains.
// 1MB/2s ratait la piste audio (AAC-LATM déclaré tard) sur certaines
// chaînes ⇒ pas de son. 2MB/3s les récupère sans pénaliser le zapping.
(_player.platform as dynamic)?.setProperty(
'demuxer-lavf-o',
'analyzeduration=2000000,probesize=1000000',
'analyzeduration=3000000,probesize=2000000',
);
// --- Décodeur lavc : threads libres, sans fast-mode (qualité prioritaire) ---
@@ -566,6 +610,8 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
_sliderFocusNode.dispose();
_backFocusNode.dispose();
_audioFocusNode.dispose();
_channelListButtonFocusNode.dispose();
_channelListItemFocusNode.dispose();
// Restore normal orientation
SystemChrome.setPreferredOrientations([
@@ -997,6 +1043,15 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
_showChannelList = false; // close sidebar on switch
_showControls = true; // show regular OSD
});
// Garde le focus sur le bouton de zap qui vient d'être pressé : l'appui
// suivant sur OK rezappe immédiatement, sans re-navigation dans l'OSD.
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted || !_showControls) return;
final target = _lastFocusedControl;
if (target != null && target.canRequestFocus && !target.hasFocus) {
target.requestFocus();
}
});
_resetControlsTimer();
_loadStream();
}
@@ -1006,15 +1061,36 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
setState(() => _showChannelList = !_showChannelList);
if (_showChannelList) {
_scrollToCurrentChannel();
_channelListTimer?.cancel();
_channelListTimer = Timer(const Duration(seconds: 6), () {
if (mounted) setState(() => _showChannelList = false);
_restartChannelListTimer();
// Focus direct sur la chaîne en cours : la télécommande navigue dans la
// liste sans étape intermédiaire. Second essai après l'animation de
// scroll (300 ms), l'item actif pouvant ne pas encore être construit.
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && _showChannelList) {
_channelListItemFocusNode.requestFocus();
}
});
Future.delayed(const Duration(milliseconds: 400), () {
if (mounted &&
_showChannelList &&
!_channelListItemFocusNode.hasFocus) {
_channelListItemFocusNode.requestFocus();
}
});
} else {
_channelListTimer?.cancel();
}
}
/// (Re)arme l'auto-fermeture de la sidebar. Relancé à chaque interaction
/// (focus D-pad, scroll) pour ne pas fermer la liste sous les doigts.
void _restartChannelListTimer() {
_channelListTimer?.cancel();
_channelListTimer = Timer(const Duration(seconds: 6), () {
if (mounted) setState(() => _showChannelList = false);
});
}
/// Scroll channel list to keep current channel visible
void _scrollToCurrentChannel() {
WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -1049,12 +1125,9 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
void _toggleControls() {
// Always show controls on tap, then start auto-hide timer
if (!_showControls) {
setState(() => _showControls = true);
// Request focus on Play/Pause button when opening
WidgetsBinding.instance.addPostFrameCallback((_) {
// If controls opened, default to Play/Pause
_playPauseFocusNode.requestFocus();
});
// Reopen on the last focused control (falls back to Play/Pause)
_showControlsRestoringFocus();
return;
}
_resetControlsTimer();
}
@@ -1066,6 +1139,21 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
try {
final key = event.logicalKey;
// Sidebar ouverte : Back/Menu la ferment, le reste part au système de
// Focus (navigation + OK sur un item). On relance juste l'auto-fermeture.
if (_showChannelList) {
if (key == LogicalKeyboardKey.escape ||
key == LogicalKeyboardKey.goBack ||
key == LogicalKeyboardKey.contextMenu ||
key == LogicalKeyboardKey.keyM) {
_channelListTimer?.cancel();
setState(() => _showChannelList = false);
return true;
}
_restartChannelListTimer();
return false;
}
// Explicit Play
if (key == LogicalKeyboardKey.mediaPlay) {
if (!_isPlaying) _player.play();
@@ -1087,8 +1175,15 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
key == LogicalKeyboardKey.numpadEnter ||
key == LogicalKeyboardKey.gameButtonA ||
key == LogicalKeyboardKey.mediaPlayPause) {
// If controls are hidden, toggle them + play/pause
if (!_showControls) {
// Live : OK réaffiche seulement l'OSD (focus restauré sur le dernier
// bouton utilisé) — surtout ne PAS mettre le direct en pause.
if (widget.streamType == model.StreamType.live &&
key != LogicalKeyboardKey.mediaPlayPause) {
_showControlsRestoringFocus();
return true;
}
// VOD : comportement historique — toggle play/pause + OSD
_togglePlayPause();
_toggleControls();
return true;
@@ -1116,8 +1211,10 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
if (widget.streamType != model.StreamType.live) {
final newPos = _position - const Duration(seconds: 10);
_player.seek(newPos < Duration.zero ? Duration.zero : newPos);
_onUserInteraction();
} else {
_showControlsRestoringFocus();
}
_onUserInteraction();
return true;
}
return false; // Let Focus handle navigation
@@ -1131,8 +1228,10 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
if (newPos < _duration) {
_player.seek(newPos);
}
_onUserInteraction();
} else {
_showControlsRestoringFocus();
}
_onUserInteraction();
return true;
}
return false; // Let Focus handle navigation
@@ -1142,7 +1241,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
if (key == LogicalKeyboardKey.arrowUp ||
key == LogicalKeyboardKey.arrowDown) {
if (!_showControls) {
_onUserInteraction();
_showControlsRestoringFocus();
return true;
}
return false; // Let Focus handle navigation
@@ -1168,16 +1267,6 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
}
}
// OK / Select when channel list is open → switch to focused channel
if (_showChannelList &&
(key == LogicalKeyboardKey.enter ||
key == LogicalKeyboardKey.select ||
key == LogicalKeyboardKey.numpadEnter)) {
// Channel list handles its own tap, this closes it
setState(() => _showChannelList = false);
return true;
}
// Menu key or 'M' → toggle channel list sidebar
if (key == LogicalKeyboardKey.contextMenu ||
key == LogicalKeyboardKey.keyM) {
@@ -1504,7 +1593,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
TVFocusable(
focusNode: _prevFocusNode,
onPressed: _playPrevious,
onFocus: _resetControlsTimer,
onFocus: () => _noteFocus(_prevFocusNode),
child: const Icon(
Icons.skip_previous,
color: AppColors.onSurface,
@@ -1517,7 +1606,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
TVFocusable(
focusNode: _playPauseFocusNode,
onPressed: _togglePlayPause,
onFocus: _resetControlsTimer,
onFocus: () => _noteFocus(_playPauseFocusNode),
child: Icon(
_isPlaying
? Icons.pause_circle_filled
@@ -1532,7 +1621,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
TVFocusable(
focusNode: _nextFocusNode,
onPressed: _playNext,
onFocus: _resetControlsTimer,
onFocus: () => _noteFocus(_nextFocusNode),
child: const Icon(
Icons.skip_next,
color: AppColors.onSurface,
@@ -1541,6 +1630,19 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
),
const SizedBox(width: 16),
// Channel list sidebar (liste des chaînes de la catégorie)
if (widget.channels != null && widget.channels!.isNotEmpty)
TVFocusable(
focusNode: _channelListButtonFocusNode,
onPressed: _toggleChannelList,
onFocus: () => _noteFocus(_channelListButtonFocusNode),
child: const Icon(
Icons.playlist_play_rounded,
color: AppColors.onSurface,
size: 36,
),
),
// Disable Deinterlace Button
if (widget.forceDeinterlace) ...[
const SizedBox(width: 16),
@@ -1889,15 +1991,28 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
),
// Channel list
Expanded(
child: ListView.builder(
child: NotificationListener<ScrollNotification>(
onNotification: (_) {
_restartChannelListTimer();
return false;
},
child: ListView.builder(
controller: _channelListScrollController,
itemCount: channels.length,
itemExtent: 64.0,
itemBuilder: (context, index) {
final ch = channels[index];
final isActive = index == _currentIndex;
return GestureDetector(
onTap: () {
return TVFocusable(
// Le focusNode externe n'est posé que sur la chaîne
// active ; la clé force un remontage quand isActive
// change (TVFocusable ne gère pas didUpdateWidget).
key: ValueKey('sidebar-ch-$index-$isActive'),
focusNode: isActive ? _channelListItemFocusNode : null,
scale: 1.0,
borderRadius: BorderRadius.zero,
onFocus: _restartChannelListTimer,
onPressed: () {
_channelListTimer?.cancel();
_switchChannel(index);
},
@@ -1985,6 +2100,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
),
);
},
),
),
),
],
@@ -2017,7 +2133,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
_player.seek(pos - const Duration(seconds: 10));
_resetControlsTimer();
},
onFocus: _resetControlsTimer,
onFocus: () => _noteFocus(_prevFocusNode),
borderRadius: BorderRadius.circular(50),
child: IconButton(
icon: const Icon(
@@ -2038,7 +2154,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
TVFocusable(
focusNode: _playPauseFocusNode,
onPressed: _togglePlayPause,
onFocus: _resetControlsTimer,
onFocus: () => _noteFocus(_playPauseFocusNode),
scale: 1.1,
borderRadius: BorderRadius.circular(50),
child: IconButton(
@@ -2063,7 +2179,7 @@ class _NativePlayerScreenState extends ConsumerState<NativePlayerScreen>
_player.seek(pos + const Duration(seconds: 10));
_resetControlsTimer();
},
onFocus: _resetControlsTimer,
onFocus: () => _noteFocus(_nextFocusNode),
borderRadius: BorderRadius.circular(50),
child: IconButton(
icon: const Icon(
+1 -1
View File
@@ -163,7 +163,7 @@ class _TVFocusableState extends State<TVFocusable> {
offset: const Offset(0, 6),
),
const BoxShadow(
color: Color(0x59D9541F), // Ember glow
color: Color(0x590A84FF), // Apple blue glow
blurRadius: 12,
spreadRadius: 0,
),
+1 -1
View File
@@ -1,7 +1,7 @@
name: xtremobile
description: High-performance IPTV Android Application with Xtream Codes API
publish_to: 'none'
version: 1.6.1+13
version: 1.7.1+15
environment:
sdk: '>=3.0.0 <4.0.0'