Actualizacion del programa

This commit is contained in:
2026-05-23 01:40:39 -06:00
parent 458af32fcf
commit c6a1a67469
132 changed files with 11009 additions and 168 deletions

View File

@@ -143,6 +143,11 @@ class RouteSimulatorService extends ChangeNotifier {
final n = AppNotification(event:event, title:title, body:body, routeId:routeId);
_lastNotification = n;
_history.insert(0, n);
// Persistir en DB para historial
DbHelper.insertNotifHistory(
routeId: routeId, eventType: event.name,
title: title, body: body,
).catchError((_) {});
notifyListeners();
}

View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
class ThemeService extends ChangeNotifier {
ThemeMode _themeMode = ThemeMode.light;
ThemeMode get themeMode => _themeMode;
bool get isDark => _themeMode == ThemeMode.dark;
ThemeService() { _load(); }
Future<void> _load() async {
final p = await SharedPreferences.getInstance();
final isDark = p.getBool('dark_mode') ?? false;
_themeMode = isDark ? ThemeMode.dark : ThemeMode.light;
notifyListeners();
}
Future<void> toggle() async {
_themeMode = _themeMode == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark;
final p = await SharedPreferences.getInstance();
await p.setBool('dark_mode', _themeMode == ThemeMode.dark);
notifyListeners();
}
}