sync additons

This commit is contained in:
2026-01-10 12:50:52 -06:00
parent 0a72259a9a
commit ede7064bda

View File

@@ -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<SyncNotificationState> {
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<SyncNotificationNotifier, SyncNotificationState>(
(ref) {
return SyncNotificationNotifier();
});