Facturas recurrentes, edición, padding, y política de privacidad

- Servicio: nuevo campo esRecurrente + migración DB v2
- Al marcar pagada una factura recurrente se genera la siguiente
- Editar facturas existentes desde CrearFacturaScreen
- Nuevo método actualizarFactura en FacturaProvider
- padding inferior en listas de facturas y servicios (último item visible)
- Nota de factura visible en subtítulo
- Filtro Vencidas corregido
- Monto pendiente total visible en dashboard
- Botón undo para revertir factura pagada
- Configuración de release signing (keystore)
- Pantalla de política de privacidad en la app + PRIVACY_POLICY.md
This commit is contained in:
Super User
2026-06-15 21:45:59 -04:00
parent be28ef39cd
commit bbd20f66da
12 changed files with 260 additions and 16 deletions

View File

@@ -19,13 +19,20 @@ class DatabaseHelper {
Future<Database> _initDB(String filePath) async {
final dbPath = await getDatabasesPath();
final path = join(dbPath, filePath);
return await openDatabase(path, version: 1, onCreate: _createDB, onConfigure: _onConfigure);
return await openDatabase(path, version: 2, onCreate: _createDB, onUpgrade: _upgradeDB, onConfigure: _onConfigure);
}
Future _onConfigure(Database db) async {
await db.execute('PRAGMA foreign_keys = ON');
}
Future _upgradeDB(Database db, int oldVersion, int newVersion) async {
if (oldVersion < 2) {
await db.execute(
"ALTER TABLE servicios ADD COLUMN es_recurrente INTEGER NOT NULL DEFAULT 0");
}
}
Future _createDB(Database db, int version) async {
await db.execute('''
CREATE TABLE servicios (
@@ -81,6 +88,13 @@ class DatabaseHelper {
return await db.delete('servicios', where: 'id = ?', whereArgs: [id]);
}
Future<Servicio?> getServicio(int id) async {
final db = await database;
final maps = await db.query('servicios', where: 'id = ?', whereArgs: [id], limit: 1);
if (maps.isEmpty) return null;
return Servicio.fromMap(maps.first);
}
Future<int> insertFactura(Factura factura) async {
final db = await database;
return await db.insert('facturas', factura.toMap()..remove('id'));