Merge pull request 'fix(reproduccion): robustez HTTP cleartext, errores ExoPlayer y certificados SSL' (#7) from feature/fix-reproduccion-robustez into main
Some checks failed
Flutter CI/CD — PluriWave / Test + Build (push) Has been cancelled

Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
2026-04-05 19:08:21 +02:00
7 changed files with 220 additions and 33 deletions

View File

@@ -200,6 +200,7 @@ class _Artwork extends StatelessWidget {
builder: (context, snapshot) {
final reproduciendo = snapshot.data == EstadoReproduccion.reproduciendo;
final cargando = snapshot.data == EstadoReproduccion.cargando;
final hayError = snapshot.data == EstadoReproduccion.error;
return AnimatedContainer(
duration: const Duration(milliseconds: 300),
@@ -207,7 +208,15 @@ class _Artwork extends StatelessWidget {
height: size,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
boxShadow: reproduciendo
boxShadow: hayError
? [
BoxShadow(
color: theme.colorScheme.error.withValues(alpha: 0.25),
blurRadius: 12,
spreadRadius: 2,
),
]
: reproduciendo
? [
BoxShadow(
color: theme.colorScheme.primary.withValues(alpha: 0.4),
@@ -229,12 +238,15 @@ class _Artwork extends StatelessWidget {
fit: StackFit.expand,
children: [
// Logo / imagen
// errorWidget captura HandshakeException (cert autofirmado)
// y cualquier fallo de red en artwork. El error queda
// contenido aquí — no se propaga ni rompe el reproductor.
if (emisora.favicon != null && emisora.favicon!.isNotEmpty)
CachedNetworkImage(
imageUrl: emisora.favicon!,
fit: BoxFit.cover,
placeholder: (_, __) => _shimmer(theme),
errorWidget: (_, __, ___) => _iconoFallback(theme),
errorWidget: (_, url, error) => _iconoFallback(theme),
)
else
_iconoFallback(theme),
@@ -246,6 +258,18 @@ class _Artwork extends StatelessWidget {
child: CircularProgressIndicator(color: Colors.white),
),
),
// Overlay de error de reproducción
if (hayError)
Container(
color: Colors.black54,
child: Center(
child: Icon(
Icons.wifi_off_rounded,
size: 56,
color: Colors.white.withValues(alpha: 0.85),
),
),
),
],
),
),
@@ -319,6 +343,35 @@ class _Controles extends StatelessWidget {
final s = snapshot.data ?? EstadoReproduccion.detenido;
final reproduciendo = s == EstadoReproduccion.reproduciendo;
final cargando = s == EstadoReproduccion.cargando;
final hayError = s == EstadoReproduccion.error;
// En estado de error: mostrar mensaje y botón de reintento
if (hayError) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.error_outline_rounded,
size: 40,
color: theme.colorScheme.error,
),
const SizedBox(height: 8),
Text(
'No se puede reproducir esta radio',
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.colorScheme.error,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 12),
FilledButton.tonalIcon(
icon: const Icon(Icons.refresh_rounded, size: 18),
label: const Text('Reintentar'),
onPressed: () => estado.reproducir(emisora),
),
],
);
}
return Row(
mainAxisAlignment: MainAxisAlignment.center,