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:
@@ -4,6 +4,7 @@ import '../providers/factura_provider.dart';
|
||||
import '../providers/servicio_provider.dart';
|
||||
import '../providers/configuracion_provider.dart';
|
||||
import '../utils/currency_utils.dart';
|
||||
import 'crear_factura_screen.dart';
|
||||
|
||||
class FacturasScreen extends StatefulWidget {
|
||||
const FacturasScreen({super.key});
|
||||
@@ -45,7 +46,7 @@ class _FacturasScreenState extends State<FacturasScreen> {
|
||||
const SizedBox(width: 8),
|
||||
FilterChip(label: const Text('Pagadas'), selected: _filtroEstado == 'Pagada', onSelected: (_) => setState(() { _filtroEstado = 'Pagada'; _filtroServicio = null; facturaProv.cargarFacturas(estado: 'Pagada'); })),
|
||||
const SizedBox(width: 8),
|
||||
FilterChip(label: const Text('Vencidas'), selected: _filtroEstado == 'vencidas', onSelected: (_) => setState(() { _filtroEstado = 'vencidas'; _filtroServicio = null; facturaProv.facturasVencidas; })),
|
||||
FilterChip(label: const Text('Vencidas'), selected: _filtroEstado == 'vencidas', onSelected: (_) => setState(() { _filtroEstado = 'vencidas'; _filtroServicio = null; facturaProv.cargarFacturas(estado: 'vencidas'); })),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -54,7 +55,7 @@ class _FacturasScreenState extends State<FacturasScreen> {
|
||||
child: facturaProv.cargando
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 80),
|
||||
itemCount: facturaProv.facturas.length + (facturaProv.facturas.isEmpty ? 1 : 0),
|
||||
itemBuilder: (_, i) {
|
||||
if (facturaProv.facturas.isEmpty) {
|
||||
@@ -97,7 +98,13 @@ class _FacturasScreenState extends State<FacturasScreen> {
|
||||
),
|
||||
title: Text('${servicio?.nombre ?? 'Desconocido'} - ${CurrencyUtils.formatPrice(f.monto, moneda)}',
|
||||
style: const TextStyle(fontWeight: FontWeight.w500)),
|
||||
subtitle: Text('Vence: ${f.fechaVencimiento}${f.estado == 'Pagada' ? ' Pagada: ${f.fechaPago ?? ''}' : ''}'),
|
||||
subtitle: Text.rich(TextSpan(children: [
|
||||
TextSpan(text: 'Vence: ${f.fechaVencimiento}'),
|
||||
if (f.estado == 'Pagada' && f.fechaPago != null)
|
||||
TextSpan(text: ' Pagada: ${f.fechaPago}'),
|
||||
if (f.nota != null && f.nota!.isNotEmpty)
|
||||
TextSpan(text: '\n${f.nota}', style: TextStyle(color: Colors.grey[600], fontSize: 12)),
|
||||
])),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -105,7 +112,17 @@ class _FacturasScreenState extends State<FacturasScreen> {
|
||||
IconButton(
|
||||
icon: Icon(Icons.check_circle, color: vencida ? Colors.red : Colors.green),
|
||||
onPressed: () => facturaProv.marcarPagada(f.id!),
|
||||
)
|
||||
else
|
||||
IconButton(
|
||||
icon: const Icon(Icons.undo, color: Colors.orange),
|
||||
onPressed: () => facturaProv.marcarPendiente(f.id!),
|
||||
tooltip: 'Marcar pendiente',
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit_outlined),
|
||||
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (_) => CrearFacturaScreen(factura: f))).then((_) => facturaProv.cargarFacturas()),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_outline, color: Colors.red),
|
||||
onPressed: () => facturaProv.eliminarFactura(f.id!),
|
||||
|
||||
Reference in New Issue
Block a user