Exit confirmation - A dialog in the app's own style now guards every in-game screen. The safe action is the prominent one, so a stray tap keeps you in the game. - Eleven screens covered, against both the system back gesture and the close buttons. The message adapts: a single-device game is lost, a host ends it for everyone, a client can rejoin. - The two screens the host also opens from the manager take a flag so that back there just closes them instead of offering to quit. Translations - 21 keys were still holding the English text in Arabic, Basque, Hindi, Japanese, Korean, Dutch, Polish, Russian, Turkish and both Chinese variants: 231 strings, covering the whole multi-device flow, permissions and the mode picker. Nothing failed, the app just showed English. - The permissions dialog was hardcoded in Spanish; it is localized now. - Portuguese used Spanish gerunds where pt-PT takes "a + infinitive". Checked what looked untranslated but is not: Animals and Notes are correct Catalan, Configuration and Vibration correct French, Version correct German. Those are whitelisted in the new test rather than silently rewritten. l10n_cobertura_test guards all of it: no missing or orphan keys, no empty values, no English left outside the whitelist, and placeholders preserved.
163 lines
5.8 KiB
Dart
163 lines
5.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:farolero/tema/dialogo_confirmacion.dart';
|
|
import 'package:farolero/l10n/generated/app_localizations.dart';
|
|
import 'package:farolero/modelos/inicio_partida_multijugador.dart';
|
|
import 'package:farolero/tema/componentes_farolero.dart';
|
|
import 'package:farolero/tema/tema_app.dart';
|
|
|
|
/// Reveal secuencial para clientes que manejan uno o varios jugadores.
|
|
class PantallaPalabrasCliente extends StatefulWidget {
|
|
final List<JugadorInicioPartida> jugadores;
|
|
final String? pistaImpostor;
|
|
final VoidCallback onTodosVistos;
|
|
|
|
/// El host abre esta pantalla desde el gestor: allí el atrás solo
|
|
/// debe cerrarla, no ofrecer abandonar la partida.
|
|
final bool protegerSalida;
|
|
|
|
const PantallaPalabrasCliente({
|
|
super.key,
|
|
required this.jugadores,
|
|
this.pistaImpostor,
|
|
required this.onTodosVistos,
|
|
this.protegerSalida = true,
|
|
});
|
|
|
|
@override
|
|
State<PantallaPalabrasCliente> createState() => _PantallaPalabrasClienteState();
|
|
}
|
|
|
|
class _PantallaPalabrasClienteState extends State<PantallaPalabrasCliente> {
|
|
int _indice = 0;
|
|
bool _visible = false;
|
|
final Set<String> _jugadoresRevelados = {};
|
|
|
|
JugadorInicioPartida get _actual => widget.jugadores[_indice];
|
|
bool get _esUltimo => _indice == widget.jugadores.length - 1;
|
|
bool get _actualRevelado => _jugadoresRevelados.contains(_actual.jugadorId);
|
|
|
|
void _continuar() {
|
|
if (!_actualRevelado) return;
|
|
if (_esUltimo) {
|
|
widget.onTodosVistos();
|
|
return;
|
|
}
|
|
setState(() {
|
|
_indice++;
|
|
_visible = false;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l10n = AppLocalizations.of(context)!;
|
|
final actual = _actual;
|
|
|
|
return GuardiaSalidaPartida(
|
|
contexto: ContextoSalida.cliente,
|
|
activo: widget.protegerSalida,
|
|
child: Scaffold(
|
|
body: FondoFarolero(
|
|
intenso: true,
|
|
child: SafeArea(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
children: [
|
|
const ArteGameplayFarolero.fase(height: 116),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'${l10n.defaultPlayerName} ${_indice + 1} / ${widget.jugadores.length}',
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
),
|
|
const Spacer(),
|
|
Text(
|
|
actual.nombre,
|
|
style: Theme.of(context).textTheme.headlineMedium,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 24),
|
|
GestureDetector(
|
|
onTap: () => setState(() {
|
|
_visible = !_visible;
|
|
if (_visible) _jugadoresRevelados.add(actual.jugadorId);
|
|
}),
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 250),
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 48,
|
|
horizontal: 24,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: _visible ? TemaApp.colorSuperficie : TemaApp.colorTarjeta,
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(
|
|
color: _visible ? TemaApp.colorNaranja : TemaApp.colorBorde,
|
|
),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
IconoFarolero(
|
|
_visible ? Icons.visibility : Icons.visibility_off,
|
|
color: _visible ? Colors.white : TemaApp.colorTextoSecundario,
|
|
size: 32,
|
|
),
|
|
const SizedBox(height: 16),
|
|
if (_visible && !actual.esImpostor)
|
|
TarjetaPalabraFarolero(palabra: actual.palabra ?? '')
|
|
else
|
|
Text(
|
|
_visible ? l10n.youAreImpostor : '???',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 32,
|
|
fontWeight: FontWeight.bold,
|
|
color: _visible
|
|
? TemaApp.colorDorado
|
|
: TemaApp.colorTextoSecundario,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
if (_visible && actual.esImpostor && widget.pistaImpostor != null) ...[
|
|
const SizedBox(height: 12),
|
|
PistaImpostorFarolero(pista: widget.pistaImpostor!),
|
|
],
|
|
if (_visible &&
|
|
actual.esImpostor &&
|
|
actual.companerosImpostores != null) ...[
|
|
const SizedBox(height: 12),
|
|
CompanerosImpostorFarolero(
|
|
nombres: actual.companerosImpostores!,
|
|
),
|
|
],
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
_actualRevelado
|
|
? l10n.seeYourWord
|
|
: l10n.tapToSee,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(color: TemaApp.colorTextoSecundario),
|
|
),
|
|
const Spacer(),
|
|
BotonFarolero(
|
|
texto: _actualRevelado
|
|
? (_esUltimo ? l10n.iveSeenIt : l10n.next)
|
|
: l10n.tapToSee,
|
|
icono: _esUltimo ? Icons.check : Icons.arrow_forward,
|
|
assetIconPath: 'assets/ui/generated/actions/action_reveal_word.webp',
|
|
onPressed: _actualRevelado ? _continuar : null,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|