sync additons
This commit is contained in:
43
lib/providers/sync_notification_provider.dart
Normal file
43
lib/providers/sync_notification_provider.dart
Normal 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();
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user