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

@@ -100,7 +100,7 @@ class HusbandLearnScreen extends StatelessWidget {
context,
title: 'Safe Sexual Practices',
content: 'Use protection consistently to prevent sexually transmitted infections and maintain mutual health.',
icon: Icons.protect,
icon: Icons.security,
),
const SizedBox(height: 16),
_buildTipCard(

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:christian_period_tracker/models/scripture.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../theme/app_theme.dart';
import '../husband/learn_article_screen.dart';
class WifeLearnScreen extends StatelessWidget {
const WifeLearnScreen({super.key});
@@ -8,7 +10,7 @@ class WifeLearnScreen extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Reproductive Health Education'),
title: const Text('Reproductive Health'),
actions: [
IconButton(
icon: const Icon(Icons.bookmark),
@@ -17,185 +19,143 @@ class WifeLearnScreen extends StatelessWidget {
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildHealthTipsSection(context),
const SizedBox(height: 24),
_buildDiseasePreventionSection(context),
const SizedBox(height: 24),
_buildPracticalAdviceSection(context),
],
),
),
),
);
}
Widget _buildHealthTipsSection(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Reproductive Health Tips',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 16),
Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTipCard(
context,
title: 'Regular Medical Check-ups',
content: 'Schedule regular gynecological check-ups to monitor your reproductive health and catch any potential issues early.',
icon: Icons.medical_services,
),
const SizedBox(height: 16),
_buildTipCard(
context,
title: 'Healthy Lifestyle',
content: 'Maintain a balanced diet, exercise regularly, and get adequate sleep to support overall reproductive wellness.',
icon: Icons.healing,
),
const SizedBox(height: 16),
_buildTipCard(
context,
title: 'Stress Management',
content: 'Chronic stress can affect menstrual cycles and fertility. Practice mindfulness techniques and seek support when needed.',
icon: Icons.spa,
),
],
),
),
),
],
);
}
Widget _buildDiseasePreventionSection(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Disease Prevention Between Partners',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 16),
Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTipCard(
context,
title: 'Safe Sexual Practices',
content: 'Use protection consistently to prevent sexually transmitted infections and maintain mutual health.',
icon: Icons.protect,
),
const SizedBox(height: 16),
_buildTipCard(
context,
title: 'Regular Testing',
content: 'Schedule regular STI screenings together with your partner for early detection and treatment.',
icon: Icons.medical_information,
),
const SizedBox(height: 16),
_buildTipCard(
context,
title: 'Open Communication',
content: 'Discuss health concerns openly to ensure both partners understand each other\'s needs and maintain trust.',
icon: Icons.chat,
),
],
),
),
),
],
);
}
Widget _buildPracticalAdviceSection(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Practical Advice for Partnership',
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 16),
Card(
elevation: 2,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
child: Padding(
padding: const EdgeInsets.all(16.0),
children: [
_buildTipCard(
context,
title: 'Support System',
content: 'Build a support system that includes both your partner and trusted healthcare providers.',
icon: Icons.supervisor_account,
),
const SizedBox(height: 16),
_buildTipCard(
context,
title: 'Educate Together',
content: 'Both partners should educate themselves about reproductive health to make informed decisions together.',
icon: Icons.school,
),
],
),
),
],
);
}
Widget _buildTipCard(BuildContext context, {required String title, required String content, required IconData icon}) {
return Card(
elevation: 1,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
padding: const EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer.withOpacity(0.2),
shape: BoxShape.circle,
_buildSection(context, 'Understanding My Cycle', [
_LearnItem(
icon: Icons.loop,
title: 'The 4 Phases',
subtitle: 'What\'s happening in my body',
articleId: 'wife_cycle_phases',
),
child: Icon(icon, size: 24, color: Theme.of(context).colorScheme.primary),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold),
),
const SizedBox(height: 4),
Text(
content,
style: Theme.of(context).textTheme.bodyMedium,
),
],
_LearnItem(
icon: Icons.psychology_outlined,
title: 'Mood & Hormones',
subtitle: 'Why I feel different each week',
articleId: 'wife_mood_changes', // Reusing similar concept, maybe new article
),
),
]),
const SizedBox(height: 24),
_buildSection(context, 'Disease Prevention', [
_LearnItem(
icon: Icons.health_and_safety_outlined,
title: 'Preventing Infections',
subtitle: 'Hygiene and STI prevention',
articleId: 'wife_disease_prevention',
),
_LearnItem(
icon: Icons.medical_services_outlined,
title: 'Regular Screenings',
subtitle: 'What to check and when',
articleId: 'wife_screenings',
),
]),
const SizedBox(height: 24),
_buildSection(context, 'Partnership', [
_LearnItem(
icon: Icons.favorite_border,
title: 'Communication',
subtitle: 'Talking to him about my health',
articleId: 'wife_partnership_tips',
),
_LearnItem(
icon: Icons.handshake_outlined,
title: 'Shared Responsibility',
subtitle: 'Navigating fertility together',
articleId: 'wife_shared_responsibility',
),
]),
],
),
),
);
}
Widget _buildSection(BuildContext context, String title, List<_LearnItem> items) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: GoogleFonts.outfit(
fontSize: 14,
fontWeight: FontWeight.w500,
color: AppColors.warmGray,
letterSpacing: 0.5,
),
),
const SizedBox(height: 8),
Container(
decoration: BoxDecoration(
color: Theme.of(context).cardTheme.color,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: Theme.of(context).colorScheme.outline.withOpacity(0.05)),
),
child: Column(
children: items
.map((item) => ListTile(
leading: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer.withOpacity(0.2),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
item.icon,
color: Theme.of(context).colorScheme.primary,
size: 20,
),
),
title: Text(
item.title,
style: GoogleFonts.outfit(
fontSize: 15,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.onSurface,
),
),
subtitle: Text(
item.subtitle,
style: GoogleFonts.outfit(
fontSize: 13,
color: AppColors.warmGray,
),
),
trailing: const Icon(
Icons.chevron_right,
color: AppColors.lightGray,
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LearnArticleScreen(articleId: item.articleId),
),
);
},
))
.toList(),
),
),
],
);
}
}
class _LearnItem {
final IconData icon;
final String title;
final String subtitle;
final String articleId;
const _LearnItem({
required this.icon,
required this.title,
required this.subtitle,
required this.articleId,
});
}