Refactor: Implement multi-item inventory for Pad Tracker and dynamic navigation

This commit is contained in:
2026-01-02 18:10:50 -06:00
parent 56683f5407
commit 8772b56f36
44 changed files with 3515 additions and 781 deletions

View File

@@ -56,6 +56,86 @@ enum AppThemeMode {
dark,
}
@HiveType(typeId: 13)
enum PadType {
@HiveField(0)
pantyLiner,
@HiveField(1)
regular,
@HiveField(2)
super_pad,
@HiveField(3)
overnight,
@HiveField(4)
tampon_regular,
@HiveField(5)
tampon_super,
@HiveField(6)
menstrualCup,
@HiveField(7)
menstrualDisc,
@HiveField(8)
periodUnderwear,
}
extension PadTypeExtension on PadType {
String get label {
switch (this) {
case PadType.pantyLiner:
return 'Liner';
case PadType.regular:
return 'Regular Pad';
case PadType.super_pad:
return 'Super Pad';
case PadType.overnight:
return 'Overnight';
case PadType.tampon_regular:
return 'Tampon (Regular)';
case PadType.tampon_super:
return 'Tampon (Super)';
case PadType.menstrualCup:
return 'Cup';
case PadType.menstrualDisc:
return 'Disc';
case PadType.periodUnderwear:
return 'Period Underwear';
}
}
}
@HiveType(typeId: 12)
class SupplyItem extends HiveObject {
@HiveField(0)
String brand;
@HiveField(1)
PadType type;
@HiveField(2)
int absorbency; // 1-5
@HiveField(3)
int count;
SupplyItem({
required this.brand,
required this.type,
required this.absorbency,
required this.count,
});
SupplyItem copyWith({
String? brand,
PadType? type,
int? absorbency,
int? count,
}) {
return SupplyItem(
brand: brand ?? this.brand,
type: type ?? this.type,
absorbency: absorbency ?? this.absorbency,
count: count ?? this.count,
);
}
}
/// User profile model
@HiveType(typeId: 2)
class UserProfile extends HiveObject {
@@ -65,28 +145,28 @@ class UserProfile extends HiveObject {
@HiveField(1)
String name;
@HiveField(2)
@HiveField(2, defaultValue: RelationshipStatus.single)
RelationshipStatus relationshipStatus;
@HiveField(3)
FertilityGoal? fertilityGoal;
@HiveField(4)
@HiveField(4, defaultValue: 28)
int averageCycleLength;
@HiveField(5)
@HiveField(5, defaultValue: 5)
int averagePeriodLength;
@HiveField(6)
DateTime? lastPeriodStartDate;
@HiveField(7)
DateTime? lastPadChangeTime;
@HiveField(8, defaultValue: true)
bool notificationsEnabled;
@HiveField(8)
String? devotionalTime; // HH:mm format
@HiveField(9)
@HiveField(9, defaultValue: false)
bool hasCompletedOnboarding;
@HiveField(10)
@@ -138,6 +218,44 @@ class UserProfile extends HiveObject {
@HiveField(26, defaultValue: true)
bool shareIntimacy;
// Pad Tracking
@HiveField(27, defaultValue: false)
bool isPadTrackingEnabled;
@HiveField(28)
int? typicalFlowIntensity; // 1-5
@HiveField(29)
String? padBrand;
@HiveField(30)
int? padAbsorbency; // 1-5 scale
@HiveField(31, defaultValue: 0)
int padInventoryCount;
@HiveField(32, defaultValue: 5)
int lowInventoryThreshold;
@HiveField(33, defaultValue: true)
bool isAutoInventoryEnabled;
@HiveField(34)
DateTime? lastInventoryUpdate;
@HiveField(38)
List<SupplyItem>? padSupplies;
// Granular Notification Settings
@HiveField(35, defaultValue: true)
bool notifyPeriodEstimate;
@HiveField(36, defaultValue: true)
bool notifyPeriodStart;
@HiveField(37, defaultValue: true)
bool notifyLowSupply;
UserProfile({
required this.id,
required this.name,
@@ -147,7 +265,6 @@ class UserProfile extends HiveObject {
this.averagePeriodLength = 5,
this.lastPeriodStartDate,
this.notificationsEnabled = true,
this.devotionalTime,
this.hasCompletedOnboarding = false,
required this.createdAt,
required this.updatedAt,
@@ -165,6 +282,19 @@ class UserProfile extends HiveObject {
this.shareEnergyLevels = true,
this.shareSleep = true,
this.shareIntimacy = true,
this.isPadTrackingEnabled = false,
this.typicalFlowIntensity,
this.padBrand,
this.padAbsorbency,
this.padInventoryCount = 0,
this.lowInventoryThreshold = 5,
this.isAutoInventoryEnabled = true,
this.lastInventoryUpdate,
this.notifyPeriodEstimate = true,
this.notifyPeriodStart = true,
this.notifyLowSupply = true,
this.lastPadChangeTime,
this.padSupplies,
});
/// Check if user is married
@@ -199,7 +329,6 @@ class UserProfile extends HiveObject {
int? averagePeriodLength,
DateTime? lastPeriodStartDate,
bool? notificationsEnabled,
String? devotionalTime,
bool? hasCompletedOnboarding,
DateTime? createdAt,
DateTime? updatedAt,
@@ -217,6 +346,19 @@ class UserProfile extends HiveObject {
bool? shareEnergyLevels,
bool? shareSleep,
bool? shareIntimacy,
bool? isPadTrackingEnabled,
int? typicalFlowIntensity,
String? padBrand,
int? padAbsorbency,
int? padInventoryCount,
int? lowInventoryThreshold,
bool? isAutoInventoryEnabled,
DateTime? lastInventoryUpdate,
bool? notifyPeriodEstimate,
bool? notifyPeriodStart,
bool? notifyLowSupply,
DateTime? lastPadChangeTime,
List<SupplyItem>? padSupplies,
}) {
return UserProfile(
id: id ?? this.id,
@@ -227,7 +369,6 @@ class UserProfile extends HiveObject {
averagePeriodLength: averagePeriodLength ?? this.averagePeriodLength,
lastPeriodStartDate: lastPeriodStartDate ?? this.lastPeriodStartDate,
notificationsEnabled: notificationsEnabled ?? this.notificationsEnabled,
devotionalTime: devotionalTime ?? this.devotionalTime,
hasCompletedOnboarding:
hasCompletedOnboarding ?? this.hasCompletedOnboarding,
createdAt: createdAt ?? this.createdAt,
@@ -246,6 +387,19 @@ class UserProfile extends HiveObject {
shareEnergyLevels: shareEnergyLevels ?? this.shareEnergyLevels,
shareSleep: shareSleep ?? this.shareSleep,
shareIntimacy: shareIntimacy ?? this.shareIntimacy,
isPadTrackingEnabled: isPadTrackingEnabled ?? this.isPadTrackingEnabled,
typicalFlowIntensity: typicalFlowIntensity ?? this.typicalFlowIntensity,
padBrand: padBrand ?? this.padBrand,
padAbsorbency: padAbsorbency ?? this.padAbsorbency,
padInventoryCount: padInventoryCount ?? this.padInventoryCount,
lowInventoryThreshold: lowInventoryThreshold ?? this.lowInventoryThreshold,
isAutoInventoryEnabled: isAutoInventoryEnabled ?? this.isAutoInventoryEnabled,
lastInventoryUpdate: lastInventoryUpdate ?? this.lastInventoryUpdate,
notifyPeriodEstimate: notifyPeriodEstimate ?? this.notifyPeriodEstimate,
notifyPeriodStart: notifyPeriodStart ?? this.notifyPeriodStart,
notifyLowSupply: notifyLowSupply ?? this.notifyLowSupply,
lastPadChangeTime: lastPadChangeTime ?? this.lastPadChangeTime,
padSupplies: padSupplies ?? this.padSupplies,
);
}
}