Implement husband-wife connection dialogue and theme support for learn articles

This commit is contained in:
2026-01-05 17:09:15 -06:00
parent 02d25d0cc7
commit 96655f9a74
36 changed files with 3849 additions and 819 deletions

View File

@@ -8,6 +8,7 @@ import '../../models/cycle_entry.dart';
import '../../theme/app_theme.dart';
import '../../widgets/scripture_card.dart';
import '../../models/user_profile.dart';
import '../../models/teaching_plan.dart';
import '../../providers/scripture_provider.dart'; // Import the new provider
class DevotionalScreen extends ConsumerStatefulWidget {
@@ -345,6 +346,15 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
),
const SizedBox(height: 24),
// Husband's Teaching Plan
if (user != null)
if (user.teachingPlans?.isNotEmpty ?? false)
_buildTeachingPlanCard(context, user.teachingPlans!)
else
_buildSampleTeachingCard(context),
const SizedBox(height: 24),
// Action buttons
Row(
children: [
@@ -424,12 +434,251 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
'Help me to serve with joy and purpose. Amen."';
case CyclePhase.ovulation:
return '"Creator God, I am fearfully and wonderfully made. '
'Thank You for the gift of womanhood. '
'Help me to honor You in all I do today. Amen."';
'Thank You for the gift of womanhood. '
'Help me to honor You in all I do today. Amen."';
case CyclePhase.luteal:
return '"Lord, I bring my anxious thoughts to You. '
'When my emotions feel overwhelming, remind me of Your peace. '
'Help me to be gentle with myself as You are gentle with me. Amen."';
'When my emotions feel overwhelming, remind me of Your peace. '
'Help me to be gentle with myself as You are gentle with me. Amen."';
}
}
Widget _buildTeachingPlanCard(BuildContext context, List<TeachingPlan> plans) {
// Get latest uncompleted plan or just latest
if (plans.isEmpty) return const SizedBox.shrink();
// Sort by date desc
final sorted = List<TeachingPlan>.from(plans)..sort((a,b) => b.date.compareTo(a.date));
final latestPlan = sorted.first;
return Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: AppColors.gold.withOpacity(0.5)),
boxShadow: [
BoxShadow(
color: AppColors.gold.withOpacity(0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.menu_book, color: AppColors.navyBlue),
const SizedBox(width: 8),
Expanded(
child: Text(
'Leading in the Word',
style: GoogleFonts.outfit(
fontSize: 16,
fontWeight: FontWeight.bold,
color: AppColors.navyBlue,
),
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: AppColors.gold.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Text(
'Husband\'s Sharing',
style: GoogleFonts.outfit(fontSize: 10, color: AppColors.gold, fontWeight: FontWeight.bold),
),
),
],
),
const SizedBox(height: 12),
Text(
latestPlan.topic,
style: GoogleFonts.outfit(
fontSize: 18,
fontWeight: FontWeight.w600,
color: AppColors.charcoal,
),
),
if (latestPlan.scriptureReference.isNotEmpty) ...[
const SizedBox(height: 4),
Text(
latestPlan.scriptureReference,
style: GoogleFonts.outfit(
fontSize: 14,
color: AppColors.gold,
fontWeight: FontWeight.w600,
),
),
],
const SizedBox(height: 8),
Text(
latestPlan.notes,
style: GoogleFonts.lora(
fontSize: 15,
height: 1.5,
color: AppColors.charcoal.withOpacity(0.9),
),
),
],
),
);
}
Widget _buildSampleTeachingCard(BuildContext context) {
return Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: AppColors.warmGray.withOpacity(0.3), style: BorderStyle.solid),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.menu_book, color: AppColors.warmGray),
const SizedBox(width: 12),
Expanded(
child: Text(
'Leading in the Word',
style: GoogleFonts.outfit(
fontSize: 16,
fontWeight: FontWeight.bold,
color: AppColors.warmGray,
),
),
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: AppColors.warmGray.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: Text(
'Sample',
style: GoogleFonts.outfit(fontSize: 10, color: AppColors.warmGray, fontWeight: FontWeight.bold),
),
),
],
),
const SizedBox(height: 12),
Text(
'Husband\'s Role in Leading',
style: GoogleFonts.outfit(
fontSize: 18,
fontWeight: FontWeight.w600,
color: AppColors.charcoal.withOpacity(0.7),
),
),
const SizedBox(height: 4),
Text(
'Ephesians 5:25',
style: GoogleFonts.outfit(
fontSize: 14,
color: AppColors.warmGray,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 8),
Text(
'This is a sample of where your husband\'s teaching plans will appear. Connect with his app to share spiritual growth together.',
style: GoogleFonts.lora(
fontSize: 15,
height: 1.5,
fontStyle: FontStyle.italic,
color: AppColors.charcoal.withOpacity(0.6),
),
),
const SizedBox(height: 16),
Center(
child: OutlinedButton.icon(
onPressed: () => _showShareDialog(context),
icon: const Icon(Icons.link, size: 18),
label: const Text('Connect with Husband'),
style: OutlinedButton.styleFrom(
foregroundColor: AppColors.navyBlue,
side: const BorderSide(color: AppColors.navyBlue),
),
),
),
],
),
);
}
void _showShareDialog(BuildContext context) {
// Generate a simple pairing code (in a real app, this would be stored/validated)
final userProfile = ref.read(userProfileProvider);
final pairingCode = userProfile?.id?.substring(0, 6).toUpperCase() ?? 'ABC123';
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Row(
children: [
Icon(Icons.share_outlined, color: AppColors.navyBlue),
const SizedBox(width: 8),
const Text('Share with Husband'),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Share this code with your husband so he can connect to your cycle data:',
style: GoogleFonts.outfit(fontSize: 14, color: AppColors.warmGray),
),
const SizedBox(height: 24),
Container(
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
decoration: BoxDecoration(
color: AppColors.navyBlue.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: AppColors.navyBlue.withOpacity(0.3)),
),
child: SelectableText(
pairingCode,
style: GoogleFonts.outfit(
fontSize: 32,
fontWeight: FontWeight.bold,
letterSpacing: 4,
color: AppColors.navyBlue,
),
),
),
const SizedBox(height: 16),
Text(
'He can enter this in his app under Settings > Connect with Wife.',
style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray),
textAlign: TextAlign.center,
),
],
),
actions: [
ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.navyBlue,
foregroundColor: Colors.white,
),
child: const Text('Done'),
),
],
),
);
}
}