import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:google_fonts/google_fonts.dart'; <<<<<<< HEAD import 'package:hive_flutter/hive_flutter.dart'; ======= >>>>>>> 6742220 (Your commit message here) import '../../theme/app_theme.dart'; import '../../models/user_profile.dart'; import '../../models/cycle_entry.dart'; import '../../models/scripture.dart'; import '../calendar/calendar_screen.dart'; import '../log/log_screen.dart'; import '../devotional/devotional_screen.dart'; import '../../widgets/tip_card.dart'; import '../../widgets/cycle_ring.dart'; import '../../widgets/scripture_card.dart'; import '../../widgets/quick_log_buttons.dart'; import '../../providers/user_provider.dart'; <<<<<<< HEAD import '../../services/cycle_service.dart'; class HomeScreen extends ConsumerStatefulWidget { const HomeScreen({super.key}); @override ConsumerState createState() => _HomeScreenState(); } class _HomeScreenState extends ConsumerState { int _selectedIndex = 0; @override Widget build(BuildContext context) { return Scaffold( body: IndexedStack( index: _selectedIndex, ======= import '../../providers/navigation_provider.dart'; import '../../services/cycle_service.dart'; import '../../services/bible_utils.dart'; class HomeScreen extends ConsumerWidget { const HomeScreen({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { final selectedIndex = ref.watch(navigationProvider); return Scaffold( body: IndexedStack( index: selectedIndex, >>>>>>> 6742220 (Your commit message here) children: [ const _DashboardTab(), const CalendarScreen(), const LogScreen(), const DevotionalScreen(), <<<<<<< HEAD _SettingsTab(onReset: () => setState(() => _selectedIndex = 0)), ======= _SettingsTab(onReset: () => ref.read(navigationProvider.notifier).setIndex(0)), >>>>>>> 6742220 (Your commit message here) ], ), bottomNavigationBar: Container( decoration: BoxDecoration( <<<<<<< HEAD color: Colors.white, boxShadow: [ BoxShadow( color: AppColors.charcoal.withOpacity(0.1), ======= color: Theme.of(context).bottomNavigationBarTheme.backgroundColor, boxShadow: [ BoxShadow( color: (Theme.of(context).brightness == Brightness.dark ? Colors.black : AppColors.charcoal).withOpacity(0.1), >>>>>>> 6742220 (Your commit message here) blurRadius: 10, offset: const Offset(0, -2), ), ], ), child: BottomNavigationBar( <<<<<<< HEAD currentIndex: _selectedIndex, onTap: (index) => setState(() => _selectedIndex = index), ======= currentIndex: selectedIndex, onTap: (index) => ref.read(navigationProvider.notifier).setIndex(index), >>>>>>> 6742220 (Your commit message here) items: const [ BottomNavigationBarItem( icon: Icon(Icons.home_outlined), activeIcon: Icon(Icons.home), label: 'Home', ), BottomNavigationBarItem( icon: Icon(Icons.calendar_today_outlined), activeIcon: Icon(Icons.calendar_today), label: 'Calendar', ), BottomNavigationBarItem( icon: Icon(Icons.add_circle_outline), activeIcon: Icon(Icons.add_circle), label: 'Log', ), BottomNavigationBarItem( icon: Icon(Icons.menu_book_outlined), activeIcon: Icon(Icons.menu_book), label: 'Devotional', ), BottomNavigationBarItem( icon: Icon(Icons.settings_outlined), activeIcon: Icon(Icons.settings), label: 'Settings', ), ], ), ), ); } } class _DashboardTab extends ConsumerWidget { const _DashboardTab(); @override Widget build(BuildContext context, WidgetRef ref) { <<<<<<< HEAD final user = ref.watch(userProfileProvider); final cycleInfo = ref.watch(currentCycleInfoProvider); final name = user?.name ?? 'Friend'; final phase = cycleInfo['phase'] as CyclePhase; final dayOfCycle = cycleInfo['dayOfCycle'] as int; final cycleLength = user?.averageCycleLength ?? 28; // Get scripture for current phase ======= final name = ref.watch(userProfileProvider.select((u) => u?.name)) ?? 'Friend'; final translation = ref.watch(userProfileProvider.select((u) => u?.bibleTranslation)) ?? BibleTranslation.esv; final role = ref.watch(userProfileProvider.select((u) => u?.role)) ?? UserRole.wife; final isMarried = ref.watch(userProfileProvider.select((u) => u?.isMarried)) ?? false; final averageCycleLength = ref.watch(userProfileProvider.select((u) => u?.averageCycleLength)) ?? 28; final cycleInfo = ref.watch(currentCycleInfoProvider); final phase = cycleInfo['phase'] as CyclePhase; final dayOfCycle = cycleInfo['dayOfCycle'] as int; >>>>>>> 6742220 (Your commit message here) final scripture = ScriptureDatabase.getScriptureForPhase(phase.name); return SafeArea( child: SingleChildScrollView( padding: const EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ <<<<<<< HEAD // Greeting _buildGreeting(name), const SizedBox(height: 24), // Cycle Ring Center( child: CycleRing( dayOfCycle: dayOfCycle, totalDays: cycleLength, phase: phase, ), ), const SizedBox(height: 24), // Scripture Card ScriptureCard( verse: scripture.verse, reference: scripture.reference, phase: phase, ), const SizedBox(height: 20), // Quick Log Buttons Text( 'Quick Log', style: GoogleFonts.outfit( fontSize: 18, fontWeight: FontWeight.w600, color: AppColors.charcoal, ======= _buildGreeting(context, name), const SizedBox(height: 24), Center( child: CycleRing( dayOfCycle: dayOfCycle, totalDays: averageCycleLength, phase: phase, ), ), const SizedBox(height: 32), ScriptureCard( verse: scripture.getVerse(translation), reference: scripture.reference, translation: translation.label, phase: phase, onTranslationTap: () => BibleUtils.showTranslationPicker(context, ref), ), const SizedBox(height: 24), Text( 'Quick Log', style: Theme.of(context).textTheme.titleLarge?.copyWith( fontSize: 18, fontWeight: FontWeight.w600, >>>>>>> 6742220 (Your commit message here) ), ), const SizedBox(height: 12), const QuickLogButtons(), <<<<<<< HEAD const SizedBox(height: 20), // Today's Tip - Only show if not just tracking or husband (though husband has own screen) if (user?.role == UserRole.wife) TipCard(phase: phase, isMarried: user?.isMarried ?? false), ======= const SizedBox(height: 24), if (role == UserRole.wife) TipCard(phase: phase, isMarried: isMarried), >>>>>>> 6742220 (Your commit message here) const SizedBox(height: 20), ], ), ), ); } <<<<<<< HEAD Widget _buildGreeting(String name) { ======= Widget _buildGreeting(BuildContext context, String name) { final theme = Theme.of(context); >>>>>>> 6742220 (Your commit message here) final hour = DateTime.now().hour; String greeting; if (hour < 12) { greeting = 'Good morning'; } else if (hour < 17) { greeting = 'Good afternoon'; } else { greeting = 'Good evening'; } return Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '$greeting,', style: GoogleFonts.outfit( fontSize: 16, <<<<<<< HEAD color: AppColors.warmGray, ======= color: theme.colorScheme.onSurfaceVariant, >>>>>>> 6742220 (Your commit message here) ), ), Text( name, <<<<<<< HEAD style: GoogleFonts.outfit( fontSize: 28, fontWeight: FontWeight.w600, color: AppColors.charcoal, ======= style: theme.textTheme.displaySmall?.copyWith( fontSize: 28, fontWeight: FontWeight.w600, color: theme.colorScheme.onSurface, >>>>>>> 6742220 (Your commit message here) ), ), ], ), ), Container( width: 48, height: 48, decoration: BoxDecoration( <<<<<<< HEAD color: AppColors.blushPink, borderRadius: BorderRadius.circular(12), ), child: const Icon( Icons.notifications_outlined, color: AppColors.rose, ======= color: theme.colorScheme.primaryContainer.withOpacity(0.5), borderRadius: BorderRadius.circular(12), ), child: Icon( Icons.notifications_outlined, color: theme.colorScheme.primary, >>>>>>> 6742220 (Your commit message here) ), ), ], ); } <<<<<<< HEAD // Placeholder _calculateCycleInfo removed as it's now in CycleService ======= >>>>>>> 6742220 (Your commit message here) } class _SettingsTab extends ConsumerWidget { final VoidCallback? onReset; const _SettingsTab({this.onReset}); Widget _buildSettingsTile(BuildContext context, IconData icon, String title, {VoidCallback? onTap}) { return ListTile( <<<<<<< HEAD leading: Icon(icon, color: AppColors.charcoal), title: Text( title, style: GoogleFonts.outfit( fontSize: 16, color: AppColors.charcoal, ), ), trailing: Icon(Icons.chevron_right, color: AppColors.lightGray), ======= leading: Icon(icon, color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8)), title: Text( title, style: Theme.of(context).textTheme.bodyLarge?.copyWith( fontSize: 16, ), ), trailing: const Icon(Icons.chevron_right, color: AppColors.lightGray), >>>>>>> 6742220 (Your commit message here) onTap: onTap ?? () { ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Settings coming soon!')), ); }, ); } Future _resetApp(BuildContext context, WidgetRef ref) async { final confirmed = await showDialog( context: context, builder: (context) => AlertDialog( title: const Text('Reset App?'), content: const Text('This will clear all data and return you to onboarding. Are you sure?'), actions: [ TextButton(onPressed: () => Navigator.pop(context, false), child: const Text('Cancel')), TextButton( onPressed: () => Navigator.pop(context, true), child: const Text('Reset', style: TextStyle(color: Colors.red)), ), ], ), ); if (confirmed == true) { await ref.read(userProfileProvider.notifier).clearProfile(); await ref.read(cycleEntriesProvider.notifier).clearEntries(); if (context.mounted) { onReset?.call(); Navigator.of(context).pushNamedAndRemoveUntil('/', (route) => false); } } } @override Widget build(BuildContext context, WidgetRef ref) { <<<<<<< HEAD final user = ref.watch(userProfileProvider); ======= final name = ref.watch(userProfileProvider.select((u) => u?.name)) ?? 'Guest'; final roleSymbol = ref.watch(userProfileProvider.select((u) => u?.role)) == UserRole.husband ? 'HUSBAND' : null; final relationshipStatus = ref.watch(userProfileProvider.select((u) => u?.relationshipStatus.name.toUpperCase())) ?? 'SINGLE'; final translationLabel = ref.watch(userProfileProvider.select((u) => u?.bibleTranslation.label)) ?? 'ESV'; >>>>>>> 6742220 (Your commit message here) return SafeArea( child: SingleChildScrollView( padding: const EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Settings', <<<<<<< HEAD style: GoogleFonts.outfit( fontSize: 28, fontWeight: FontWeight.w600, color: AppColors.charcoal, ======= style: Theme.of(context).textTheme.displayMedium?.copyWith( fontSize: 28, fontWeight: FontWeight.w600, color: Theme.of(context).colorScheme.onSurface, >>>>>>> 6742220 (Your commit message here) ), ), const SizedBox(height: 24), <<<<<<< HEAD // Profile Card Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: AppColors.charcoal.withOpacity(0.05), blurRadius: 10, offset: const Offset(0, 4), ), ], ======= Container( padding: const EdgeInsets.all(20), decoration: BoxDecoration( color: Theme.of(context).cardTheme.color, borderRadius: BorderRadius.circular(16), border: Border.all(color: Theme.of(context).colorScheme.outline.withOpacity(0.05)), >>>>>>> 6742220 (Your commit message here) ), child: Row( children: [ Container( width: 60, height: 60, decoration: BoxDecoration( gradient: LinearGradient( colors: [AppColors.blushPink, AppColors.rose.withOpacity(0.7)], begin: Alignment.topLeft, end: Alignment.bottomRight, ), borderRadius: BorderRadius.circular(16), ), child: Center( child: Text( <<<<<<< HEAD user?.name.isNotEmpty == true ? user!.name[0].toUpperCase() : '?', ======= name.isNotEmpty ? name[0].toUpperCase() : '?', >>>>>>> 6742220 (Your commit message here) style: GoogleFonts.outfit( fontSize: 24, fontWeight: FontWeight.w600, color: Colors.white, ), ), ), ), const SizedBox(width: 16), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( <<<<<<< HEAD user?.name ?? 'Guest', style: GoogleFonts.outfit( fontSize: 18, fontWeight: FontWeight.w600, color: AppColors.charcoal, ), ), Text( user?.role == UserRole.husband ? 'HUSBAND' : (user?.relationshipStatus.name.toUpperCase() ?? 'SINGLE'), ======= name, style: Theme.of(context).textTheme.titleLarge?.copyWith( fontSize: 18, fontWeight: FontWeight.w600, ), ), Text( roleSymbol ?? relationshipStatus, >>>>>>> 6742220 (Your commit message here) style: GoogleFonts.outfit( fontSize: 12, letterSpacing: 1, color: AppColors.warmGray, ), ), ], ), ), <<<<<<< HEAD Icon(Icons.chevron_right, color: AppColors.warmGray), ======= const Icon(Icons.chevron_right, color: AppColors.warmGray), >>>>>>> 6742220 (Your commit message here) ], ), ), const SizedBox(height: 24), <<<<<<< HEAD // Settings Groups _buildSettingsGroup('Preferences', [ _buildSettingsTile(context, Icons.notifications_outlined, 'Notifications'), ======= _buildSettingsGroup(context, 'Preferences', [ _buildSettingsTile(context, Icons.notifications_outlined, 'Notifications'), _buildSettingsTile( context, Icons.book_outlined, 'Bible Version ($translationLabel)', onTap: () => BibleUtils.showTranslationPicker(context, ref), ), >>>>>>> 6742220 (Your commit message here) _buildSettingsTile(context, Icons.palette_outlined, 'Appearance'), _buildSettingsTile(context, Icons.lock_outline, 'Privacy'), ]), const SizedBox(height: 16), <<<<<<< HEAD _buildSettingsGroup('Cycle', [ ======= _buildSettingsGroup(context, 'Cycle', [ >>>>>>> 6742220 (Your commit message here) _buildSettingsTile(context, Icons.calendar_today_outlined, 'Cycle Settings'), _buildSettingsTile(context, Icons.trending_up_outlined, 'Cycle History'), _buildSettingsTile(context, Icons.download_outlined, 'Export Data'), ]), const SizedBox(height: 16), <<<<<<< HEAD _buildSettingsGroup('Account', [ ======= _buildSettingsGroup(context, 'Account', [ >>>>>>> 6742220 (Your commit message here) _buildSettingsTile( context, Icons.logout, 'Reset App / Logout', onTap: () => _resetApp(context, ref) ), ]), const SizedBox(height: 16), ], ), ), ); } <<<<<<< HEAD Widget _buildSettingsGroup(String title, List tiles) { ======= Widget _buildSettingsGroup(BuildContext context, String title, List tiles) { >>>>>>> 6742220 (Your commit message here) 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( <<<<<<< HEAD color: Colors.white, borderRadius: BorderRadius.circular(12), ======= color: Theme.of(context).cardTheme.color, borderRadius: BorderRadius.circular(12), border: Border.all(color: Theme.of(context).colorScheme.outline.withOpacity(0.05)), >>>>>>> 6742220 (Your commit message here) ), child: Column( children: tiles, ), ), ], ); } } <<<<<<< HEAD ======= >>>>>>> 6742220 (Your commit message here)