feat(multi-device): host puede participar como jugador

- Añadido modelo Usuario con pool de usuarios sincronizado
- El host ahora recibe palabra y rol como cualquier jugador
- UI de selección de perfil en pantallas de lobby
- Los clientes pueden ver usuarios del servidor o crear nuevos
- El juego no inicia hasta que el host selecciona perfil
This commit is contained in:
ShanaiaBot
2026-04-24 18:47:56 +02:00
parent 3df3ae1e95
commit d3fc3386f9
31 changed files with 1266 additions and 106 deletions

37
test/usuario_test.dart Normal file
View File

@@ -0,0 +1,37 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:farolero/modelos/usuario.dart';
void main() {
group('Usuario', () {
test('should create Usuario with id and nombre', () {
final usuario = Usuario(id: 'test-id', nombre: 'Juan');
expect(usuario.id, 'test-id');
expect(usuario.nombre, 'Juan');
});
test('should serialize to JSON correctly', () {
final usuario = Usuario(id: 'test-id', nombre: 'Juan');
final json = usuario.toJson();
expect(json['id'], 'test-id');
expect(json['nombre'], 'Juan');
});
test('should deserialize from JSON correctly', () {
final json = {'id': 'test-id', 'nombre': 'Juan'};
final usuario = Usuario.fromJson(json);
expect(usuario.id, 'test-id');
expect(usuario.nombre, 'Juan');
});
test('should handle JSON with avatar field', () {
final json = {'id': 'test-id', 'nombre': 'Juan', 'avatar': '👤'};
final usuario = Usuario.fromJson(json);
expect(usuario.id, 'test-id');
expect(usuario.nombre, 'Juan');
});
});
}