feat: foto de perfil seleccionable desde archivo
- file_picker ^4.6.1 — abre galería/archivos (en Android incluye cámara) - BD v3: columna foto_path en usuarios, migración onUpgrade - Usuario modelo: campo fotoPath + copyWith - UsuariosDao: método updateFoto(id, path) - PerfilUsuarioPage: · Avatar muestra foto si hay, iniciales si no · Toque en avatar o ícono cámara → FilePicker → guarda ruta en BD · Ícono editar nombre movido junto al texto del nombre Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
f42467037d
commit
33f0b8aa29
@@ -41,6 +41,16 @@ class UsuariosDao {
|
||||
return db.delete('usuarios', where: 'id = ?', whereArgs: [id]);
|
||||
}
|
||||
|
||||
Future<int> updateFoto(int id, String? path) async {
|
||||
final db = await _db.db;
|
||||
return db.update(
|
||||
'usuarios',
|
||||
{'foto_path': path, 'sincronizado': 0},
|
||||
where: 'id = ?',
|
||||
whereArgs: [id],
|
||||
);
|
||||
}
|
||||
|
||||
Future<List<Usuario>> getPendientes() async {
|
||||
final db = await _db.db;
|
||||
final rows = await db.query('usuarios', where: 'sincronizado = 0');
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:path/path.dart';
|
||||
|
||||
class DatabaseHelper {
|
||||
static const _dbName = 'sentinel_one.db';
|
||||
static const _dbVersion = 2;
|
||||
static const _dbVersion = 3;
|
||||
|
||||
DatabaseHelper._();
|
||||
static final DatabaseHelper instance = DatabaseHelper._();
|
||||
@@ -67,7 +67,8 @@ class DatabaseHelper {
|
||||
fecha_inicio TEXT,
|
||||
fecha_fin TEXT,
|
||||
activo INTEGER NOT NULL DEFAULT 1,
|
||||
sincronizado INTEGER NOT NULL DEFAULT 0
|
||||
sincronizado INTEGER NOT NULL DEFAULT 0,
|
||||
foto_path TEXT
|
||||
)
|
||||
''');
|
||||
|
||||
@@ -210,6 +211,10 @@ class DatabaseHelper {
|
||||
await _createTablesV2(db);
|
||||
await _seedDataV2(db);
|
||||
}
|
||||
if (oldVersion < 3) {
|
||||
await db.execute(
|
||||
'ALTER TABLE usuarios ADD COLUMN foto_path TEXT');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _createTablesV2(Database db) async {
|
||||
|
||||
Reference in New Issue
Block a user