This commit is contained in:
2025-12-30 23:20:50 -06:00
parent 9f8eab4a31
commit ec923c906e
26 changed files with 2234 additions and 53 deletions

View File

@@ -26,12 +26,29 @@ class UserProfileNotifier extends StateNotifier<UserProfile?> {
state = profile;
}
Future<void> updateThemeMode(AppThemeMode themeMode) async {
if (state != null) {
await updateProfile(state!.copyWith(themeMode: themeMode));
}
}
Future<void> updateAccentColor(String accentColor) async {
if (state != null) {
await updateProfile(state!.copyWith(accentColor: accentColor));
}
}
Future<void> updateRelationshipStatus(RelationshipStatus relationshipStatus) async {
if (state != null) {
await updateProfile(state!.copyWith(relationshipStatus: relationshipStatus));
}
}
Future<void> clearProfile() async {
final box = Hive.box<UserProfile>('user_profile');
await box.clear();
state = null;
}
}
/// Provider for cycle entries
final cycleEntriesProvider = StateNotifierProvider<CycleEntriesNotifier, List<CycleEntry>>((ref) {
@@ -67,6 +84,18 @@ class CycleEntriesNotifier extends StateNotifier<List<CycleEntry>> {
_loadEntries();
}
Future<void> deleteEntriesForMonth(int year, int month) async {
final box = Hive.box<CycleEntry>('cycle_entries');
final keysToDelete = <dynamic>[];
for (var entry in box.values) {
if (entry.date.year == year && entry.date.month == month) {
keysToDelete.add(entry.key);
}
}
await box.deleteAll(keysToDelete);
_loadEntries();
}
Future<void> clearEntries() async {
final box = Hive.box<CycleEntry>('cycle_entries');
await box.clear();