From ede7064bdac65a9ad094b67808a0f50bca8c8f3e Mon Sep 17 00:00:00 2001 From: Sterlen Date: Sat, 10 Jan 2026 12:50:52 -0600 Subject: [PATCH] sync additons --- lib/providers/sync_notification_provider.dart | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lib/providers/sync_notification_provider.dart diff --git a/lib/providers/sync_notification_provider.dart b/lib/providers/sync_notification_provider.dart new file mode 100644 index 0000000..ded1d66 --- /dev/null +++ b/lib/providers/sync_notification_provider.dart @@ -0,0 +1,43 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +class SyncNotificationState { + final bool hasNewLogData; + final bool hasNewPrayerData; + + const SyncNotificationState({ + this.hasNewLogData = false, + this.hasNewPrayerData = false, + }); + + SyncNotificationState copyWith({ + bool? hasNewLogData, + bool? hasNewPrayerData, + }) { + return SyncNotificationState( + hasNewLogData: hasNewLogData ?? this.hasNewLogData, + hasNewPrayerData: hasNewPrayerData ?? this.hasNewPrayerData, + ); + } +} + +class SyncNotificationNotifier extends StateNotifier { + SyncNotificationNotifier() : super(const SyncNotificationState()); + + void setHasNewLogData(bool value) { + if (state.hasNewLogData != value) { + state = state.copyWith(hasNewLogData: value); + } + } + + void setHasNewPrayerData(bool value) { + if (state.hasNewPrayerData != value) { + state = state.copyWith(hasNewPrayerData: value); + } + } +} + +final syncNotificationProvider = + StateNotifierProvider( + (ref) { + return SyncNotificationNotifier(); +});