Refine: Add real-time countdown timer and display settings to Pad Tracker

This commit is contained in:
2026-01-02 18:17:23 -06:00
parent 8772b56f36
commit f54222d26a
4 changed files with 107 additions and 10 deletions

View File

@@ -256,6 +256,12 @@ class UserProfile extends HiveObject {
@HiveField(37, defaultValue: true)
bool notifyLowSupply;
@HiveField(39, defaultValue: true)
bool showPadTimerMinutes;
@HiveField(40, defaultValue: false)
bool showPadTimerSeconds;
UserProfile({
required this.id,
required this.name,
@@ -295,6 +301,8 @@ class UserProfile extends HiveObject {
this.notifyLowSupply = true,
this.lastPadChangeTime,
this.padSupplies,
this.showPadTimerMinutes = true,
this.showPadTimerSeconds = false,
});
/// Check if user is married
@@ -359,6 +367,8 @@ class UserProfile extends HiveObject {
bool? notifyLowSupply,
DateTime? lastPadChangeTime,
List<SupplyItem>? padSupplies,
bool? showPadTimerMinutes,
bool? showPadTimerSeconds,
}) {
return UserProfile(
id: id ?? this.id,
@@ -400,6 +410,8 @@ class UserProfile extends HiveObject {
notifyLowSupply: notifyLowSupply ?? this.notifyLowSupply,
lastPadChangeTime: lastPadChangeTime ?? this.lastPadChangeTime,
padSupplies: padSupplies ?? this.padSupplies,
showPadTimerMinutes: showPadTimerMinutes ?? this.showPadTimerMinutes,
showPadTimerSeconds: showPadTimerSeconds ?? this.showPadTimerSeconds,
);
}
}

View File

@@ -103,13 +103,15 @@ class UserProfileAdapter extends TypeAdapter<UserProfile> {
notifyLowSupply: fields[37] == null ? true : fields[37] as bool,
lastPadChangeTime: fields[7] as DateTime?,
padSupplies: (fields[38] as List?)?.cast<SupplyItem>(),
showPadTimerMinutes: fields[39] == null ? true : fields[39] as bool,
showPadTimerSeconds: fields[40] == null ? false : fields[40] as bool,
);
}
@override
void write(BinaryWriter writer, UserProfile obj) {
writer
..writeByte(38)
..writeByte(40)
..writeByte(0)
..write(obj.id)
..writeByte(1)
@@ -185,7 +187,11 @@ class UserProfileAdapter extends TypeAdapter<UserProfile> {
..writeByte(36)
..write(obj.notifyPeriodStart)
..writeByte(37)
..write(obj.notifyLowSupply);
..write(obj.notifyLowSupply)
..writeByte(39)
..write(obj.showPadTimerMinutes)
..writeByte(40)
..write(obj.showPadTimerSeconds);
}
@override