refactorización de pantallas

This commit is contained in:
2026-05-11 23:16:38 +02:00
parent 1929d86689
commit 4599678e77
48 changed files with 1446 additions and 1463 deletions
+62 -163
View File
@@ -4,7 +4,6 @@ import 'package:farolero/l10n/generated/app_localizations.dart';
import 'package:provider/provider.dart';
import '../estado/estado_juego.dart';
import '../tema/componentes_farolero.dart';
import '../tema/tema_app.dart';
import 'pantalla_notas.dart';
import 'pantalla_votacion.dart';
@@ -67,9 +66,6 @@ class _PantallaDebateState extends State<PantallaDebate> {
if (partida == null) return const SizedBox.shrink();
final tieneTemporizador = partida.config.tiempoDebateSegundos != null;
final progreso = tieneTemporizador
? _segundosRestantes / partida.config.tiempoDebateSegundos!
: 0.0;
return Scaffold(
appBar: AppBar(
@@ -78,172 +74,75 @@ class _PantallaDebateState extends State<PantallaDebate> {
),
body: FondoFarolero(
intenso: true,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
const ArteGameplayFarolero.fase(height: 110),
const SizedBox(height: 10),
// Temporizador
if (tieneTemporizador) ...[
Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: _tiempoAgotado
? TemaApp.colorAcento.withValues(alpha: 0.3)
: TemaApp.colorTarjeta,
borderRadius: BorderRadius.circular(16),
border: _tiempoAgotado
? Border.all(color: TemaApp.colorAcento, width: 2)
: null,
),
child: Stack(
alignment: Alignment.center,
children: [
Positioned.fill(
child: Image.asset(
'assets/ui/generated/gameplay/gameplay_phase_emblem.webp',
fit: BoxFit.contain,
opacity: const AlwaysStoppedAnimation(0.36),
child: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
const ArteGameplayFarolero.fase(height: 110),
const SizedBox(height: 10),
if (tieneTemporizador) ...[
TemporizadorFarolero(
etiqueta: _tiempoAgotado ? l10n.timeUp : l10n.timeRemaining,
tiempo: _formatearTiempo(_segundosRestantes),
agotado: _tiempoAgotado,
),
const SizedBox(height: 16),
],
Expanded(
child: TarjetaFaseFarolero(
icono: Icons.forum,
titulo: l10n.playersInDebate,
subtitulo: l10n.activePlayersInfo(
partida.jugadoresActivos.length,
partida.impostoresActivos.length,
),
child: Expanded(
child: ListView.separated(
itemCount: partida.jugadores.length,
separatorBuilder: (context, index) => const SizedBox(height: 8),
itemBuilder: (context, index) {
final jugador = partida.jugadores[index];
return EstadoJugadorFarolero(
nombre: '${index + 1}. ${jugador.nombre}',
subtitulo: jugador.eliminado ? l10n.eliminated : null,
icono: jugador.eliminado ? Icons.person_off : Icons.record_voice_over,
destacado: !jugador.eliminado,
completado: !jugador.eliminado,
);
},
),
),
Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_tiempoAgotado ? l10n.timeUp : l10n.timeRemaining,
style:
Theme.of(context).textTheme.titleMedium?.copyWith(
color: _tiempoAgotado
? TemaApp.colorAcento
: TemaApp.colorTextoSecundario,
),
),
const SizedBox(height: 8),
Text(
_formatearTiempo(_segundosRestantes),
style:
Theme.of(context).textTheme.headlineLarge?.copyWith(
fontSize: 48,
fontWeight: FontWeight.bold,
color: _segundosRestantes < 10 &&
!_tiempoAgotado
? TemaApp.colorAcento
: TemaApp.colorTexto,
),
),
const SizedBox(height: 8),
ClipRRect(
borderRadius: BorderRadius.circular(4),
child: LinearProgressIndicator(
value: progreso,
backgroundColor: TemaApp.colorSuperficie,
valueColor: AlwaysStoppedAnimation(
_segundosRestantes < 10
? TemaApp.colorAcento
: TemaApp.colorVerde,
),
minHeight: 6,
),
),
],
),
),
const SizedBox(height: 16),
Row(
children: [
Expanded(
child: BotonFarolero.oscuro(
texto: l10n.notes,
icono: Icons.edit_note,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const PantallaNotas()),
);
},
),
),
const SizedBox(width: 12),
Expanded(
flex: 2,
child: BotonFarolero(
texto: l10n.goToVoting,
icono: Icons.how_to_vote,
onPressed: _irAVotacion,
),
),
],
),
),
const SizedBox(height: 16),
],
// Jugadores activos
Expanded(
child: Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
l10n.playersInDebate,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 4),
Text(
l10n.activePlayersInfo(partida.jugadoresActivos.length, partida.impostoresActivos.length),
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(height: 12),
Expanded(
child: ListView.builder(
itemCount: partida.jugadores.length,
itemBuilder: (context, index) {
final j = partida.jugadores[index];
return ListTile(
leading: CircleAvatar(
backgroundColor: j.eliminado
? Colors.grey
: TemaApp.colorAcento,
child: Text(
j.eliminado ? '💀' : '${index + 1}',
style: const TextStyle(
color: Colors.white, fontSize: 14),
),
),
title: Text(
j.nombre,
style: TextStyle(
decoration: j.eliminado
? TextDecoration.lineThrough
: null,
color: j.eliminado
? TemaApp.colorTextoSecundario
: TemaApp.colorTexto,
),
),
subtitle: j.eliminado
? Text(l10n.eliminated)
: null,
dense: true,
);
},
),
),
],
),
),
),
),
const SizedBox(height: 16),
// Botones
Row(
children: [
Expanded(
child: OutlinedButton.icon(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const PantallaNotas(),
),
);
},
icon: const Text('📝', style: TextStyle(fontSize: 18)),
label: Text(l10n.notes),
),
),
const SizedBox(width: 12),
Expanded(
flex: 2,
child: ElevatedButton.icon(
onPressed: _irAVotacion,
icon: const Text('🗳️', style: TextStyle(fontSize: 18)),
label: Text(l10n.goToVoting),
),
),
],
),
],
),
),
),