modificaciones en el sistema

This commit is contained in:
Kimberly
2026-05-23 07:11:13 -06:00
parent db292ca044
commit 7ebce39671
5 changed files with 114 additions and 108 deletions

View File

@@ -1,66 +0,0 @@
import 'package:flutter/material.dart';
import 'notificaciones_service.dart';
class AlertasOperativasProvider with ChangeNotifier {
final NotificacionesService _notificacionesService = NotificacionesService();
// Estados de los interruptores configurables por el usuario
bool _notificarInicioRuta = true;
bool _notificarAproximacion = true;
bool _notificarRetrasosFallas = true;
// Getters para leer el estado desde las pantallas
bool get notificarInicioRuta => _notificarInicioRuta;
bool get notificarAproximacion => _notificarAproximacion;
bool get notificarRetrasosFallas => _notificarRetrasosFallas;
// Funciones para cambiar los interruptores (Switches)
void cambiarNotificarInicioRuta(bool valor) {
_notificarInicioRuta = valor;
notifyListeners(); // Notifica a la interfaz que se redibuje
}
void cambiarNotificarAproximacion(bool valor) {
_notificarAproximacion = valor;
notifyListeners();
}
void cambiarNotificarRetrasosFallas(bool valor) {
_notificarRetrasosFallas = valor;
notifyListeners();
}
// =========================================================
// SIMULACIÓN DE DISPAROS DE ALERTAS PUSH REALES
// =========================================================
void simularAlertaInicioRuta() {
if (_notificarInicioRuta) {
_notificacionesService.mostrarNotificacionPush(
id: 1,
titulo: 'Ruta Iniciada 🟢',
mensaje: 'El camión recolector ha comenzado su recorrido hacia tu sector.',
);
}
}
void simularAlertaAproximacion() {
if (_notificarAproximacion) {
_notificacionesService.mostrarNotificacionPush(
id: 2,
titulo: 'Camión Cercano ⏰',
mensaje: 'El recolector llegará a tu domicilio en aproximadamente 15 minutos.',
);
}
}
void simularAlertaRetrasoOConversion() {
if (_notificarRetrasosFallas) {
_notificacionesService.mostrarNotificacionPush(
id: 3,
titulo: 'Retraso en la Ruta ⚠️',
mensaje: 'Aviso: Retraso operativo por tráfico pesado o fallas mecánicas en la zona.',
);
}
}
}