Initial commit: Fixes for linting and compilation
This commit is contained in:
335
lib/models/cycle_entry.dart
Normal file
335
lib/models/cycle_entry.dart
Normal file
@@ -0,0 +1,335 @@
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'cycle_entry.g.dart';
|
||||
|
||||
/// Mood levels for tracking
|
||||
@HiveType(typeId: 3)
|
||||
enum MoodLevel {
|
||||
@HiveField(0)
|
||||
verySad,
|
||||
|
||||
@HiveField(1)
|
||||
sad,
|
||||
|
||||
@HiveField(2)
|
||||
neutral,
|
||||
|
||||
@HiveField(3)
|
||||
happy,
|
||||
|
||||
@HiveField(4)
|
||||
veryHappy,
|
||||
}
|
||||
|
||||
/// Flow intensity for period days
|
||||
@HiveType(typeId: 4)
|
||||
enum FlowIntensity {
|
||||
@HiveField(0)
|
||||
spotting,
|
||||
|
||||
@HiveField(1)
|
||||
light,
|
||||
|
||||
@HiveField(2)
|
||||
medium,
|
||||
|
||||
@HiveField(3)
|
||||
heavy,
|
||||
}
|
||||
|
||||
/// Cervical mucus type for NFP tracking
|
||||
@HiveType(typeId: 5)
|
||||
enum CervicalMucusType {
|
||||
@HiveField(0)
|
||||
dry,
|
||||
|
||||
@HiveField(1)
|
||||
sticky,
|
||||
|
||||
@HiveField(2)
|
||||
creamy,
|
||||
|
||||
@HiveField(3)
|
||||
eggWhite,
|
||||
|
||||
@HiveField(4)
|
||||
watery,
|
||||
}
|
||||
|
||||
/// Cycle phase
|
||||
@HiveType(typeId: 6)
|
||||
enum CyclePhase {
|
||||
@HiveField(0)
|
||||
menstrual,
|
||||
|
||||
@HiveField(1)
|
||||
follicular,
|
||||
|
||||
@HiveField(2)
|
||||
ovulation,
|
||||
|
||||
@HiveField(3)
|
||||
luteal,
|
||||
}
|
||||
|
||||
/// Daily cycle entry
|
||||
@HiveType(typeId: 7)
|
||||
class CycleEntry extends HiveObject {
|
||||
@HiveField(0)
|
||||
String id;
|
||||
|
||||
@HiveField(1)
|
||||
DateTime date;
|
||||
|
||||
@HiveField(2)
|
||||
bool isPeriodDay;
|
||||
|
||||
@HiveField(3)
|
||||
FlowIntensity? flowIntensity;
|
||||
|
||||
@HiveField(4)
|
||||
MoodLevel? mood;
|
||||
|
||||
@HiveField(5)
|
||||
int? energyLevel; // 1-5
|
||||
|
||||
@HiveField(6)
|
||||
int? crampIntensity; // 1-5
|
||||
|
||||
@HiveField(7)
|
||||
bool hasHeadache;
|
||||
|
||||
@HiveField(8)
|
||||
bool hasBloating;
|
||||
|
||||
@HiveField(9)
|
||||
bool hasBreastTenderness;
|
||||
|
||||
@HiveField(10)
|
||||
bool hasFatigue;
|
||||
|
||||
@HiveField(11)
|
||||
bool hasAcne;
|
||||
|
||||
@HiveField(12)
|
||||
double? basalBodyTemperature; // in Fahrenheit
|
||||
|
||||
@HiveField(13)
|
||||
CervicalMucusType? cervicalMucus;
|
||||
|
||||
@HiveField(14)
|
||||
bool? ovulationTestPositive;
|
||||
|
||||
@HiveField(15)
|
||||
String? notes;
|
||||
|
||||
@HiveField(16)
|
||||
int? sleepHours;
|
||||
|
||||
@HiveField(17)
|
||||
int? waterIntake; // glasses
|
||||
|
||||
@HiveField(18)
|
||||
bool hadExercise;
|
||||
|
||||
@HiveField(19)
|
||||
bool hadIntimacy; // For married users only
|
||||
|
||||
@HiveField(20)
|
||||
DateTime createdAt;
|
||||
|
||||
@HiveField(21)
|
||||
DateTime updatedAt;
|
||||
|
||||
CycleEntry({
|
||||
required this.id,
|
||||
required this.date,
|
||||
this.isPeriodDay = false,
|
||||
this.flowIntensity,
|
||||
this.mood,
|
||||
this.energyLevel,
|
||||
this.crampIntensity,
|
||||
this.hasHeadache = false,
|
||||
this.hasBloating = false,
|
||||
this.hasBreastTenderness = false,
|
||||
this.hasFatigue = false,
|
||||
this.hasAcne = false,
|
||||
this.basalBodyTemperature,
|
||||
this.cervicalMucus,
|
||||
this.ovulationTestPositive,
|
||||
this.notes,
|
||||
this.sleepHours,
|
||||
this.waterIntake,
|
||||
this.hadExercise = false,
|
||||
this.hadIntimacy = false,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
/// Check if any symptoms are logged
|
||||
bool get hasSymptoms =>
|
||||
hasHeadache ||
|
||||
hasBloating ||
|
||||
hasBreastTenderness ||
|
||||
hasFatigue ||
|
||||
hasAcne ||
|
||||
(crampIntensity != null && crampIntensity! > 0);
|
||||
|
||||
/// Check if NFP data is logged
|
||||
bool get hasNFPData =>
|
||||
basalBodyTemperature != null ||
|
||||
cervicalMucus != null ||
|
||||
ovulationTestPositive != null;
|
||||
|
||||
/// Get symptom count
|
||||
int get symptomCount {
|
||||
int count = 0;
|
||||
if (hasHeadache) count++;
|
||||
if (hasBloating) count++;
|
||||
if (hasBreastTenderness) count++;
|
||||
if (hasFatigue) count++;
|
||||
if (hasAcne) count++;
|
||||
if (crampIntensity != null && crampIntensity! > 0) count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
/// Copy with updated fields
|
||||
CycleEntry copyWith({
|
||||
String? id,
|
||||
DateTime? date,
|
||||
bool? isPeriodDay,
|
||||
FlowIntensity? flowIntensity,
|
||||
MoodLevel? mood,
|
||||
int? energyLevel,
|
||||
int? crampIntensity,
|
||||
bool? hasHeadache,
|
||||
bool? hasBloating,
|
||||
bool? hasBreastTenderness,
|
||||
bool? hasFatigue,
|
||||
bool? hasAcne,
|
||||
double? basalBodyTemperature,
|
||||
CervicalMucusType? cervicalMucus,
|
||||
bool? ovulationTestPositive,
|
||||
String? notes,
|
||||
int? sleepHours,
|
||||
int? waterIntake,
|
||||
bool? hadExercise,
|
||||
bool? hadIntimacy,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) {
|
||||
return CycleEntry(
|
||||
id: id ?? this.id,
|
||||
date: date ?? this.date,
|
||||
isPeriodDay: isPeriodDay ?? this.isPeriodDay,
|
||||
flowIntensity: flowIntensity ?? this.flowIntensity,
|
||||
mood: mood ?? this.mood,
|
||||
energyLevel: energyLevel ?? this.energyLevel,
|
||||
crampIntensity: crampIntensity ?? this.crampIntensity,
|
||||
hasHeadache: hasHeadache ?? this.hasHeadache,
|
||||
hasBloating: hasBloating ?? this.hasBloating,
|
||||
hasBreastTenderness: hasBreastTenderness ?? this.hasBreastTenderness,
|
||||
hasFatigue: hasFatigue ?? this.hasFatigue,
|
||||
hasAcne: hasAcne ?? this.hasAcne,
|
||||
basalBodyTemperature: basalBodyTemperature ?? this.basalBodyTemperature,
|
||||
cervicalMucus: cervicalMucus ?? this.cervicalMucus,
|
||||
ovulationTestPositive: ovulationTestPositive ?? this.ovulationTestPositive,
|
||||
notes: notes ?? this.notes,
|
||||
sleepHours: sleepHours ?? this.sleepHours,
|
||||
waterIntake: waterIntake ?? this.waterIntake,
|
||||
hadExercise: hadExercise ?? this.hadExercise,
|
||||
hadIntimacy: hadIntimacy ?? this.hadIntimacy,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? DateTime.now(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension to get display string for enums
|
||||
extension MoodLevelExtension on MoodLevel {
|
||||
String get emoji {
|
||||
switch (this) {
|
||||
case MoodLevel.verySad:
|
||||
return '😢';
|
||||
case MoodLevel.sad:
|
||||
return '😕';
|
||||
case MoodLevel.neutral:
|
||||
return '😐';
|
||||
case MoodLevel.happy:
|
||||
return '🙂';
|
||||
case MoodLevel.veryHappy:
|
||||
return '😄';
|
||||
}
|
||||
}
|
||||
|
||||
String get label {
|
||||
switch (this) {
|
||||
case MoodLevel.verySad:
|
||||
return 'Very Sad';
|
||||
case MoodLevel.sad:
|
||||
return 'Sad';
|
||||
case MoodLevel.neutral:
|
||||
return 'Neutral';
|
||||
case MoodLevel.happy:
|
||||
return 'Happy';
|
||||
case MoodLevel.veryHappy:
|
||||
return 'Very Happy';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension FlowIntensityExtension on FlowIntensity {
|
||||
String get label {
|
||||
switch (this) {
|
||||
case FlowIntensity.spotting:
|
||||
return 'Spotting';
|
||||
case FlowIntensity.light:
|
||||
return 'Light';
|
||||
case FlowIntensity.medium:
|
||||
return 'Medium';
|
||||
case FlowIntensity.heavy:
|
||||
return 'Heavy';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension CyclePhaseExtension on CyclePhase {
|
||||
String get label {
|
||||
switch (this) {
|
||||
case CyclePhase.menstrual:
|
||||
return 'Menstrual';
|
||||
case CyclePhase.follicular:
|
||||
return 'Follicular';
|
||||
case CyclePhase.ovulation:
|
||||
return 'Ovulation';
|
||||
case CyclePhase.luteal:
|
||||
return 'Luteal';
|
||||
}
|
||||
}
|
||||
|
||||
String get emoji {
|
||||
switch (this) {
|
||||
case CyclePhase.menstrual:
|
||||
return '🩸';
|
||||
case CyclePhase.follicular:
|
||||
return '🌱';
|
||||
case CyclePhase.ovulation:
|
||||
return '🌸';
|
||||
case CyclePhase.luteal:
|
||||
return '🌙';
|
||||
}
|
||||
}
|
||||
|
||||
String get description {
|
||||
switch (this) {
|
||||
case CyclePhase.menstrual:
|
||||
return 'A time for rest and reflection';
|
||||
case CyclePhase.follicular:
|
||||
return 'A time of renewal and energy';
|
||||
case CyclePhase.ovulation:
|
||||
return 'Peak fertility window';
|
||||
case CyclePhase.luteal:
|
||||
return 'A time for patience and self-care';
|
||||
}
|
||||
}
|
||||
}
|
||||
310
lib/models/cycle_entry.g.dart
Normal file
310
lib/models/cycle_entry.g.dart
Normal file
@@ -0,0 +1,310 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'cycle_entry.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class CycleEntryAdapter extends TypeAdapter<CycleEntry> {
|
||||
@override
|
||||
final int typeId = 7;
|
||||
|
||||
@override
|
||||
CycleEntry read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return CycleEntry(
|
||||
id: fields[0] as String,
|
||||
date: fields[1] as DateTime,
|
||||
isPeriodDay: fields[2] as bool,
|
||||
flowIntensity: fields[3] as FlowIntensity?,
|
||||
mood: fields[4] as MoodLevel?,
|
||||
energyLevel: fields[5] as int?,
|
||||
crampIntensity: fields[6] as int?,
|
||||
hasHeadache: fields[7] as bool,
|
||||
hasBloating: fields[8] as bool,
|
||||
hasBreastTenderness: fields[9] as bool,
|
||||
hasFatigue: fields[10] as bool,
|
||||
hasAcne: fields[11] as bool,
|
||||
basalBodyTemperature: fields[12] as double?,
|
||||
cervicalMucus: fields[13] as CervicalMucusType?,
|
||||
ovulationTestPositive: fields[14] as bool?,
|
||||
notes: fields[15] as String?,
|
||||
sleepHours: fields[16] as int?,
|
||||
waterIntake: fields[17] as int?,
|
||||
hadExercise: fields[18] as bool,
|
||||
hadIntimacy: fields[19] as bool,
|
||||
createdAt: fields[20] as DateTime,
|
||||
updatedAt: fields[21] as DateTime,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, CycleEntry obj) {
|
||||
writer
|
||||
..writeByte(22)
|
||||
..writeByte(0)
|
||||
..write(obj.id)
|
||||
..writeByte(1)
|
||||
..write(obj.date)
|
||||
..writeByte(2)
|
||||
..write(obj.isPeriodDay)
|
||||
..writeByte(3)
|
||||
..write(obj.flowIntensity)
|
||||
..writeByte(4)
|
||||
..write(obj.mood)
|
||||
..writeByte(5)
|
||||
..write(obj.energyLevel)
|
||||
..writeByte(6)
|
||||
..write(obj.crampIntensity)
|
||||
..writeByte(7)
|
||||
..write(obj.hasHeadache)
|
||||
..writeByte(8)
|
||||
..write(obj.hasBloating)
|
||||
..writeByte(9)
|
||||
..write(obj.hasBreastTenderness)
|
||||
..writeByte(10)
|
||||
..write(obj.hasFatigue)
|
||||
..writeByte(11)
|
||||
..write(obj.hasAcne)
|
||||
..writeByte(12)
|
||||
..write(obj.basalBodyTemperature)
|
||||
..writeByte(13)
|
||||
..write(obj.cervicalMucus)
|
||||
..writeByte(14)
|
||||
..write(obj.ovulationTestPositive)
|
||||
..writeByte(15)
|
||||
..write(obj.notes)
|
||||
..writeByte(16)
|
||||
..write(obj.sleepHours)
|
||||
..writeByte(17)
|
||||
..write(obj.waterIntake)
|
||||
..writeByte(18)
|
||||
..write(obj.hadExercise)
|
||||
..writeByte(19)
|
||||
..write(obj.hadIntimacy)
|
||||
..writeByte(20)
|
||||
..write(obj.createdAt)
|
||||
..writeByte(21)
|
||||
..write(obj.updatedAt);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is CycleEntryAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class MoodLevelAdapter extends TypeAdapter<MoodLevel> {
|
||||
@override
|
||||
final int typeId = 3;
|
||||
|
||||
@override
|
||||
MoodLevel read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return MoodLevel.verySad;
|
||||
case 1:
|
||||
return MoodLevel.sad;
|
||||
case 2:
|
||||
return MoodLevel.neutral;
|
||||
case 3:
|
||||
return MoodLevel.happy;
|
||||
case 4:
|
||||
return MoodLevel.veryHappy;
|
||||
default:
|
||||
return MoodLevel.verySad;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, MoodLevel obj) {
|
||||
switch (obj) {
|
||||
case MoodLevel.verySad:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case MoodLevel.sad:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
case MoodLevel.neutral:
|
||||
writer.writeByte(2);
|
||||
break;
|
||||
case MoodLevel.happy:
|
||||
writer.writeByte(3);
|
||||
break;
|
||||
case MoodLevel.veryHappy:
|
||||
writer.writeByte(4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is MoodLevelAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class FlowIntensityAdapter extends TypeAdapter<FlowIntensity> {
|
||||
@override
|
||||
final int typeId = 4;
|
||||
|
||||
@override
|
||||
FlowIntensity read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return FlowIntensity.spotting;
|
||||
case 1:
|
||||
return FlowIntensity.light;
|
||||
case 2:
|
||||
return FlowIntensity.medium;
|
||||
case 3:
|
||||
return FlowIntensity.heavy;
|
||||
default:
|
||||
return FlowIntensity.spotting;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, FlowIntensity obj) {
|
||||
switch (obj) {
|
||||
case FlowIntensity.spotting:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case FlowIntensity.light:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
case FlowIntensity.medium:
|
||||
writer.writeByte(2);
|
||||
break;
|
||||
case FlowIntensity.heavy:
|
||||
writer.writeByte(3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FlowIntensityAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class CervicalMucusTypeAdapter extends TypeAdapter<CervicalMucusType> {
|
||||
@override
|
||||
final int typeId = 5;
|
||||
|
||||
@override
|
||||
CervicalMucusType read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return CervicalMucusType.dry;
|
||||
case 1:
|
||||
return CervicalMucusType.sticky;
|
||||
case 2:
|
||||
return CervicalMucusType.creamy;
|
||||
case 3:
|
||||
return CervicalMucusType.eggWhite;
|
||||
case 4:
|
||||
return CervicalMucusType.watery;
|
||||
default:
|
||||
return CervicalMucusType.dry;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, CervicalMucusType obj) {
|
||||
switch (obj) {
|
||||
case CervicalMucusType.dry:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case CervicalMucusType.sticky:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
case CervicalMucusType.creamy:
|
||||
writer.writeByte(2);
|
||||
break;
|
||||
case CervicalMucusType.eggWhite:
|
||||
writer.writeByte(3);
|
||||
break;
|
||||
case CervicalMucusType.watery:
|
||||
writer.writeByte(4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is CervicalMucusTypeAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class CyclePhaseAdapter extends TypeAdapter<CyclePhase> {
|
||||
@override
|
||||
final int typeId = 6;
|
||||
|
||||
@override
|
||||
CyclePhase read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return CyclePhase.menstrual;
|
||||
case 1:
|
||||
return CyclePhase.follicular;
|
||||
case 2:
|
||||
return CyclePhase.ovulation;
|
||||
case 3:
|
||||
return CyclePhase.luteal;
|
||||
default:
|
||||
return CyclePhase.menstrual;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, CyclePhase obj) {
|
||||
switch (obj) {
|
||||
case CyclePhase.menstrual:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case CyclePhase.follicular:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
case CyclePhase.ovulation:
|
||||
writer.writeByte(2);
|
||||
break;
|
||||
case CyclePhase.luteal:
|
||||
writer.writeByte(3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is CyclePhaseAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
235
lib/models/scripture.dart
Normal file
235
lib/models/scripture.dart
Normal file
@@ -0,0 +1,235 @@
|
||||
/// Scripture model for daily verses and devotionals
|
||||
class Scripture {
|
||||
final String verse;
|
||||
final String reference;
|
||||
final String? reflection;
|
||||
final List<String> applicablePhases;
|
||||
final List<String> applicableContexts;
|
||||
|
||||
const Scripture({
|
||||
required this.verse,
|
||||
required this.reference,
|
||||
this.reflection,
|
||||
this.applicablePhases = const [],
|
||||
this.applicableContexts = const [],
|
||||
});
|
||||
}
|
||||
|
||||
/// Pre-defined scriptures for the app
|
||||
class ScriptureDatabase {
|
||||
/// Scriptures for menstrual phase (rest, comfort)
|
||||
static const List<Scripture> menstrualScriptures = [
|
||||
Scripture(
|
||||
verse: "Come to me, all you who are weary and burdened, and I will give you rest.",
|
||||
reference: "Matthew 11:28",
|
||||
reflection: "Your body is doing important work. Rest is not weakness—it's wisdom.",
|
||||
applicablePhases: ['menstrual'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "He gives strength to the weary and increases the power of the weak.",
|
||||
reference: "Isaiah 40:29",
|
||||
applicablePhases: ['menstrual'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "The Lord is my shepherd; I shall not want. He makes me lie down in green pastures.",
|
||||
reference: "Psalm 23:1-2",
|
||||
applicablePhases: ['menstrual'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "Be still, and know that I am God.",
|
||||
reference: "Psalm 46:10",
|
||||
reflection: "Use this time of slowing down to be present with God.",
|
||||
applicablePhases: ['menstrual'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "My grace is sufficient for you, for my power is made perfect in weakness.",
|
||||
reference: "2 Corinthians 12:9",
|
||||
applicablePhases: ['menstrual'],
|
||||
),
|
||||
];
|
||||
|
||||
/// Scriptures for follicular phase (renewal, strength)
|
||||
static const List<Scripture> follicularScriptures = [
|
||||
Scripture(
|
||||
verse: "She is clothed with strength and dignity; she can laugh at the days to come.",
|
||||
reference: "Proverbs 31:25",
|
||||
reflection: "You're entering a season of renewed energy. Use it for His glory.",
|
||||
applicablePhases: ['follicular'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "I can do all this through him who gives me strength.",
|
||||
reference: "Philippians 4:13",
|
||||
applicablePhases: ['follicular'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "But those who hope in the Lord will renew their strength. They will soar on wings like eagles.",
|
||||
reference: "Isaiah 40:31",
|
||||
applicablePhases: ['follicular'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "This is the day the Lord has made; let us rejoice and be glad in it.",
|
||||
reference: "Psalm 118:24",
|
||||
applicablePhases: ['follicular'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "The Lord your God is with you, the Mighty Warrior who saves.",
|
||||
reference: "Zephaniah 3:17",
|
||||
applicablePhases: ['follicular'],
|
||||
),
|
||||
];
|
||||
|
||||
/// Scriptures for ovulation phase (creation, beauty)
|
||||
static const List<Scripture> ovulationScriptures = [
|
||||
Scripture(
|
||||
verse: "For you created my inmost being; you knit me together in my mother's womb. I praise you because I am fearfully and wonderfully made.",
|
||||
reference: "Psalm 139:13-14",
|
||||
reflection: "Your body reflects the incredible creativity of God.",
|
||||
applicablePhases: ['ovulation'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "Children are a heritage from the Lord, offspring a reward from him.",
|
||||
reference: "Psalm 127:3",
|
||||
applicablePhases: ['ovulation'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "See, I am doing a new thing! Now it springs up; do you not perceive it?",
|
||||
reference: "Isaiah 43:19",
|
||||
applicablePhases: ['ovulation'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "Every good and perfect gift is from above.",
|
||||
reference: "James 1:17",
|
||||
applicablePhases: ['ovulation'],
|
||||
),
|
||||
];
|
||||
|
||||
/// Scriptures for luteal phase / TWW (patience, trust)
|
||||
static const List<Scripture> lutealScriptures = [
|
||||
Scripture(
|
||||
verse: "For I know the plans I have for you, declares the Lord, plans to prosper you and not to harm you, plans to give you hope and a future.",
|
||||
reference: "Jeremiah 29:11",
|
||||
reflection: "Whatever this season holds, God's plans for you are good.",
|
||||
applicablePhases: ['luteal'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "Do not be anxious about anything, but in every situation, by prayer and petition, with thanksgiving, present your requests to God.",
|
||||
reference: "Philippians 4:6",
|
||||
applicablePhases: ['luteal'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "Trust in the Lord with all your heart and lean not on your own understanding.",
|
||||
reference: "Proverbs 3:5",
|
||||
applicablePhases: ['luteal'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "The Lord is close to the brokenhearted and saves those who are crushed in spirit.",
|
||||
reference: "Psalm 34:18",
|
||||
applicablePhases: ['luteal'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "And the peace of God, which transcends all understanding, will guard your hearts and your minds in Christ Jesus.",
|
||||
reference: "Philippians 4:7",
|
||||
applicablePhases: ['luteal'],
|
||||
),
|
||||
Scripture(
|
||||
verse: "Wait for the Lord; be strong and take heart and wait for the Lord.",
|
||||
reference: "Psalm 27:14",
|
||||
applicablePhases: ['luteal'],
|
||||
),
|
||||
];
|
||||
|
||||
/// Scriptures for husbands
|
||||
static const List<Scripture> husbandScriptures = [
|
||||
Scripture(
|
||||
verse: "Husbands, love your wives, just as Christ loved the church and gave himself up for her.",
|
||||
reference: "Ephesians 5:25",
|
||||
reflection: "Love sacrificially—putting her needs before your own.",
|
||||
),
|
||||
Scripture(
|
||||
verse: "Husbands, in the same way be considerate as you live with your wives, and treat them with respect.",
|
||||
reference: "1 Peter 3:7",
|
||||
),
|
||||
Scripture(
|
||||
verse: "Two are better than one, because they have a good return for their labor.",
|
||||
reference: "Ecclesiastes 4:9",
|
||||
),
|
||||
Scripture(
|
||||
verse: "Be completely humble and gentle; be patient, bearing with one another in love.",
|
||||
reference: "Ephesians 4:2",
|
||||
),
|
||||
Scripture(
|
||||
verse: "Above all, love each other deeply, because love covers over a multitude of sins.",
|
||||
reference: "1 Peter 4:8",
|
||||
),
|
||||
Scripture(
|
||||
verse: "A husband should fulfill his duty to his wife.",
|
||||
reference: "1 Corinthians 7:3",
|
||||
),
|
||||
Scripture(
|
||||
verse: "He who finds a wife finds what is good and receives favor from the Lord.",
|
||||
reference: "Proverbs 18:22",
|
||||
),
|
||||
];
|
||||
|
||||
/// General womanhood scriptures
|
||||
static const List<Scripture> womanhoodScriptures = [
|
||||
Scripture(
|
||||
verse: "Charm is deceptive, and beauty is fleeting; but a woman who fears the Lord is to be praised.",
|
||||
reference: "Proverbs 31:30",
|
||||
),
|
||||
Scripture(
|
||||
verse: "She opens her mouth with wisdom, and the teaching of kindness is on her tongue.",
|
||||
reference: "Proverbs 31:26",
|
||||
),
|
||||
Scripture(
|
||||
verse: "Your beauty should not come from outward adornment... Rather, it should be that of your inner self, the unfading beauty of a gentle and quiet spirit.",
|
||||
reference: "1 Peter 3:3-4",
|
||||
),
|
||||
Scripture(
|
||||
verse: "God is within her, she will not fall; God will help her at break of day.",
|
||||
reference: "Psalm 46:5",
|
||||
),
|
||||
];
|
||||
|
||||
/// Get scripture for current phase
|
||||
static Scripture getScriptureForPhase(String phase) {
|
||||
final List<Scripture> scriptures;
|
||||
switch (phase.toLowerCase()) {
|
||||
case 'menstrual':
|
||||
scriptures = menstrualScriptures;
|
||||
break;
|
||||
case 'follicular':
|
||||
scriptures = follicularScriptures;
|
||||
break;
|
||||
case 'ovulation':
|
||||
scriptures = ovulationScriptures;
|
||||
break;
|
||||
case 'luteal':
|
||||
scriptures = lutealScriptures;
|
||||
break;
|
||||
default:
|
||||
scriptures = [...menstrualScriptures, ...follicularScriptures, ...ovulationScriptures, ...lutealScriptures];
|
||||
}
|
||||
|
||||
// Return a scripture based on the day of year for variety
|
||||
final dayOfYear = DateTime.now().difference(DateTime(DateTime.now().year, 1, 1)).inDays;
|
||||
return scriptures[dayOfYear % scriptures.length];
|
||||
}
|
||||
|
||||
/// Get scripture for husband
|
||||
static Scripture getHusbandScripture() {
|
||||
final dayOfYear = DateTime.now().difference(DateTime(DateTime.now().year, 1, 1)).inDays;
|
||||
return husbandScriptures[dayOfYear % husbandScriptures.length];
|
||||
}
|
||||
|
||||
/// Get all scriptures
|
||||
static List<Scripture> getAllScriptures() {
|
||||
return [
|
||||
...menstrualScriptures,
|
||||
...follicularScriptures,
|
||||
...ovulationScriptures,
|
||||
...lutealScriptures,
|
||||
...womanhoodScriptures,
|
||||
];
|
||||
}
|
||||
}
|
||||
163
lib/models/user_profile.dart
Normal file
163
lib/models/user_profile.dart
Normal file
@@ -0,0 +1,163 @@
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'user_profile.g.dart';
|
||||
|
||||
/// User's relationship status
|
||||
@HiveType(typeId: 0)
|
||||
enum RelationshipStatus {
|
||||
@HiveField(0)
|
||||
single,
|
||||
|
||||
@HiveField(1)
|
||||
engaged,
|
||||
|
||||
@HiveField(2)
|
||||
married,
|
||||
}
|
||||
|
||||
/// Fertility tracking goal for married users
|
||||
@HiveType(typeId: 1)
|
||||
enum FertilityGoal {
|
||||
@HiveField(0)
|
||||
tryingToConceive, // TTC
|
||||
|
||||
@HiveField(1)
|
||||
tryingToAvoid, // TTA - NFP
|
||||
|
||||
@HiveField(2)
|
||||
justTracking,
|
||||
}
|
||||
|
||||
/// User profile model
|
||||
@HiveType(typeId: 2)
|
||||
class UserProfile extends HiveObject {
|
||||
@HiveField(0)
|
||||
String id;
|
||||
|
||||
@HiveField(1)
|
||||
String name;
|
||||
|
||||
@HiveField(2)
|
||||
RelationshipStatus relationshipStatus;
|
||||
|
||||
@HiveField(3)
|
||||
FertilityGoal? fertilityGoal;
|
||||
|
||||
@HiveField(4)
|
||||
int averageCycleLength;
|
||||
|
||||
@HiveField(5)
|
||||
int averagePeriodLength;
|
||||
|
||||
@HiveField(6)
|
||||
DateTime? lastPeriodStartDate;
|
||||
|
||||
@HiveField(7)
|
||||
bool notificationsEnabled;
|
||||
|
||||
@HiveField(8)
|
||||
String? devotionalTime; // HH:mm format
|
||||
|
||||
@HiveField(9)
|
||||
bool hasCompletedOnboarding;
|
||||
|
||||
@HiveField(10)
|
||||
DateTime createdAt;
|
||||
|
||||
@HiveField(11)
|
||||
DateTime updatedAt;
|
||||
|
||||
@HiveField(12)
|
||||
String? partnerName; // For married users
|
||||
|
||||
@HiveField(14, defaultValue: UserRole.wife)
|
||||
UserRole role;
|
||||
|
||||
@HiveField(15, defaultValue: false)
|
||||
bool isIrregularCycle;
|
||||
|
||||
UserProfile({
|
||||
required this.id,
|
||||
required this.name,
|
||||
this.relationshipStatus = RelationshipStatus.single,
|
||||
this.fertilityGoal,
|
||||
this.averageCycleLength = 28,
|
||||
this.averagePeriodLength = 5,
|
||||
this.lastPeriodStartDate,
|
||||
this.notificationsEnabled = true,
|
||||
this.devotionalTime,
|
||||
this.hasCompletedOnboarding = false,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.partnerName,
|
||||
|
||||
this.role = UserRole.wife,
|
||||
this.isIrregularCycle = false,
|
||||
});
|
||||
|
||||
/// Check if user is married
|
||||
bool get isMarried => relationshipStatus == RelationshipStatus.married;
|
||||
|
||||
/// Check if user is trying to conceive
|
||||
bool get isTTC => fertilityGoal == FertilityGoal.tryingToConceive;
|
||||
|
||||
/// Check if user is practicing NFP
|
||||
bool get isNFP => fertilityGoal == FertilityGoal.tryingToAvoid;
|
||||
|
||||
/// Check if user is husband
|
||||
bool get isHusband => role == UserRole.husband;
|
||||
|
||||
/// Should show fertility content
|
||||
bool get showFertilityContent =>
|
||||
!isHusband && isMarried && fertilityGoal != FertilityGoal.justTracking && fertilityGoal != null;
|
||||
|
||||
/// Should show intimacy recommendations
|
||||
bool get showIntimacyContent => isMarried;
|
||||
|
||||
/// Copy with updated fields
|
||||
UserProfile copyWith({
|
||||
String? id,
|
||||
String? name,
|
||||
RelationshipStatus? relationshipStatus,
|
||||
FertilityGoal? fertilityGoal,
|
||||
int? averageCycleLength,
|
||||
int? averagePeriodLength,
|
||||
DateTime? lastPeriodStartDate,
|
||||
bool? notificationsEnabled,
|
||||
String? devotionalTime,
|
||||
bool? hasCompletedOnboarding,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
String? partnerName,
|
||||
|
||||
UserRole? role,
|
||||
bool? isIrregularCycle,
|
||||
}) {
|
||||
return UserProfile(
|
||||
id: id ?? this.id,
|
||||
name: name ?? this.name,
|
||||
relationshipStatus: relationshipStatus ?? this.relationshipStatus,
|
||||
fertilityGoal: fertilityGoal ?? this.fertilityGoal,
|
||||
averageCycleLength: averageCycleLength ?? this.averageCycleLength,
|
||||
averagePeriodLength: averagePeriodLength ?? this.averagePeriodLength,
|
||||
lastPeriodStartDate: lastPeriodStartDate ?? this.lastPeriodStartDate,
|
||||
notificationsEnabled: notificationsEnabled ?? this.notificationsEnabled,
|
||||
devotionalTime: devotionalTime ?? this.devotionalTime,
|
||||
hasCompletedOnboarding: hasCompletedOnboarding ?? this.hasCompletedOnboarding,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? DateTime.now(),
|
||||
partnerName: partnerName ?? this.partnerName,
|
||||
|
||||
role: role ?? this.role,
|
||||
isIrregularCycle: isIrregularCycle ?? this.isIrregularCycle,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: 8)
|
||||
enum UserRole {
|
||||
@HiveField(0)
|
||||
wife,
|
||||
@HiveField(1)
|
||||
husband,
|
||||
}
|
||||
210
lib/models/user_profile.g.dart
Normal file
210
lib/models/user_profile.g.dart
Normal file
@@ -0,0 +1,210 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_profile.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class UserProfileAdapter extends TypeAdapter<UserProfile> {
|
||||
@override
|
||||
final int typeId = 2;
|
||||
|
||||
@override
|
||||
UserProfile read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return UserProfile(
|
||||
id: fields[0] as String,
|
||||
name: fields[1] as String,
|
||||
relationshipStatus: fields[2] as RelationshipStatus,
|
||||
fertilityGoal: fields[3] as FertilityGoal?,
|
||||
averageCycleLength: fields[4] as int,
|
||||
averagePeriodLength: fields[5] as int,
|
||||
lastPeriodStartDate: fields[6] as DateTime?,
|
||||
notificationsEnabled: fields[7] as bool,
|
||||
devotionalTime: fields[8] as String?,
|
||||
hasCompletedOnboarding: fields[9] as bool,
|
||||
createdAt: fields[10] as DateTime,
|
||||
updatedAt: fields[11] as DateTime,
|
||||
partnerName: fields[12] as String?,
|
||||
role: fields[14] == null ? UserRole.wife : fields[14] as UserRole,
|
||||
isIrregularCycle: fields[15] == null ? false : fields[15] as bool,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, UserProfile obj) {
|
||||
writer
|
||||
..writeByte(15)
|
||||
..writeByte(0)
|
||||
..write(obj.id)
|
||||
..writeByte(1)
|
||||
..write(obj.name)
|
||||
..writeByte(2)
|
||||
..write(obj.relationshipStatus)
|
||||
..writeByte(3)
|
||||
..write(obj.fertilityGoal)
|
||||
..writeByte(4)
|
||||
..write(obj.averageCycleLength)
|
||||
..writeByte(5)
|
||||
..write(obj.averagePeriodLength)
|
||||
..writeByte(6)
|
||||
..write(obj.lastPeriodStartDate)
|
||||
..writeByte(7)
|
||||
..write(obj.notificationsEnabled)
|
||||
..writeByte(8)
|
||||
..write(obj.devotionalTime)
|
||||
..writeByte(9)
|
||||
..write(obj.hasCompletedOnboarding)
|
||||
..writeByte(10)
|
||||
..write(obj.createdAt)
|
||||
..writeByte(11)
|
||||
..write(obj.updatedAt)
|
||||
..writeByte(12)
|
||||
..write(obj.partnerName)
|
||||
..writeByte(14)
|
||||
..write(obj.role)
|
||||
..writeByte(15)
|
||||
..write(obj.isIrregularCycle);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserProfileAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class RelationshipStatusAdapter extends TypeAdapter<RelationshipStatus> {
|
||||
@override
|
||||
final int typeId = 0;
|
||||
|
||||
@override
|
||||
RelationshipStatus read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return RelationshipStatus.single;
|
||||
case 1:
|
||||
return RelationshipStatus.engaged;
|
||||
case 2:
|
||||
return RelationshipStatus.married;
|
||||
default:
|
||||
return RelationshipStatus.single;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, RelationshipStatus obj) {
|
||||
switch (obj) {
|
||||
case RelationshipStatus.single:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case RelationshipStatus.engaged:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
case RelationshipStatus.married:
|
||||
writer.writeByte(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is RelationshipStatusAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class FertilityGoalAdapter extends TypeAdapter<FertilityGoal> {
|
||||
@override
|
||||
final int typeId = 1;
|
||||
|
||||
@override
|
||||
FertilityGoal read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return FertilityGoal.tryingToConceive;
|
||||
case 1:
|
||||
return FertilityGoal.tryingToAvoid;
|
||||
case 2:
|
||||
return FertilityGoal.justTracking;
|
||||
default:
|
||||
return FertilityGoal.tryingToConceive;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, FertilityGoal obj) {
|
||||
switch (obj) {
|
||||
case FertilityGoal.tryingToConceive:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case FertilityGoal.tryingToAvoid:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
case FertilityGoal.justTracking:
|
||||
writer.writeByte(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FertilityGoalAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class UserRoleAdapter extends TypeAdapter<UserRole> {
|
||||
@override
|
||||
final int typeId = 8;
|
||||
|
||||
@override
|
||||
UserRole read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return UserRole.wife;
|
||||
case 1:
|
||||
return UserRole.husband;
|
||||
default:
|
||||
return UserRole.wife;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, UserRole obj) {
|
||||
switch (obj) {
|
||||
case UserRole.wife:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case UserRole.husband:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserRoleAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
Reference in New Issue
Block a user