Implementado:
No se puede marcar “vista” sin revelar la palabra antes. Se puede volver a ver la palabra durante debate/votación/resultado. Notas online privadas por partida y jugador. Tests añadidos para notas scoped. Ajusté roomId en el payload de inicio para que las notas no se mezclen entre partidas.
This commit is contained in:
@@ -24,11 +24,14 @@ class PantallaPalabrasCliente extends StatefulWidget {
|
||||
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;
|
||||
@@ -64,7 +67,10 @@ class _PantallaPalabrasClienteState extends State<PantallaPalabrasCliente> {
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
GestureDetector(
|
||||
onTap: () => setState(() => _visible = !_visible),
|
||||
onTap: () => setState(() {
|
||||
_visible = !_visible;
|
||||
if (_visible) _jugadoresRevelados.add(actual.jugadorId);
|
||||
}),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
width: double.infinity,
|
||||
@@ -113,14 +119,26 @@ class _PantallaPalabrasClienteState extends State<PantallaPalabrasCliente> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
_actualRevelado
|
||||
? l10n.seeYourWord
|
||||
: l10n.tapToSee,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: TemaApp.colorTextoSecundario),
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 56,
|
||||
child: ElevatedButton.icon(
|
||||
onPressed: _continuar,
|
||||
onPressed: _actualRevelado ? _continuar : null,
|
||||
icon: Icon(_esUltimo ? Icons.check : Icons.arrow_forward),
|
||||
label: Text(_esUltimo ? l10n.iveSeenIt : 'Siguiente jugador'),
|
||||
label: Text(
|
||||
_actualRevelado
|
||||
? (_esUltimo ? l10n.iveSeenIt : l10n.next)
|
||||
: l10n.tapToSee,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user