aplicadas correcciones
This commit is contained in:
@@ -103,7 +103,7 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'Escanea este código desde otro móvil',
|
||||
l10n.scanThisCodeFromAnotherPhone,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -111,7 +111,12 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildResumenSala(context, seleccionados, nearby.jugadores.length),
|
||||
_buildResumenSala(
|
||||
context,
|
||||
l10n,
|
||||
seleccionados,
|
||||
nearby.jugadores.length,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Expanded(
|
||||
child: Card(
|
||||
@@ -124,7 +129,7 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Usuarios de la partida',
|
||||
l10n.gameUsers,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
),
|
||||
@@ -141,7 +146,11 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
: ListView.builder(
|
||||
itemCount: usuarios.length,
|
||||
itemBuilder: (context, index) =>
|
||||
_buildUsuarioTile(context, usuarios[index]),
|
||||
_buildUsuarioTile(
|
||||
context,
|
||||
l10n,
|
||||
usuarios[index],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -152,7 +161,7 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
const SizedBox(height: 12),
|
||||
if (!puedeIniciar)
|
||||
Text(
|
||||
_mensajeValidacion(validacionInicio?.codigo),
|
||||
_mensajeValidacion(validacionInicio?.codigo, l10n),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyMedium
|
||||
@@ -182,6 +191,7 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
|
||||
Widget _buildResumenSala(
|
||||
BuildContext context,
|
||||
AppLocalizations l10n,
|
||||
int seleccionados,
|
||||
int clientesRemotos,
|
||||
) {
|
||||
@@ -191,7 +201,7 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
child: _buildStat(
|
||||
context,
|
||||
icon: Icons.groups,
|
||||
label: 'Jugadores seleccionados',
|
||||
label: l10n.selectedPlayers,
|
||||
value: '$seleccionados',
|
||||
ok: seleccionados >= 3,
|
||||
),
|
||||
@@ -201,7 +211,7 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
child: _buildStat(
|
||||
context,
|
||||
icon: Icons.devices,
|
||||
label: 'Móviles conectados',
|
||||
label: l10n.connectedPhones,
|
||||
value: '${clientesRemotos + 1}',
|
||||
ok: true,
|
||||
),
|
||||
@@ -241,7 +251,11 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildUsuarioTile(BuildContext context, Usuario usuario) {
|
||||
Widget _buildUsuarioTile(
|
||||
BuildContext context,
|
||||
AppLocalizations l10n,
|
||||
Usuario usuario,
|
||||
) {
|
||||
final nearby = context.read<ServicioNearby>();
|
||||
final miClientId = nearby.miClientId;
|
||||
final seleccionadoPorMi = usuario.clienteIdSeleccionado == miClientId;
|
||||
@@ -270,10 +284,10 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
children: [
|
||||
Text(
|
||||
seleccionadoPorMi
|
||||
? 'Seleccionado por este móvil'
|
||||
? l10n.selectedOnThisPhone
|
||||
: seleccionadoPorOtro
|
||||
? 'Seleccionado por otro cliente'
|
||||
: 'Disponible',
|
||||
? l10n.selectedByAnotherDevice
|
||||
: l10n.available,
|
||||
),
|
||||
if (usuario.medallas.isNotEmpty) ...[
|
||||
const SizedBox(height: 4),
|
||||
@@ -286,19 +300,19 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
children: [
|
||||
if (seleccionadoPorMi)
|
||||
IconButton(
|
||||
tooltip: 'Liberar',
|
||||
tooltip: l10n.release,
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () => nearby.liberarUsuarioSala(usuario.id),
|
||||
)
|
||||
else if (!seleccionadoPorOtro)
|
||||
IconButton(
|
||||
tooltip: 'Seleccionar',
|
||||
tooltip: l10n.select,
|
||||
icon: const Icon(Icons.check_circle_outline),
|
||||
onPressed: () => nearby.seleccionarUsuarioSala(usuario.id),
|
||||
),
|
||||
if (!usuario.estaSeleccionado)
|
||||
IconButton(
|
||||
tooltip: 'Eliminar',
|
||||
tooltip: l10n.delete,
|
||||
icon: const Icon(Icons.delete_outline, color: TemaApp.colorAcento),
|
||||
onPressed: () => nearby.eliminarUsuarioSala(usuario.id),
|
||||
),
|
||||
@@ -307,16 +321,16 @@ class _PantallaLobbyHostState extends State<PantallaLobbyHost> {
|
||||
);
|
||||
}
|
||||
|
||||
String _mensajeValidacion(String? codigo) {
|
||||
String _mensajeValidacion(String? codigo, AppLocalizations l10n) {
|
||||
switch (codigo) {
|
||||
case 'faltan_jugadores':
|
||||
return 'Seleccioná al menos 3 usuarios para iniciar.';
|
||||
return l10n.selectAtLeastThreeUsersToStart;
|
||||
case 'host_sin_usuario':
|
||||
return 'El móvil servidor debe seleccionar al menos un usuario.';
|
||||
return l10n.hostPhoneMustSelectUser;
|
||||
case 'sala_cerrada':
|
||||
return 'La sala ya no está en lobby.';
|
||||
return l10n.roomNoLongerInLobby;
|
||||
default:
|
||||
return 'Completá la selección de usuarios para iniciar.';
|
||||
return l10n.completeUserSelectionToStart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user