Resolve all lints and deprecation warnings
This commit is contained in:
@@ -6,7 +6,6 @@ import 'package:table_calendar/table_calendar.dart';
|
||||
import '../../models/user_profile.dart';
|
||||
import '../../models/cycle_entry.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../services/cycle_service.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../log/log_screen.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
@@ -96,7 +95,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 15,
|
||||
offset: const Offset(0, 5),
|
||||
),
|
||||
@@ -134,7 +133,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
AppColors.charcoal,
|
||||
),
|
||||
todayDecoration: BoxDecoration(
|
||||
color: AppColors.sageGreen.withOpacity(0.3),
|
||||
color: AppColors.sageGreen.withValues(alpha: 0.3),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
todayTextStyle: GoogleFonts.outfit(
|
||||
@@ -303,7 +302,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.lightGray.withOpacity(0.5),
|
||||
color: AppColors.lightGray.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
@@ -332,7 +331,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
boxShadow: isSelected
|
||||
? [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
color: Colors.black.withValues(alpha: 0.1),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
)
|
||||
@@ -359,12 +358,12 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.blushPink.withOpacity(0.5),
|
||||
color: AppColors.blushPink.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, size: 16, color: AppColors.rose),
|
||||
const Icon(Icons.info_outline, size: 16, color: AppColors.rose),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Legend',
|
||||
@@ -451,7 +450,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -482,7 +481,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: _getPhaseColor(phase).withOpacity(0.15),
|
||||
color: _getPhaseColor(phase).withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
@@ -625,9 +624,10 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
margin: const EdgeInsets.only(top: 8),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.menstrualPhase.withOpacity(0.05),
|
||||
color: AppColors.menstrualPhase.withValues(alpha: 0.05),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.menstrualPhase.withOpacity(0.2)),
|
||||
border:
|
||||
Border.all(color: AppColors.menstrualPhase.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -703,9 +703,9 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.softGold.withOpacity(isDark ? 0.15 : 0.1),
|
||||
color: AppColors.softGold.withValues(alpha: isDark ? 0.15 : 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.softGold.withOpacity(0.3)),
|
||||
border: Border.all(color: AppColors.softGold.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -758,7 +758,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.1),
|
||||
color: color.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, color: color, size: 18),
|
||||
@@ -791,13 +791,24 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
|
||||
String _getSymptomsString(CycleEntry entry) {
|
||||
List<String> s = [];
|
||||
if (entry.crampIntensity != null && entry.crampIntensity! > 0)
|
||||
if (entry.crampIntensity != null && entry.crampIntensity! > 0) {
|
||||
s.add('Cramps (${entry.crampIntensity}/5)');
|
||||
if (entry.hasHeadache) s.add('Headache');
|
||||
if (entry.hasBloating) s.add('Bloating');
|
||||
if (entry.hasBreastTenderness) s.add('Breast Tenderness');
|
||||
if (entry.hasFatigue) s.add('Fatigue');
|
||||
if (entry.hasAcne) s.add('Acne');
|
||||
}
|
||||
if (entry.hasHeadache) {
|
||||
s.add('Headache');
|
||||
}
|
||||
if (entry.hasBloating) {
|
||||
s.add('Bloating');
|
||||
}
|
||||
if (entry.hasBreastTenderness) {
|
||||
s.add('Breast Tenderness');
|
||||
}
|
||||
if (entry.hasFatigue) {
|
||||
s.add('Fatigue');
|
||||
}
|
||||
if (entry.hasAcne) {
|
||||
s.add('Acne');
|
||||
}
|
||||
return s.join(', ');
|
||||
}
|
||||
|
||||
@@ -856,14 +867,9 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
return months[month - 1];
|
||||
}
|
||||
|
||||
bool _isLoggedPeriodDay(DateTime date, List<CycleEntry> entries) {
|
||||
final entry = _getEntryForDate(date, entries);
|
||||
return entry?.isPeriodDay ?? false;
|
||||
}
|
||||
|
||||
Widget _buildCalendarDay(DateTime day, DateTime focusedDay,
|
||||
List<CycleEntry> entries, DateTime? lastPeriodStart, int cycleLength,
|
||||
{bool isSelected = false, bool isToday = false, bool isWeekend = false}) {
|
||||
{bool isSelected = false, bool isToday = false}) {
|
||||
final phase = _getPhaseForDate(day, lastPeriodStart, cycleLength);
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
@@ -888,12 +894,12 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
|
||||
);
|
||||
} else if (isToday) {
|
||||
decoration = BoxDecoration(
|
||||
color: AppColors.sageGreen.withOpacity(0.2),
|
||||
color: AppColors.sageGreen.withValues(alpha: 0.2),
|
||||
shape: BoxShape.circle,
|
||||
);
|
||||
} else if (phase != null) {
|
||||
decoration = BoxDecoration(
|
||||
color: _getPhaseColor(phase).withOpacity(isDark ? 0.2 : 0.15),
|
||||
color: _getPhaseColor(phase).withValues(alpha: isDark ? 0.2 : 0.15),
|
||||
shape: BoxShape.circle,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../models/scripture.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../services/cycle_service.dart';
|
||||
@@ -54,7 +53,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
...BibleTranslation.values.map((t) => ListTile(
|
||||
title: Text(t.label),
|
||||
trailing: user.bibleTranslation == t
|
||||
? Icon(Icons.check, color: AppColors.sageGreen)
|
||||
? const Icon(Icons.check, color: AppColors.sageGreen)
|
||||
: null,
|
||||
onTap: () => Navigator.pop(context, t),
|
||||
)),
|
||||
@@ -73,7 +72,8 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Listen for changes in the cycle info to re-initialize scripture if needed
|
||||
ref.listen<CycleInfo>(currentCycleInfoProvider, (previousCycleInfo, newCycleInfo) {
|
||||
ref.listen<CycleInfo>(currentCycleInfoProvider,
|
||||
(previousCycleInfo, newCycleInfo) {
|
||||
if (previousCycleInfo?.phase != newCycleInfo.phase) {
|
||||
_initializeScripture();
|
||||
}
|
||||
@@ -91,7 +91,8 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
final maxIndex = scriptureState.maxIndex;
|
||||
|
||||
if (scripture == null) {
|
||||
return const Center(child: CircularProgressIndicator()); // Or some error message
|
||||
return const Center(
|
||||
child: CircularProgressIndicator()); // Or some error message
|
||||
}
|
||||
|
||||
return SafeArea(
|
||||
@@ -117,7 +118,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: _getPhaseColor(phase).withOpacity(0.15),
|
||||
color: _getPhaseColor(phase).withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
@@ -165,18 +166,20 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
onPressed: () =>
|
||||
ref.read(scriptureProvider.notifier).getPreviousScripture(),
|
||||
icon: const Icon(Icons.arrow_back_ios),
|
||||
onPressed: () => ref
|
||||
.read(scriptureProvider.notifier)
|
||||
.getPreviousScripture(),
|
||||
color: AppColors.charcoal,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.arrow_forward_ios),
|
||||
onPressed: () =>
|
||||
ref.read(scriptureProvider.notifier).getNextScripture(),
|
||||
icon: const Icon(Icons.arrow_forward_ios),
|
||||
onPressed: () => ref
|
||||
.read(scriptureProvider.notifier)
|
||||
.getNextScripture(),
|
||||
color: AppColors.charcoal,
|
||||
),
|
||||
),
|
||||
@@ -185,16 +188,17 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (maxIndex != null && maxIndex > 1)
|
||||
Center(
|
||||
child: TextButton.icon(
|
||||
onPressed: () => ref.read(scriptureProvider.notifier).getRandomScripture(),
|
||||
icon: const Icon(Icons.shuffle),
|
||||
label: const Text('Random Verse'),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppColors.sageGreen,
|
||||
Center(
|
||||
child: TextButton.icon(
|
||||
onPressed: () =>
|
||||
ref.read(scriptureProvider.notifier).getRandomScripture(),
|
||||
icon: const Icon(Icons.shuffle),
|
||||
label: const Text('Random Verse'),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppColors.sageGreen,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Reflection
|
||||
@@ -207,7 +211,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -216,20 +220,20 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
const Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.lightbulb_outline,
|
||||
color: AppColors.softGold,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'Reflection',
|
||||
style: GoogleFonts.outfit(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.titleLarge?.color,
|
||||
color: AppColors.charcoal,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -258,7 +262,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -269,7 +273,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
const Icon(
|
||||
Icons.favorite_outline,
|
||||
color: AppColors.rose,
|
||||
size: 20,
|
||||
@@ -306,8 +310,8 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColors.lavender.withOpacity(isDark ? 0.35 : 0.2),
|
||||
AppColors.blushPink.withOpacity(isDark ? 0.35 : 0.2),
|
||||
AppColors.lavender.withValues(alpha: isDark ? 0.35 : 0.2),
|
||||
AppColors.blushPink.withValues(alpha: isDark ? 0.35 : 0.2),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -317,16 +321,16 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
const Row(
|
||||
children: [
|
||||
Text('🙏', style: TextStyle(fontSize: 20)),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'Prayer Prompt',
|
||||
style: GoogleFonts.outfit(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.titleLarge?.color,
|
||||
color: AppColors.charcoal, // Assuming a default color
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -351,8 +355,8 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
if (user.teachingPlans?.isNotEmpty ?? false)
|
||||
_buildTeachingPlanCard(context, user.teachingPlans!)
|
||||
else
|
||||
_buildSampleTeachingCard(context),
|
||||
|
||||
_buildSampleTeachingCard(context),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Action buttons
|
||||
@@ -434,32 +438,34 @@ 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) {
|
||||
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 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)),
|
||||
border: Border.all(color: AppColors.gold.withValues(alpha: 0.5)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.gold.withOpacity(0.1),
|
||||
color: AppColors.gold.withValues(alpha: 0.1),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -470,13 +476,13 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.menu_book, color: AppColors.navyBlue),
|
||||
const Icon(Icons.menu_book, color: AppColors.navyBlue),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Leading in the Word',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 16,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.navyBlue,
|
||||
),
|
||||
@@ -485,12 +491,15 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.gold.withOpacity(0.1),
|
||||
color: AppColors.gold.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'Husband\'s Sharing',
|
||||
style: GoogleFonts.outfit(fontSize: 10, color: AppColors.gold, fontWeight: FontWeight.bold),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 10,
|
||||
color: AppColors.gold,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -521,7 +530,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
style: GoogleFonts.lora(
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
color: AppColors.charcoal.withOpacity(0.9),
|
||||
color: AppColors.charcoal.withValues(alpha: 0.9),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -536,10 +545,12 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColors.warmGray.withOpacity(0.3), style: BorderStyle.solid),
|
||||
border: Border.all(
|
||||
color: AppColors.warmGray.withValues(alpha: 0.3),
|
||||
style: BorderStyle.solid),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -550,13 +561,13 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.menu_book, color: AppColors.warmGray),
|
||||
const Icon(Icons.menu_book, color: AppColors.warmGray),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Leading in the Word',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 16,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.warmGray,
|
||||
),
|
||||
@@ -565,12 +576,15 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.warmGray.withOpacity(0.1),
|
||||
color: AppColors.warmGray.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'Sample',
|
||||
style: GoogleFonts.outfit(fontSize: 10, color: AppColors.warmGray, fontWeight: FontWeight.bold),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 10,
|
||||
color: AppColors.warmGray,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -581,7 +595,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.charcoal.withOpacity(0.7),
|
||||
color: AppColors.charcoal.withValues(alpha: 0.7),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
@@ -600,11 +614,11 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
fontSize: 15,
|
||||
height: 1.5,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: AppColors.charcoal.withOpacity(0.6),
|
||||
color: AppColors.charcoal.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Center(
|
||||
Center(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () => _showShareDialog(context),
|
||||
icon: const Icon(Icons.link, size: 18),
|
||||
@@ -614,7 +628,7 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
side: const BorderSide(color: AppColors.navyBlue),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -623,16 +637,17 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
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';
|
||||
final pairingCode =
|
||||
userProfile?.id.substring(0, 6).toUpperCase() ?? 'ABC123';
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Row(
|
||||
title: const Row(
|
||||
children: [
|
||||
Icon(Icons.share_outlined, color: AppColors.navyBlue),
|
||||
const SizedBox(width: 8),
|
||||
const Text('Share with Husband'),
|
||||
SizedBox(width: 8),
|
||||
Text('Share with Husband'),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
@@ -640,15 +655,17 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
children: [
|
||||
Text(
|
||||
'Share this code with your husband so he can connect to your cycle data:',
|
||||
style: GoogleFonts.outfit(fontSize: 14, color: AppColors.warmGray),
|
||||
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),
|
||||
color: AppColors.navyBlue.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.navyBlue.withOpacity(0.3)),
|
||||
border: Border.all(
|
||||
color: AppColors.navyBlue.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: SelectableText(
|
||||
pairingCode,
|
||||
@@ -663,7 +680,8 @@ class _DevotionalScreenState extends ConsumerState<DevotionalScreen> {
|
||||
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),
|
||||
style:
|
||||
GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,8 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
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 '../log/pad_tracker_screen.dart';
|
||||
@@ -20,7 +19,7 @@ import '../settings/privacy_settings_screen.dart';
|
||||
import '../settings/supplies_settings_screen.dart';
|
||||
import '../settings/export_data_screen.dart';
|
||||
import '../learn/wife_learn_screen.dart';
|
||||
import '../../widgets/tip_card.dart';
|
||||
|
||||
import '../../widgets/cycle_ring.dart';
|
||||
import '../../widgets/scripture_card.dart';
|
||||
import '../../widgets/pad_tracker_card.dart';
|
||||
@@ -135,7 +134,7 @@ class HomeScreen extends ConsumerWidget {
|
||||
color: (Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.black
|
||||
: AppColors.charcoal)
|
||||
.withOpacity(0.1),
|
||||
.withValues(alpha: 0.1),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, -2),
|
||||
),
|
||||
@@ -153,7 +152,7 @@ class HomeScreen extends ConsumerWidget {
|
||||
}
|
||||
|
||||
class _DashboardTab extends ConsumerStatefulWidget {
|
||||
const _DashboardTab({super.key});
|
||||
const _DashboardTab();
|
||||
|
||||
@override
|
||||
ConsumerState<_DashboardTab> createState() => _DashboardTabState();
|
||||
@@ -190,8 +189,6 @@ class _DashboardTabState extends ConsumerState<_DashboardTab> {
|
||||
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;
|
||||
@@ -244,7 +241,7 @@ class _DashboardTabState extends ConsumerState<_DashboardTab> {
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
icon: const Icon(Icons.arrow_back_ios),
|
||||
onPressed: () => ref
|
||||
.read(scriptureProvider.notifier)
|
||||
.getPreviousScripture(),
|
||||
@@ -254,7 +251,7 @@ class _DashboardTabState extends ConsumerState<_DashboardTab> {
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.arrow_forward_ios),
|
||||
icon: const Icon(Icons.arrow_forward_ios),
|
||||
onPressed: () => ref
|
||||
.read(scriptureProvider.notifier)
|
||||
.getNextScripture(),
|
||||
@@ -336,7 +333,7 @@ class _DashboardTabState extends ConsumerState<_DashboardTab> {
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primaryContainer.withOpacity(0.5),
|
||||
color: theme.colorScheme.primaryContainer.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(
|
||||
@@ -357,7 +354,8 @@ class _SettingsTab extends ConsumerWidget {
|
||||
{VoidCallback? onTap}) {
|
||||
return ListTile(
|
||||
leading: Icon(icon,
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.8)),
|
||||
color:
|
||||
Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.8)),
|
||||
title: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
@@ -445,7 +443,7 @@ class _SettingsTab extends ConsumerWidget {
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline
|
||||
.withOpacity(0.05)),
|
||||
.withValues(alpha: 0.05)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -458,11 +456,11 @@ class _SettingsTab extends ConsumerWidget {
|
||||
Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(0.7),
|
||||
.withValues(alpha: 0.7),
|
||||
Theme.of(context)
|
||||
.colorScheme
|
||||
.secondary
|
||||
.withOpacity(0.7)
|
||||
.withValues(alpha: 0.7)
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -613,7 +611,7 @@ class _SettingsTab extends ConsumerWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CycleHistoryScreen()));
|
||||
builder: (context) => const CycleHistoryScreen()));
|
||||
}),
|
||||
_buildSettingsTile(
|
||||
context, Icons.download_outlined, 'Export Data', onTap: () {
|
||||
@@ -655,7 +653,10 @@ class _SettingsTab extends ConsumerWidget {
|
||||
color: Theme.of(context).cardTheme.color,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.05)),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline
|
||||
.withValues(alpha: 0.05)),
|
||||
),
|
||||
child: Column(
|
||||
children: tiles,
|
||||
@@ -767,74 +768,6 @@ class _SettingsTab extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showShareDialog(BuildContext context, WidgetRef ref) {
|
||||
// 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: Theme.of(context).colorScheme.primary),
|
||||
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: Theme.of(context).colorScheme.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary.withOpacity(0.3)),
|
||||
),
|
||||
child: SelectableText(
|
||||
pairingCode,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 4,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
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: Theme.of(context).colorScheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('Done'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildWifeTipsSection(BuildContext context) {
|
||||
@@ -900,7 +833,7 @@ Widget _buildTipCard(
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.1),
|
||||
color: Theme.of(context).colorScheme.primary.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
|
||||
@@ -137,7 +137,7 @@ class HusbandAppearanceScreen extends ConsumerWidget {
|
||||
boxShadow: [
|
||||
if (isSelected)
|
||||
BoxShadow(
|
||||
color: color.withOpacity(0.4),
|
||||
color: color.withValues(alpha: 0.4),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../../providers/user_provider.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../services/bible_xml_parser.dart';
|
||||
import '../../services/mock_data_service.dart';
|
||||
import '../../services/notification_service.dart';
|
||||
|
||||
class HusbandDevotionalScreen extends ConsumerStatefulWidget {
|
||||
const HusbandDevotionalScreen({super.key});
|
||||
@@ -190,11 +191,11 @@ class _HusbandDevotionalScreenState
|
||||
// Trigger notification for new teaching plans
|
||||
if (existingPlan == null) {
|
||||
NotificationService().showTeachingPlanNotification(
|
||||
teacherName: user.name ?? 'Husband',
|
||||
teacherName: user.name,
|
||||
);
|
||||
}
|
||||
|
||||
if (mounted) Navigator.pop(context);
|
||||
if (context.mounted) Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Save'),
|
||||
),
|
||||
@@ -283,7 +284,7 @@ class _HusbandDevotionalScreenState
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: Colors.grey.withOpacity(0.2)),
|
||||
border: Border.all(color: Colors.grey.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -314,7 +315,7 @@ class _HusbandDevotionalScreenState
|
||||
background: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
padding: const EdgeInsets.only(right: 20),
|
||||
color: Colors.red.withOpacity(0.8),
|
||||
color: Colors.red.withValues(alpha: 0.8),
|
||||
child: const Icon(Icons.delete, color: Colors.white),
|
||||
),
|
||||
onDismissed: (_) => _deletePlan(plan),
|
||||
@@ -517,14 +518,14 @@ class _HusbandDevotionalScreenState
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColors.lavender.withOpacity(0.15),
|
||||
AppColors.blushPink.withOpacity(0.15),
|
||||
AppColors.lavender.withValues(alpha: 0.15),
|
||||
AppColors.blushPink.withValues(alpha: 0.15),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColors.lavender.withOpacity(0.3)),
|
||||
border: Border.all(color: AppColors.lavender.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -623,12 +624,12 @@ class _HusbandDevotionalScreenState
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.5),
|
||||
color: Colors.white.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(Icons.favorite_border,
|
||||
const Icon(Icons.favorite_border,
|
||||
color: AppColors.warmGray, size: 32),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
@@ -642,7 +643,7 @@ class _HusbandDevotionalScreenState
|
||||
'Check back later or encourage her to share.',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 12,
|
||||
color: AppColors.warmGray.withOpacity(0.8),
|
||||
color: AppColors.warmGray.withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -660,8 +661,8 @@ class _HusbandDevotionalScreenState
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Row(
|
||||
children: const [
|
||||
title: const Row(
|
||||
children: [
|
||||
Icon(Icons.link, color: AppColors.navyBlue),
|
||||
SizedBox(width: 8),
|
||||
Text('Connect with Wife'),
|
||||
@@ -723,12 +724,14 @@ class _HusbandDevotionalScreenState
|
||||
.updateProfile(updatedProfile);
|
||||
}
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Connected with wife! 💑'),
|
||||
backgroundColor: AppColors.sageGreen,
|
||||
),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Connected with wife! 💑'),
|
||||
backgroundColor: AppColors.sageGreen,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import './learn_article_screen.dart';
|
||||
import '../../data/learn_content.dart';
|
||||
|
||||
class _HusbandLearnScreen extends StatelessWidget {
|
||||
const _HusbandLearnScreen();
|
||||
class HusbandLearnArticlesScreen extends StatelessWidget {
|
||||
const HusbandLearnArticlesScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -23,7 +22,7 @@ class _HusbandLearnScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildSection(context, 'Understanding Her', [
|
||||
_buildSection(context, 'Understanding Her', const [
|
||||
_LearnItem(
|
||||
icon: Icons.loop,
|
||||
title: 'The 4 Phases of Her Cycle',
|
||||
@@ -44,7 +43,7 @@ class _HusbandLearnScreen extends StatelessWidget {
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 24),
|
||||
_buildSection(context, 'Biblical Manhood', [
|
||||
_buildSection(context, 'Biblical Manhood', const [
|
||||
_LearnItem(
|
||||
icon: Icons.favorite,
|
||||
title: 'Loving Like Christ',
|
||||
@@ -65,7 +64,7 @@ class _HusbandLearnScreen extends StatelessWidget {
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 24),
|
||||
_buildSection(context, 'NFP for Husbands', [
|
||||
_buildSection(context, 'NFP for Husbands', const [
|
||||
_LearnItem(
|
||||
icon: Icons.show_chart,
|
||||
title: 'Reading the Charts Together',
|
||||
@@ -85,7 +84,8 @@ class _HusbandLearnScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSection(BuildContext context, String title, List<_LearnItem> items) {
|
||||
Widget _buildSection(
|
||||
BuildContext context, String title, List<_LearnItem> items) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -111,7 +111,10 @@ class _HusbandLearnScreen extends StatelessWidget {
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.1),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(
|
||||
@@ -143,7 +146,9 @@ class _HusbandLearnScreen extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LearnArticleScreen(articleId: item.articleId),
|
||||
builder: (context) =>
|
||||
CombinedLearnArticleDetailScreen(
|
||||
articleId: item.articleId),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -168,4 +173,148 @@ class _LearnItem {
|
||||
required this.subtitle,
|
||||
required this.articleId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class CombinedLearnArticleDetailScreen extends StatelessWidget {
|
||||
final String articleId;
|
||||
|
||||
const CombinedLearnArticleDetailScreen({super.key, required this.articleId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final article = LearnContent.getArticle(articleId);
|
||||
|
||||
if (article == null) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Article Not Found')),
|
||||
body: const Center(child: Text('Article not found')),
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon:
|
||||
Icon(Icons.arrow_back, color: Theme.of(context).iconTheme.color),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
title: Text(
|
||||
article.category,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
article.title,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).textTheme.headlineMedium?.color,
|
||||
height: 1.2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
article.subtitle,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Container(
|
||||
height: 3,
|
||||
width: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
...article.sections
|
||||
.map((section) => _buildSection(context, section)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSection(BuildContext context, LearnSection section) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (section.heading != null) ...[
|
||||
Text(
|
||||
section.heading!,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.titleLarge?.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
_buildRichText(context, section.content),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRichText(BuildContext context, String content) {
|
||||
final List<InlineSpan> spans = [];
|
||||
final RegExp boldPattern = RegExp(r'\*\*(.*?)\*\*');
|
||||
|
||||
int currentIndex = 0;
|
||||
for (final match in boldPattern.allMatches(content)) {
|
||||
if (match.start > currentIndex) {
|
||||
spans.add(TextSpan(
|
||||
text: content.substring(currentIndex, match.start),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
color: Theme.of(context).textTheme.bodyLarge?.color,
|
||||
height: 1.7,
|
||||
),
|
||||
));
|
||||
}
|
||||
spans.add(TextSpan(
|
||||
text: match.group(1),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.titleMedium?.color,
|
||||
height: 1.7,
|
||||
),
|
||||
));
|
||||
currentIndex = match.end;
|
||||
}
|
||||
|
||||
if (currentIndex < content.length) {
|
||||
spans.add(TextSpan(
|
||||
text: content.substring(currentIndex),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
color: Theme.of(context).textTheme.bodyLarge?.color,
|
||||
height: 1.7,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
return RichText(
|
||||
text: TextSpan(children: spans),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../models/cycle_entry.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
|
||||
class HusbandNotesScreen extends ConsumerWidget {
|
||||
@@ -16,7 +15,7 @@ class HusbandNotesScreen extends ConsumerWidget {
|
||||
(entry.notes != null && entry.notes!.isNotEmpty) ||
|
||||
(entry.husbandNotes != null && entry.husbandNotes!.isNotEmpty))
|
||||
.toList();
|
||||
|
||||
|
||||
// Sort entries by date, newest first
|
||||
notesEntries.sort((a, b) => b.date.compareTo(a.date));
|
||||
|
||||
@@ -33,7 +32,8 @@ class HusbandNotesScreen extends ConsumerWidget {
|
||||
itemBuilder: (context, index) {
|
||||
final entry = notesEntries[index];
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
margin:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -41,9 +41,10 @@ class HusbandNotesScreen extends ConsumerWidget {
|
||||
children: [
|
||||
Text(
|
||||
DateFormat.yMMMMd().format(entry.date),
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
style:
|
||||
Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
if (entry.notes != null && entry.notes!.isNotEmpty)
|
||||
@@ -51,7 +52,8 @@ class HusbandNotesScreen extends ConsumerWidget {
|
||||
title: 'Her Notes',
|
||||
content: entry.notes!,
|
||||
),
|
||||
if (entry.husbandNotes != null && entry.husbandNotes!.isNotEmpty)
|
||||
if (entry.husbandNotes != null &&
|
||||
entry.husbandNotes!.isNotEmpty)
|
||||
_NoteSection(
|
||||
title: 'Your Notes',
|
||||
content: entry.husbandNotes!,
|
||||
@@ -93,4 +95,4 @@ class _NoteSection extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,11 +147,11 @@ class HusbandSettingsScreen extends ConsumerWidget {
|
||||
context: context,
|
||||
builder: (context) => StatefulBuilder(
|
||||
builder: (context, setState) => AlertDialog(
|
||||
title: Row(
|
||||
title: const Row(
|
||||
children: [
|
||||
const Icon(Icons.link, color: AppColors.navyBlue),
|
||||
const SizedBox(width: 8),
|
||||
const Text('Connect with Wife'),
|
||||
Icon(Icons.link, color: AppColors.navyBlue),
|
||||
SizedBox(width: 8),
|
||||
Text('Connect with Wife'),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
@@ -188,7 +188,7 @@ class HusbandSettingsScreen extends ConsumerWidget {
|
||||
value: shareDevotional,
|
||||
onChanged: (val) =>
|
||||
setState(() => shareDevotional = val ?? true),
|
||||
activeColor: AppColors.navyBlue,
|
||||
activeColor: AppColors.sageGreen,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
@@ -233,12 +233,14 @@ class HusbandSettingsScreen extends ConsumerWidget {
|
||||
user.copyWith(isDataShared: shareDevotional));
|
||||
}
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Settings updated & Connected!'),
|
||||
backgroundColor: AppColors.sageGreen,
|
||||
),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Settings updated & Connected!'),
|
||||
backgroundColor: AppColors.sageGreen,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (code.isNotEmpty) {
|
||||
// Load demo data as simulation
|
||||
@@ -281,7 +283,7 @@ class HusbandSettingsScreen extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// Theme aware colors
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
final cardColor =
|
||||
Theme.of(context).cardTheme.color; // Using theme card color
|
||||
final textColor = Theme.of(context).textTheme.bodyLarge?.color;
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../data/learn_content.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
|
||||
/// Screen to display full learn article content
|
||||
class LearnArticleScreen extends StatelessWidget {
|
||||
final String articleId;
|
||||
|
||||
const LearnArticleScreen({super.key, required this.articleId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final article = LearnContent.getArticle(articleId);
|
||||
|
||||
if (article == null) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Article Not Found')),
|
||||
body: const Center(child: Text('Article not found')),
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Theme.of(context).iconTheme.color),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
title: Text(
|
||||
article.category,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).textTheme.bodySmall?.color,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Title
|
||||
Text(
|
||||
article.title,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).textTheme.headlineMedium?.color,
|
||||
height: 1.2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
article.subtitle,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
color: Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Divider
|
||||
Container(
|
||||
height: 3,
|
||||
width: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Sections
|
||||
...article.sections.map((section) => _buildSection(context, section)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSection(BuildContext context, LearnSection section) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (section.heading != null) ...[
|
||||
Text(
|
||||
section.heading!,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.titleLarge?.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
_buildRichText(context, section.content),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRichText(BuildContext context, String content) {
|
||||
// Handle basic markdown-like formatting
|
||||
final List<InlineSpan> spans = [];
|
||||
final RegExp boldPattern = RegExp(r'\*\*(.*?)\*\*');
|
||||
|
||||
int currentIndex = 0;
|
||||
for (final match in boldPattern.allMatches(content)) {
|
||||
// Add text before the match
|
||||
if (match.start > currentIndex) {
|
||||
spans.add(TextSpan(
|
||||
text: content.substring(currentIndex, match.start),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
color: Theme.of(context).textTheme.bodyLarge?.color,
|
||||
height: 1.7,
|
||||
),
|
||||
));
|
||||
}
|
||||
// Add bold text
|
||||
spans.add(TextSpan(
|
||||
text: match.group(1),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).textTheme.titleMedium?.color,
|
||||
height: 1.7,
|
||||
),
|
||||
));
|
||||
currentIndex = match.end;
|
||||
}
|
||||
|
||||
// Add remaining text
|
||||
if (currentIndex < content.length) {
|
||||
spans.add(TextSpan(
|
||||
text: content.substring(currentIndex),
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 15,
|
||||
color: Theme.of(context).textTheme.bodyLarge?.color,
|
||||
height: 1.7,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
return RichText(
|
||||
text: TextSpan(children: spans),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:christian_period_tracker/models/scripture.dart';
|
||||
|
||||
class HusbandLearnScreen extends StatelessWidget {
|
||||
const HusbandLearnScreen({super.key});
|
||||
@@ -45,7 +44,8 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -54,21 +54,24 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
_buildTipCard(
|
||||
context,
|
||||
title: 'Understanding Female Cycles',
|
||||
content: 'Learn about the different phases of your wife\'s menstrual cycle and how they affect her health.',
|
||||
content:
|
||||
'Learn about the different phases of your wife\'s menstrual cycle and how they affect her health.',
|
||||
icon: Icons.calendar_month,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildTipCard(
|
||||
context,
|
||||
title: 'Supportive Role',
|
||||
content: 'Be supportive during different phases, understanding when she may need more emotional support or rest.',
|
||||
content:
|
||||
'Be supportive during different phases, understanding when she may need more emotional support or rest.',
|
||||
icon: Icons.support_agent,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildTipCard(
|
||||
context,
|
||||
title: 'Nutritional Support',
|
||||
content: 'Understand how nutrition affects reproductive health and discuss dietary choices together.',
|
||||
content:
|
||||
'Understand how nutrition affects reproductive health and discuss dietary choices together.',
|
||||
icon: Icons.food_bank,
|
||||
),
|
||||
],
|
||||
@@ -90,7 +93,8 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -99,21 +103,24 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
_buildTipCard(
|
||||
context,
|
||||
title: 'Safe Sexual Practices',
|
||||
content: 'Use protection consistently to prevent sexually transmitted infections and maintain mutual health.',
|
||||
content:
|
||||
'Use protection consistently to prevent sexually transmitted infections and maintain mutual health.',
|
||||
icon: Icons.security,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildTipCard(
|
||||
context,
|
||||
title: 'Regular Testing',
|
||||
content: 'Schedule regular STI screenings together with your partner for early detection and treatment.',
|
||||
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.',
|
||||
content:
|
||||
'Discuss health concerns openly to ensure both partners understand each other\'s needs and maintain trust.',
|
||||
icon: Icons.chat,
|
||||
),
|
||||
],
|
||||
@@ -135,7 +142,8 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
Card(
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -144,14 +152,16 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
_buildTipCard(
|
||||
context,
|
||||
title: 'Educate Yourself',
|
||||
content: 'Take the initiative to learn about reproductive health and partner needs.',
|
||||
content:
|
||||
'Take the initiative to learn about reproductive health and partner needs.',
|
||||
icon: Icons.school,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildTipCard(
|
||||
context,
|
||||
title: 'Active Listening',
|
||||
content: 'Listen attentively when your wife discusses her health concerns or feelings.',
|
||||
content:
|
||||
'Listen attentively when your wife discusses her health concerns or feelings.',
|
||||
icon: Icons.mic_none,
|
||||
),
|
||||
],
|
||||
@@ -162,7 +172,10 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTipCard(BuildContext context, {required String title, required String content, required IconData icon}) {
|
||||
Widget _buildTipCard(BuildContext context,
|
||||
{required String title,
|
||||
required String content,
|
||||
required IconData icon}) {
|
||||
return Card(
|
||||
elevation: 1,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
@@ -174,10 +187,14 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primaryContainer.withOpacity(0.2),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primaryContainer
|
||||
.withValues(alpha: 0.2),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, size: 24, color: Theme.of(context).colorScheme.primary),
|
||||
child: Icon(icon,
|
||||
size: 24, color: Theme.of(context).colorScheme.primary),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
@@ -186,7 +203,10 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium
|
||||
?.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
@@ -201,4 +221,4 @@ class HusbandLearnScreen extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../husband/learn_article_screen.dart';
|
||||
import '../husband/husband_learn_articles_screen.dart';
|
||||
|
||||
class WifeLearnScreen extends StatelessWidget {
|
||||
const WifeLearnScreen({super.key});
|
||||
@@ -23,7 +23,7 @@ class WifeLearnScreen extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildSection(context, 'Understanding My Cycle', [
|
||||
_buildSection(context, 'Understanding My Cycle', const [
|
||||
_LearnItem(
|
||||
icon: Icons.loop,
|
||||
title: 'The 4 Phases',
|
||||
@@ -34,11 +34,12 @@ class WifeLearnScreen extends StatelessWidget {
|
||||
icon: Icons.psychology_outlined,
|
||||
title: 'Mood & Hormones',
|
||||
subtitle: 'Why I feel different each week',
|
||||
articleId: 'wife_mood_changes', // Reusing similar concept, maybe new article
|
||||
articleId:
|
||||
'wife_mood_changes', // Reusing similar concept, maybe new article
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 24),
|
||||
_buildSection(context, 'Disease Prevention', [
|
||||
_buildSection(context, 'Disease Prevention', const [
|
||||
_LearnItem(
|
||||
icon: Icons.health_and_safety_outlined,
|
||||
title: 'Preventing Infections',
|
||||
@@ -53,7 +54,7 @@ class WifeLearnScreen extends StatelessWidget {
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 24),
|
||||
_buildSection(context, 'Partnership', [
|
||||
_buildSection(context, 'Partnership', const [
|
||||
_LearnItem(
|
||||
icon: Icons.favorite_border,
|
||||
title: 'Communication',
|
||||
@@ -73,7 +74,8 @@ class WifeLearnScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSection(BuildContext context, String title, List<_LearnItem> items) {
|
||||
Widget _buildSection(
|
||||
BuildContext context, String title, List<_LearnItem> items) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -92,7 +94,10 @@ class WifeLearnScreen extends StatelessWidget {
|
||||
color: Theme.of(context).cardTheme.color,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.05)),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline
|
||||
.withValues(alpha: 0.05)),
|
||||
),
|
||||
child: Column(
|
||||
children: items
|
||||
@@ -101,7 +106,10 @@ class WifeLearnScreen extends StatelessWidget {
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primaryContainer.withOpacity(0.2),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primaryContainer
|
||||
.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(
|
||||
@@ -133,7 +141,9 @@ class WifeLearnScreen extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LearnArticleScreen(articleId: item.articleId),
|
||||
builder: (context) =>
|
||||
CombinedLearnArticleDetailScreen(
|
||||
articleId: item.articleId),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -158,4 +168,4 @@ class _LearnItem {
|
||||
required this.subtitle,
|
||||
required this.articleId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -105,7 +105,7 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
context: context,
|
||||
initialTime: TimeOfDay.now(),
|
||||
);
|
||||
if (time != null && mounted) {
|
||||
if (time != null && context.mounted) {
|
||||
final now = DateTime.now();
|
||||
final selectedDate = DateTime(
|
||||
now.year, now.month, now.day, time.hour, time.minute);
|
||||
@@ -211,8 +211,9 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
|
||||
SupplyItem? get _activeSupply {
|
||||
final user = ref.watch(userProfileProvider);
|
||||
if (user == null || user.padSupplies == null || user.padSupplies!.isEmpty)
|
||||
if (user == null || user.padSupplies == null || user.padSupplies!.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
if (_activeSupplyIndex == null ||
|
||||
_activeSupplyIndex! >= user.padSupplies!.length) {
|
||||
return user.padSupplies!.first;
|
||||
@@ -249,7 +250,9 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
|
||||
int get _recommendedHours {
|
||||
final supply = _activeSupply;
|
||||
if (supply == null) return 6; // Default
|
||||
if (supply == null) {
|
||||
return 6; // Default
|
||||
}
|
||||
|
||||
final type = supply.type;
|
||||
|
||||
@@ -262,9 +265,9 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
int baseHours;
|
||||
switch (_selectedFlow) {
|
||||
case FlowIntensity.heavy:
|
||||
baseHours = (type == PadType.super_pad ||
|
||||
baseHours = (type == PadType.superPad ||
|
||||
type == PadType.overnight ||
|
||||
type == PadType.tampon_super)
|
||||
type == PadType.tamponSuper)
|
||||
? 4
|
||||
: 3;
|
||||
break;
|
||||
@@ -313,9 +316,7 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
double adjusted = baseHours * ratio;
|
||||
|
||||
int maxHours =
|
||||
(type == PadType.tampon_regular || type == PadType.tampon_super)
|
||||
? 8
|
||||
: 12;
|
||||
(type == PadType.tamponRegular || type == PadType.tamponSuper) ? 8 : 12;
|
||||
|
||||
if (adjusted < 1) adjusted = 1;
|
||||
if (adjusted > maxHours) adjusted = maxHours.toDouble();
|
||||
@@ -364,10 +365,11 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
color: Theme.of(context).cardTheme.color,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: AppColors.menstrualPhase.withOpacity(0.3)),
|
||||
color:
|
||||
AppColors.menstrualPhase.withValues(alpha: 0.3)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -378,7 +380,8 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.menstrualPhase.withOpacity(0.1),
|
||||
color:
|
||||
AppColors.menstrualPhase.withValues(alpha: 0.1),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(Icons.inventory_2_outlined,
|
||||
@@ -432,7 +435,8 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
onSelected: (selected) {
|
||||
if (selected) setState(() => _selectedFlow = flow);
|
||||
},
|
||||
selectedColor: AppColors.menstrualPhase.withOpacity(0.3),
|
||||
selectedColor:
|
||||
AppColors.menstrualPhase.withValues(alpha: 0.3),
|
||||
labelStyle: GoogleFonts.outfit(
|
||||
color: _selectedFlow == flow
|
||||
? AppColors.navyBlue
|
||||
@@ -453,13 +457,13 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: isOverdue
|
||||
? AppColors.rose.withOpacity(0.15)
|
||||
: AppColors.sageGreen.withOpacity(0.15),
|
||||
? AppColors.rose.withValues(alpha: 0.15)
|
||||
: AppColors.sageGreen.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: isOverdue
|
||||
? AppColors.rose.withOpacity(0.3)
|
||||
: AppColors.sageGreen.withOpacity(0.3)),
|
||||
? AppColors.rose.withValues(alpha: 0.3)
|
||||
: AppColors.sageGreen.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -521,10 +525,10 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
margin: const EdgeInsets.only(bottom: 24),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.rose.withOpacity(0.1),
|
||||
color: AppColors.rose.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border:
|
||||
Border.all(color: AppColors.rose.withOpacity(0.3)),
|
||||
border: Border.all(
|
||||
color: AppColors.rose.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -597,7 +601,7 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
_updateTimeSinceChange();
|
||||
});
|
||||
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
@@ -617,7 +621,7 @@ class _PadTrackerScreenState extends ConsumerState<PadTrackerScreen> {
|
||||
backgroundColor: AppColors.menstrualPhase,
|
||||
foregroundColor: Colors.white,
|
||||
disabledBackgroundColor:
|
||||
AppColors.warmGray.withOpacity(0.2),
|
||||
AppColors.warmGray.withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -791,10 +795,10 @@ class _SupplyManagementPopupState
|
||||
margin: const EdgeInsets.only(right: 12),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.warmCream.withOpacity(0.3),
|
||||
color: AppColors.warmCream.withValues(alpha: 0.3),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: AppColors.warmGray.withOpacity(0.2)),
|
||||
color: AppColors.warmGray.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -857,7 +861,7 @@ class _SupplyManagementPopupState
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Brand Name (e.g. Always)',
|
||||
filled: true,
|
||||
fillColor: AppColors.warmCream.withOpacity(0.2),
|
||||
fillColor: AppColors.warmCream.withValues(alpha: 0.2),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide.none),
|
||||
@@ -870,7 +874,7 @@ class _SupplyManagementPopupState
|
||||
children: [
|
||||
Expanded(
|
||||
child: DropdownButtonFormField<PadType>(
|
||||
value: _selectedType,
|
||||
initialValue: _selectedType,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
border: OutlineInputBorder(
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../models/user_profile.dart';
|
||||
import '../../models/cycle_entry.dart';
|
||||
import '../home/home_screen.dart';
|
||||
import '../husband/husband_home_screen.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
@@ -178,6 +175,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
// final isDark = theme.brightness == Brightness.dark; - unused
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
|
||||
// Different background color for husband flow
|
||||
@@ -208,7 +206,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
spacing: 12,
|
||||
activeDotColor:
|
||||
isHusband ? AppColors.navyBlue : AppColors.sageGreen,
|
||||
dotColor: theme.colorScheme.outline.withOpacity(0.2),
|
||||
dotColor: theme.colorScheme.outline.withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -255,7 +253,10 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColors.blushPink, AppColors.rose.withOpacity(0.7)],
|
||||
colors: [
|
||||
AppColors.blushPink,
|
||||
AppColors.rose.withValues(alpha: 0.7)
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
@@ -311,7 +312,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
// Dynamic colors based on role selection
|
||||
final activeColor =
|
||||
role == UserRole.wife ? AppColors.sageGreen : AppColors.navyBlue;
|
||||
final activeBg = activeColor.withOpacity(isDark ? 0.3 : 0.1);
|
||||
final activeBg = activeColor.withValues(alpha: isDark ? 0.3 : 0.1);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => setState(() => _role = role),
|
||||
@@ -324,7 +325,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? activeColor
|
||||
: theme.colorScheme.outline.withOpacity(0.1),
|
||||
: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||
width: isSelected ? 2 : 1,
|
||||
),
|
||||
),
|
||||
@@ -333,8 +334,9 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
isSelected ? activeColor : theme.colorScheme.surfaceVariant,
|
||||
color: isSelected
|
||||
? activeColor
|
||||
: theme.colorScheme.surfaceContainerHighest,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
@@ -501,9 +503,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
child: SizedBox(
|
||||
height: 54,
|
||||
child: ElevatedButton(
|
||||
onPressed: (_relationshipStatus != null && !_isNavigating)
|
||||
? _nextPage
|
||||
: null,
|
||||
onPressed: !_isNavigating ? _nextPage : null,
|
||||
child: const Text('Continue'),
|
||||
),
|
||||
),
|
||||
@@ -528,13 +528,13 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? AppColors.sageGreen.withOpacity(isDark ? 0.3 : 0.1)
|
||||
? AppColors.sageGreen.withValues(alpha: isDark ? 0.3 : 0.1)
|
||||
: theme.cardTheme.color,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? AppColors.sageGreen
|
||||
: theme.colorScheme.outline.withOpacity(0.1),
|
||||
: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||
width: isSelected ? 2 : 1,
|
||||
),
|
||||
),
|
||||
@@ -560,7 +560,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
),
|
||||
),
|
||||
if (isSelected)
|
||||
Icon(Icons.check_circle, color: AppColors.sageGreen),
|
||||
const Icon(Icons.check_circle, color: AppColors.sageGreen),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -640,13 +640,13 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? AppColors.sageGreen.withOpacity(isDark ? 0.3 : 0.1)
|
||||
? AppColors.sageGreen.withValues(alpha: isDark ? 0.3 : 0.1)
|
||||
: theme.cardTheme.color,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isSelected
|
||||
? AppColors.sageGreen
|
||||
: theme.colorScheme.outline.withOpacity(0.1),
|
||||
: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||
width: isSelected ? 2 : 1,
|
||||
),
|
||||
),
|
||||
@@ -672,7 +672,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
),
|
||||
),
|
||||
if (isSelected)
|
||||
Icon(Icons.check_circle, color: AppColors.sageGreen),
|
||||
const Icon(Icons.check_circle, color: AppColors.sageGreen),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -681,7 +681,8 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
|
||||
Widget _buildCyclePage() {
|
||||
final theme = Theme.of(context);
|
||||
final isDark = theme.brightness == Brightness.dark;
|
||||
// final isDark = theme.brightness == Brightness.dark; - unused
|
||||
// final isDark = theme.brightness == Brightness.dark;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
@@ -812,7 +813,7 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
color: theme.cardTheme.color,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.outline.withOpacity(0.1))),
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.1))),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.calendar_today,
|
||||
@@ -878,10 +879,10 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
width: 64,
|
||||
height: 64,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.navyBlue.withOpacity(0.1),
|
||||
color: AppColors.navyBlue.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Icon(Icons.link, size: 32, color: AppColors.navyBlue),
|
||||
child: const Icon(Icons.link, size: 32, color: AppColors.navyBlue),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
@@ -975,10 +976,11 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
width: 64,
|
||||
height: 64,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.sageGreen.withOpacity(0.1),
|
||||
color: AppColors.sageGreen.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Icon(Icons.favorite, size: 32, color: AppColors.sageGreen),
|
||||
child: const Icon(Icons.favorite,
|
||||
size: 32, color: AppColors.sageGreen),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
@@ -1073,12 +1075,13 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? color.withOpacity(isDark ? 0.3 : 0.1)
|
||||
? color.withValues(alpha: isDark ? 0.3 : 0.1)
|
||||
: theme.cardTheme.color,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color:
|
||||
isSelected ? color : theme.colorScheme.outline.withOpacity(0.1),
|
||||
color: isSelected
|
||||
? color
|
||||
: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||
width: isSelected ? 2 : 1,
|
||||
),
|
||||
),
|
||||
@@ -1087,7 +1090,9 @@ class _OnboardingScreenState extends ConsumerState<OnboardingScreen> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? color : theme.colorScheme.surfaceVariant,
|
||||
color: isSelected
|
||||
? color
|
||||
: theme.colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../models/user_profile.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../widgets/pad_settings_dialog.dart';
|
||||
|
||||
class AppearanceScreen extends ConsumerWidget {
|
||||
const AppearanceScreen({super.key});
|
||||
@@ -43,41 +42,42 @@ class AppearanceScreen extends ConsumerWidget {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
SegmentedButton<AppThemeMode>(
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: AppThemeMode.light,
|
||||
label: Text('Light'),
|
||||
icon: Icon(Icons.light_mode),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: AppThemeMode.dark,
|
||||
label: Text('Dark'),
|
||||
icon: Icon(Icons.dark_mode),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: AppThemeMode.system,
|
||||
label: Text('System'),
|
||||
icon: Icon(Icons.brightness_auto),
|
||||
),
|
||||
],
|
||||
selected: {currentMode},
|
||||
onSelectionChanged: (Set<AppThemeMode> newSelection) {
|
||||
if (newSelection.isNotEmpty) {
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateThemeMode(newSelection.first);
|
||||
}
|
||||
},
|
||||
style: SegmentedButton.styleFrom(
|
||||
fixedSize: const Size.fromHeight(48),
|
||||
)
|
||||
),
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: AppThemeMode.light,
|
||||
label: Text('Light'),
|
||||
icon: Icon(Icons.light_mode),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: AppThemeMode.dark,
|
||||
label: Text('Dark'),
|
||||
icon: Icon(Icons.dark_mode),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: AppThemeMode.system,
|
||||
label: Text('System'),
|
||||
icon: Icon(Icons.brightness_auto),
|
||||
),
|
||||
],
|
||||
selected: {
|
||||
currentMode
|
||||
},
|
||||
onSelectionChanged: (Set<AppThemeMode> newSelection) {
|
||||
if (newSelection.isNotEmpty) {
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateThemeMode(newSelection.first);
|
||||
}
|
||||
},
|
||||
style: SegmentedButton.styleFrom(
|
||||
fixedSize: const Size.fromHeight(48),
|
||||
)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAccentColorSelector(BuildContext context, WidgetRef ref,
|
||||
String currentAccent) {
|
||||
Widget _buildAccentColorSelector(
|
||||
BuildContext context, WidgetRef ref, String currentAccent) {
|
||||
final accents = [
|
||||
{'color': AppColors.sageGreen, 'value': '0xFFA8C5A8'},
|
||||
{'color': AppColors.rose, 'value': '0xFFE8A0B0'},
|
||||
@@ -125,7 +125,7 @@ class AppearanceScreen extends ConsumerWidget {
|
||||
boxShadow: [
|
||||
if (isSelected)
|
||||
BoxShadow(
|
||||
color: color.withOpacity(0.4),
|
||||
color: color.withValues(alpha: 0.4),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
)
|
||||
@@ -141,4 +141,4 @@ class AppearanceScreen extends ConsumerWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../models/user_profile.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
|
||||
class CycleSettingsScreen extends ConsumerStatefulWidget {
|
||||
@@ -45,8 +44,10 @@ class _CycleSettingsScreenState extends ConsumerState<CycleSettingsScreen> {
|
||||
final userProfile = ref.read(userProfileProvider);
|
||||
if (userProfile != null) {
|
||||
final updatedProfile = userProfile.copyWith(
|
||||
averageCycleLength: int.tryParse(_cycleLengthController.text) ?? userProfile.averageCycleLength,
|
||||
averagePeriodLength: int.tryParse(_periodLengthController.text) ?? userProfile.averagePeriodLength,
|
||||
averageCycleLength: int.tryParse(_cycleLengthController.text) ??
|
||||
userProfile.averageCycleLength,
|
||||
averagePeriodLength: int.tryParse(_periodLengthController.text) ??
|
||||
userProfile.averagePeriodLength,
|
||||
lastPeriodStartDate: _lastPeriodStartDate,
|
||||
isIrregularCycle: _isIrregularCycle,
|
||||
isPadTrackingEnabled: _isPadTrackingEnabled,
|
||||
|
||||
@@ -24,28 +24,40 @@ class ExportDataScreen extends ConsumerWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.picture_as_pdf),
|
||||
title: const Text('Export as PDF'),
|
||||
subtitle: const Text('Generate a printable PDF report of your cycle data.'),
|
||||
subtitle: const Text(
|
||||
'Generate a printable PDF report of your cycle data.'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
try {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Generating PDF report...')),
|
||||
);
|
||||
await PdfService.generateCycleReport(userProfile, cycleEntries);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('PDF report generated successfully!')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Generating PDF report...')),
|
||||
);
|
||||
}
|
||||
await PdfService.generateCycleReport(
|
||||
userProfile, cycleEntries);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content:
|
||||
Text('PDF report generated successfully!')),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to generate PDF: $e')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to generate PDF: $e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.sync),
|
||||
title: const Text('Sync with Calendar'),
|
||||
subtitle: const Text('Export to Apple, Google, or Outlook Calendar.'),
|
||||
subtitle: const Text(
|
||||
'Export to Apple, Google, or Outlook Calendar.'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
// Show options dialog
|
||||
@@ -53,7 +65,8 @@ class ExportDataScreen extends ConsumerWidget {
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Calendar Sync Options'),
|
||||
content: const Text('Would you like to include predicted future periods for the next 12 months?'),
|
||||
content: const Text(
|
||||
'Would you like to include predicted future periods for the next 12 months?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
@@ -67,26 +80,37 @@ class ExportDataScreen extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
|
||||
if (includePredictions == null) return; // User cancelled dialog (though I didn't add cancel button, tapping outside returns null)
|
||||
if (includePredictions == null) {
|
||||
return; // User cancelled dialog
|
||||
}
|
||||
|
||||
try {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Generating calendar file...')),
|
||||
);
|
||||
|
||||
await IcsService.generateCycleCalendar(
|
||||
cycleEntries,
|
||||
user: userProfile,
|
||||
includePredictions: includePredictions
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Calendar file generated! Open it to add to your calendar.')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Generating calendar file...')),
|
||||
);
|
||||
}
|
||||
|
||||
await IcsService.generateCycleCalendar(cycleEntries,
|
||||
user: userProfile,
|
||||
includePredictions: includePredictions);
|
||||
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Calendar file generated! Open it to add to your calendar.')),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to generate calendar file: $e')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content:
|
||||
Text('Failed to generate calendar file: $e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -18,47 +18,60 @@ class GoalSettingsScreen extends ConsumerWidget {
|
||||
appBar: AppBar(
|
||||
title: const Text('Cycle Goal'),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
const Text(
|
||||
'What is your current goal?',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Select your primary goal to get personalized insights and predictions.',
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildGoalOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Track Cycle Only',
|
||||
subtitle: 'Monitor period and health without fertility focus',
|
||||
value: FertilityGoal.justTracking,
|
||||
groupValue: userProfile.fertilityGoal,
|
||||
icon: Icons.calendar_today,
|
||||
),
|
||||
_buildGoalOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Achieve Pregnancy',
|
||||
subtitle: 'Identify fertile window and ovulation',
|
||||
value: FertilityGoal.tryingToConceive,
|
||||
groupValue: userProfile.fertilityGoal,
|
||||
icon: Icons.child_friendly,
|
||||
),
|
||||
_buildGoalOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Avoid Pregnancy',
|
||||
subtitle: 'Track fertility for natural family planning',
|
||||
value: FertilityGoal.tryingToAvoid,
|
||||
groupValue: userProfile.fertilityGoal,
|
||||
icon: Icons.security,
|
||||
),
|
||||
],
|
||||
body: RadioGroup<FertilityGoal>(
|
||||
groupValue: userProfile.fertilityGoal,
|
||||
onChanged: (FertilityGoal? newValue) {
|
||||
if (newValue != null) {
|
||||
final currentProfile = ref.read(userProfileProvider);
|
||||
if (currentProfile != null) {
|
||||
ref.read(userProfileProvider.notifier).updateProfile(
|
||||
currentProfile.copyWith(fertilityGoal: newValue),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
const Text(
|
||||
'What is your current goal?',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Select your primary goal to get personalized insights and predictions.',
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildGoalOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Track Cycle Only',
|
||||
subtitle: 'Monitor period and health without fertility focus',
|
||||
value: FertilityGoal.justTracking,
|
||||
groupValue: userProfile.fertilityGoal,
|
||||
icon: Icons.calendar_today,
|
||||
),
|
||||
_buildGoalOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Achieve Pregnancy',
|
||||
subtitle: 'Identify fertile window and ovulation',
|
||||
value: FertilityGoal.tryingToConceive,
|
||||
groupValue: userProfile.fertilityGoal,
|
||||
icon: Icons.child_friendly,
|
||||
),
|
||||
_buildGoalOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Avoid Pregnancy',
|
||||
subtitle: 'Track fertility for natural family planning',
|
||||
value: FertilityGoal.tryingToAvoid,
|
||||
groupValue: userProfile.fertilityGoal,
|
||||
icon: Icons.security,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -85,20 +98,10 @@ class GoalSettingsScreen extends ConsumerWidget {
|
||||
),
|
||||
child: RadioListTile<FertilityGoal>(
|
||||
value: value,
|
||||
groupValue: groupValue,
|
||||
onChanged: (FertilityGoal? newValue) {
|
||||
if (newValue != null) {
|
||||
final currentProfile = ref.read(userProfileProvider);
|
||||
if (currentProfile != null) {
|
||||
ref.read(userProfileProvider.notifier).updateProfile(
|
||||
currentProfile.copyWith(fertilityGoal: newValue),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.w600)),
|
||||
subtitle: Text(subtitle),
|
||||
secondary: Icon(icon, color: isSelected ? Theme.of(context).colorScheme.primary : null),
|
||||
secondary: Icon(icon,
|
||||
color: isSelected ? Theme.of(context).colorScheme.primary : null),
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../models/user_profile.dart'; // Import UserProfile
|
||||
import '../../providers/user_provider.dart';
|
||||
|
||||
class NotificationSettingsScreen extends ConsumerWidget {
|
||||
@@ -26,29 +25,30 @@ class NotificationSettingsScreen extends ConsumerWidget {
|
||||
children: [
|
||||
SwitchListTile(
|
||||
title: const Text('Period Estimate'),
|
||||
subtitle: const Text('Get notified when your period is predicted to start soon.'),
|
||||
subtitle: const Text(
|
||||
'Get notified when your period is predicted to start soon.'),
|
||||
value: userProfile.notifyPeriodEstimate,
|
||||
onChanged: (value) async {
|
||||
await ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(userProfile.copyWith(notifyPeriodEstimate: value));
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(
|
||||
userProfile.copyWith(notifyPeriodEstimate: value));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
SwitchListTile(
|
||||
title: const Text('Period Start'),
|
||||
subtitle: const Text('Get notified when a period starts (or husband needs to know).'),
|
||||
subtitle: const Text(
|
||||
'Get notified when a period starts (or husband needs to know).'),
|
||||
value: userProfile.notifyPeriodStart,
|
||||
onChanged: (value) async {
|
||||
await ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(userProfile.copyWith(notifyPeriodStart: value));
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(
|
||||
userProfile.copyWith(notifyPeriodStart: value));
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
SwitchListTile(
|
||||
title: const Text('Low Supply Alert'),
|
||||
subtitle: const Text('Get notified when pad inventory is running low.'),
|
||||
subtitle:
|
||||
const Text('Get notified when pad inventory is running low.'),
|
||||
value: userProfile.notifyLowSupply,
|
||||
onChanged: (value) async {
|
||||
await ref
|
||||
@@ -58,14 +58,15 @@ class NotificationSettingsScreen extends ConsumerWidget {
|
||||
),
|
||||
if (userProfile.isPadTrackingEnabled) ...[
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
||||
child: Text(
|
||||
'Pad Change Reminders',
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
CheckboxListTile(
|
||||
@@ -100,12 +101,14 @@ class NotificationSettingsScreen extends ConsumerWidget {
|
||||
),
|
||||
CheckboxListTile(
|
||||
title: const Text('Change Now (Time\'s Up)'),
|
||||
subtitle: const Text('Get notified when it\'s recommended to change.'),
|
||||
subtitle:
|
||||
const Text('Get notified when it\'s recommended to change.'),
|
||||
value: userProfile.notifyPadNow,
|
||||
onChanged: (value) async {
|
||||
if (value != null) {
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(
|
||||
userProfile.copyWith(notifyPadNow: value));
|
||||
await ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(userProfile.copyWith(notifyPadNow: value));
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:health/health.dart';
|
||||
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../services/health_service.dart';
|
||||
|
||||
@@ -23,24 +23,30 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
}
|
||||
|
||||
Future<void> _checkPermissions() async {
|
||||
final hasPermissions = await _healthService.hasPermissions(_healthService.menstruationDataTypes);
|
||||
final hasPermissions = await _healthService
|
||||
.hasPermissions(_healthService.menstruationDataTypes);
|
||||
setState(() {
|
||||
_hasPermissions = hasPermissions;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _requestPermissions() async {
|
||||
final authorized = await _healthService.requestAuthorization(_healthService.menstruationDataTypes);
|
||||
final authorized = await _healthService
|
||||
.requestAuthorization(_healthService.menstruationDataTypes);
|
||||
if (authorized) {
|
||||
_hasPermissions = true;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Health app access granted!')),
|
||||
);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Health app access granted!')),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
_hasPermissions = false;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Health app access denied.')),
|
||||
);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Health app access denied.')),
|
||||
);
|
||||
}
|
||||
}
|
||||
setState(() {}); // Rebuild to update UI
|
||||
}
|
||||
@@ -48,14 +54,17 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
Future<void> _syncPeriodDays(bool sync) async {
|
||||
if (sync) {
|
||||
if (!_hasPermissions) {
|
||||
// Request permissions if not already granted
|
||||
final authorized = await _healthService.requestAuthorization(_healthService.menstruationDataTypes);
|
||||
if (!authorized) {
|
||||
if (mounted) {
|
||||
final authorized = await _healthService
|
||||
.requestAuthorization(_healthService.menstruationDataTypes);
|
||||
if (mounted) {
|
||||
if (!authorized) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Cannot sync without health app permissions.')),
|
||||
const SnackBar(
|
||||
content: Text('Cannot sync without health app permissions.')),
|
||||
);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
_hasPermissions = true;
|
||||
@@ -70,7 +79,8 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
final cycleEntries = ref.read(cycleEntriesProvider);
|
||||
|
||||
if (userProfile != null) {
|
||||
final success = await _healthService.writeMenstruationData(cycleEntries);
|
||||
final success =
|
||||
await _healthService.writeMenstruationData(cycleEntries);
|
||||
if (mounted) {
|
||||
if (success) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -90,7 +100,7 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
);
|
||||
}
|
||||
}
|
||||
setState(() {}); // Rebuild to update UI
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
Future<void> _setPin() async {
|
||||
@@ -98,38 +108,40 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
if (pin != null && pin.length >= 4) {
|
||||
final user = ref.read(userProfileProvider);
|
||||
if (user != null) {
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(user.copyWith(privacyPin: pin));
|
||||
if (mounted) ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('PIN Set Successfully')));
|
||||
await ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(user.copyWith(privacyPin: pin));
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('PIN Set Successfully')));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Future<void> _removePin() async {
|
||||
final user = ref.read(userProfileProvider);
|
||||
if (user == null) return;
|
||||
|
||||
// Require current PIN
|
||||
final currentPin = await _showPinDialog(context, title: 'Enter Current PIN');
|
||||
|
||||
final currentPin =
|
||||
await _showPinDialog(context, title: 'Enter Current PIN');
|
||||
if (currentPin == user.privacyPin) {
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(
|
||||
// To clear fields, copyWith might need to handle nulls explicitly if written that way,
|
||||
// but here we might pass empty string or handle logic.
|
||||
// Actually, copyWith signature usually ignores nulls.
|
||||
// I'll assume updating with empty string or handle it in provider,
|
||||
// but for now let's just use empty string to signify removal if logic supports it.
|
||||
// Wait, copyWith `privacyPin: privacyPin ?? this.privacyPin`.
|
||||
// If I pass null, it keeps existing. I can't clear it via standard copyWith unless I change copyWith logic or pass emptiness.
|
||||
// I'll update the userProfile object directly and save? No, Hive object.
|
||||
// For now, let's treat "empty string" as no PIN if I can pass it.
|
||||
user.copyWith(privacyPin: '', isBioProtected: false, isHistoryProtected: false)
|
||||
);
|
||||
if (mounted) ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('PIN Removed')));
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(user.copyWith(
|
||||
privacyPin: '', isBioProtected: false, isHistoryProtected: false));
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(content: Text('PIN Removed')));
|
||||
}
|
||||
} else {
|
||||
if (mounted) ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Incorrect PIN')));
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(content: Text('Incorrect PIN')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> _showPinDialog(BuildContext context, {required String title}) {
|
||||
Future<String?> _showPinDialog(BuildContext context,
|
||||
{required String title}) {
|
||||
final controller = TextEditingController();
|
||||
return showDialog<String>(
|
||||
context: context,
|
||||
@@ -143,7 +155,9 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
decoration: const InputDecoration(hintText: 'Enter 4-digit PIN'),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('Cancel')),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Cancel')),
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(context, controller.text),
|
||||
child: const Text('OK'),
|
||||
@@ -155,9 +169,13 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool syncPeriodToHealth = _hasPermissions;
|
||||
final user = ref.watch(userProfileProvider);
|
||||
final hasPin = user?.privacyPin != null && user!.privacyPin!.isNotEmpty;
|
||||
if (user == null) {
|
||||
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
||||
}
|
||||
|
||||
final hasPin = user.privacyPin != null && user.privacyPin!.isNotEmpty;
|
||||
bool syncPeriodToHealth = _hasPermissions;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -166,111 +184,135 @@ class _PrivacySettingsScreenState extends ConsumerState<PrivacySettingsScreen> {
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
// Security Section
|
||||
Text('App Security', style: Theme.of(context).textTheme.titleMedium?.copyWith(color: Theme.of(context).colorScheme.primary)),
|
||||
Text('App Security',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium
|
||||
?.copyWith(color: Theme.of(context).colorScheme.primary)),
|
||||
const SizedBox(height: 8),
|
||||
ListTile(
|
||||
title: const Text('Privacy PIN'),
|
||||
subtitle: Text(hasPin ? 'PIN is set' : 'Protect sensitive data with a PIN'),
|
||||
trailing: hasPin ? const Icon(Icons.lock, color: Colors.green) : const Icon(Icons.lock_open),
|
||||
subtitle: Text(
|
||||
hasPin ? 'PIN is set' : 'Protect sensitive data with a PIN'),
|
||||
trailing: hasPin
|
||||
? const Icon(Icons.lock, color: Colors.green)
|
||||
: const Icon(Icons.lock_open),
|
||||
onTap: () {
|
||||
if (hasPin) {
|
||||
showModalBottomSheet(context: context, builder: (context) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit),
|
||||
title: const Text('Change PIN'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_setPin();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete, color: Colors.red),
|
||||
title: const Text('Remove PIN'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_removePin();
|
||||
},
|
||||
),
|
||||
],
|
||||
));
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit),
|
||||
title: const Text('Change PIN'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_setPin();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading:
|
||||
const Icon(Icons.delete, color: Colors.red),
|
||||
title: const Text('Remove PIN'),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_removePin();
|
||||
},
|
||||
),
|
||||
],
|
||||
));
|
||||
} else {
|
||||
_setPin();
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
if (hasPin) ...[
|
||||
SwitchListTile(
|
||||
title: const Text('Use Biometrics'),
|
||||
subtitle: const Text('Unlock with FaceID / Fingerprint'),
|
||||
value: user?.isBioProtected ?? false,
|
||||
value: user.isBioProtected,
|
||||
onChanged: (val) {
|
||||
ref.read(userProfileProvider.notifier).updateProfile(user!.copyWith(isBioProtected: val));
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(user.copyWith(isBioProtected: val));
|
||||
},
|
||||
),
|
||||
|
||||
const Divider(),
|
||||
const Text('Protected Features', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey)),
|
||||
const Text('Protected Features',
|
||||
style:
|
||||
TextStyle(fontWeight: FontWeight.bold, color: Colors.grey)),
|
||||
SwitchListTile(
|
||||
title: const Text('Daily Logs'),
|
||||
value: user?.isLogProtected ?? false,
|
||||
value: user.isLogProtected,
|
||||
onChanged: (val) {
|
||||
ref.read(userProfileProvider.notifier).updateProfile(user!.copyWith(isLogProtected: val));
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(user.copyWith(isLogProtected: val));
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
SwitchListTile(
|
||||
title: const Text('Calendar'),
|
||||
value: user?.isCalendarProtected ?? false,
|
||||
value: user.isCalendarProtected,
|
||||
onChanged: (val) {
|
||||
ref.read(userProfileProvider.notifier).updateProfile(user!.copyWith(isCalendarProtected: val));
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(user.copyWith(isCalendarProtected: val));
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
SwitchListTile(
|
||||
title: const Text('Supplies / Pad Tracker'),
|
||||
value: user?.isSuppliesProtected ?? false,
|
||||
value: user.isSuppliesProtected,
|
||||
onChanged: (val) {
|
||||
ref.read(userProfileProvider.notifier).updateProfile(user!.copyWith(isSuppliesProtected: val));
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(user.copyWith(isSuppliesProtected: val));
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
title: const Text('Cycle History'),
|
||||
value: user?.isHistoryProtected ?? false,
|
||||
value: user.isHistoryProtected,
|
||||
onChanged: (val) {
|
||||
ref.read(userProfileProvider.notifier).updateProfile(user!.copyWith(isHistoryProtected: val));
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(user.copyWith(isHistoryProtected: val));
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
const Divider(height: 32),
|
||||
|
||||
// Health Section
|
||||
Text('Health App Integration', style: Theme.of(context).textTheme.titleMedium?.copyWith(color: Theme.of(context).colorScheme.primary)),
|
||||
Text('Health App Integration',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium
|
||||
?.copyWith(color: Theme.of(context).colorScheme.primary)),
|
||||
const SizedBox(height: 8),
|
||||
ListTile(
|
||||
title: const Text('Health Source'),
|
||||
subtitle: _hasPermissions
|
||||
? const Text('Connected to Health App.')
|
||||
: const Text('Not connected. Tap to grant access.'),
|
||||
trailing: _hasPermissions ? const Icon(Icons.check_circle, color: Colors.green) : const Icon(Icons.warning, color: Colors.orange),
|
||||
trailing: _hasPermissions
|
||||
? const Icon(Icons.check_circle, color: Colors.green)
|
||||
: const Icon(Icons.warning, color: Colors.orange),
|
||||
onTap: _requestPermissions,
|
||||
),
|
||||
SwitchListTile(
|
||||
title: const Text('Sync Period Days'),
|
||||
subtitle: const Text('Automatically sync period dates.'),
|
||||
value: syncPeriodToHealth,
|
||||
onChanged: _hasPermissions ? (value) async {
|
||||
if (value) {
|
||||
await _syncPeriodDays(true);
|
||||
} else {
|
||||
await _syncPeriodDays(false);
|
||||
}
|
||||
setState(() {
|
||||
syncPeriodToHealth = value; // Update local state for toggle
|
||||
});
|
||||
} : null,
|
||||
onChanged: _hasPermissions
|
||||
? (value) async {
|
||||
if (value) {
|
||||
await _syncPeriodDays(true);
|
||||
} else {
|
||||
await _syncPeriodDays(false);
|
||||
}
|
||||
setState(() {
|
||||
syncPeriodToHealth = value;
|
||||
});
|
||||
}
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -17,70 +17,85 @@ class RelationshipSettingsScreen extends ConsumerWidget {
|
||||
),
|
||||
body: userProfile == null
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
const Text(
|
||||
'Select your current relationship status to customize your experience.',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// Sample Data Button
|
||||
Center(
|
||||
child: TextButton.icon(
|
||||
onPressed: () {
|
||||
final user = ref.read(userProfileProvider);
|
||||
if (user != null) {
|
||||
final samplePlan = TeachingPlan.create(
|
||||
topic: 'Walking in Love',
|
||||
scriptureReference: 'Ephesians 5:1-2',
|
||||
notes: 'As Christ loved us and gave himself up for us, a fragrant offering and sacrifice to God. Let our marriage reflect this sacrificial love.',
|
||||
date: DateTime.now(),
|
||||
);
|
||||
|
||||
final List<TeachingPlan> updatedPlans = [...(user.teachingPlans ?? []), samplePlan];
|
||||
ref.read(userProfileProvider.notifier).updateProfile(
|
||||
user.copyWith(teachingPlans: updatedPlans)
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Sample Teaching Plan Loaded! Check Devotional page.')),
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.science_outlined),
|
||||
label: const Text('Load Sample Teaching Plan (Demo)'),
|
||||
: RadioGroup<RelationshipStatus>(
|
||||
groupValue: userProfile.relationshipStatus,
|
||||
onChanged: (RelationshipStatus? newValue) {
|
||||
if (newValue != null) {
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateRelationshipStatus(newValue);
|
||||
}
|
||||
},
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: [
|
||||
const Text(
|
||||
'Select your current relationship status to customize your experience.',
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Single',
|
||||
subtitle: 'Tracking for potential future',
|
||||
value: RelationshipStatus.single,
|
||||
groupValue: userProfile.relationshipStatus,
|
||||
icon: Icons.person_outline,
|
||||
),
|
||||
_buildOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Engaged',
|
||||
subtitle: 'Preparing for marriage',
|
||||
value: RelationshipStatus.engaged,
|
||||
groupValue: userProfile.relationshipStatus,
|
||||
icon: Icons.favorite_border,
|
||||
),
|
||||
_buildOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Married',
|
||||
subtitle: 'Tracking together with husband',
|
||||
value: RelationshipStatus.married,
|
||||
groupValue: userProfile.relationshipStatus,
|
||||
icon: Icons.favorite,
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 16),
|
||||
// Sample Data Button
|
||||
Center(
|
||||
child: TextButton.icon(
|
||||
onPressed: () {
|
||||
final user = ref.read(userProfileProvider);
|
||||
if (user != null) {
|
||||
final samplePlan = TeachingPlan.create(
|
||||
topic: 'Walking in Love',
|
||||
scriptureReference: 'Ephesians 5:1-2',
|
||||
notes:
|
||||
'As Christ loved us and gave himself up for us, a fragrant offering and sacrifice to God. Let our marriage reflect this sacrificial love.',
|
||||
date: DateTime.now(),
|
||||
);
|
||||
|
||||
final List<TeachingPlan> updatedPlans = [
|
||||
...(user.teachingPlans ?? []),
|
||||
samplePlan
|
||||
];
|
||||
ref.read(userProfileProvider.notifier).updateProfile(
|
||||
user.copyWith(teachingPlans: updatedPlans));
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Sample Teaching Plan Loaded! Check Devotional page.')),
|
||||
);
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.science_outlined),
|
||||
label: const Text('Load Sample Teaching Plan (Demo)'),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
_buildOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Single',
|
||||
subtitle: 'Tracking for potential future',
|
||||
value: RelationshipStatus.single,
|
||||
groupValue: userProfile.relationshipStatus,
|
||||
icon: Icons.person_outline,
|
||||
),
|
||||
_buildOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Engaged',
|
||||
subtitle: 'Preparing for marriage',
|
||||
value: RelationshipStatus.engaged,
|
||||
groupValue: userProfile.relationshipStatus,
|
||||
icon: Icons.favorite_border,
|
||||
),
|
||||
_buildOption(
|
||||
context,
|
||||
ref,
|
||||
title: 'Married',
|
||||
subtitle: 'Tracking together with husband',
|
||||
value: RelationshipStatus.married,
|
||||
groupValue: userProfile.relationshipStatus,
|
||||
icon: Icons.favorite,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -98,7 +113,7 @@ class RelationshipSettingsScreen extends ConsumerWidget {
|
||||
|
||||
return Card(
|
||||
elevation: isSelected ? 2 : 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: isSelected
|
||||
? BorderSide(color: Theme.of(context).colorScheme.primary, width: 2)
|
||||
@@ -106,17 +121,10 @@ class RelationshipSettingsScreen extends ConsumerWidget {
|
||||
),
|
||||
child: RadioListTile<RelationshipStatus>(
|
||||
value: value,
|
||||
groupValue: groupValue,
|
||||
onChanged: (RelationshipStatus? newValue) {
|
||||
if (newValue != null) {
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateRelationshipStatus(newValue);
|
||||
}
|
||||
},
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.w600)),
|
||||
subtitle: Text(subtitle),
|
||||
secondary: Icon(icon, color: isSelected ? Theme.of(context).colorScheme.primary : null),
|
||||
secondary: Icon(icon,
|
||||
color: isSelected ? Theme.of(context).colorScheme.primary : null),
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../../theme/app_theme.dart';
|
||||
import '../../models/user_profile.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
|
||||
class SharingSettingsScreen extends ConsumerWidget {
|
||||
@@ -31,7 +30,9 @@ class SharingSettingsScreen extends ConsumerWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.link),
|
||||
title: const Text('Link with Husband'),
|
||||
subtitle: Text(userProfile.partnerName != null ? 'Linked to ${userProfile.partnerName}' : 'Not linked'),
|
||||
subtitle: Text(userProfile.partnerName != null
|
||||
? 'Linked to ${userProfile.partnerName}'
|
||||
: 'Not linked'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => _showShareDialog(context, ref),
|
||||
),
|
||||
@@ -67,9 +68,8 @@ class SharingSettingsScreen extends ConsumerWidget {
|
||||
title: const Text('Share Energy Levels'),
|
||||
value: userProfile.shareEnergyLevels,
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(userProfile.copyWith(shareEnergyLevels: value));
|
||||
ref.read(userProfileProvider.notifier).updateProfile(
|
||||
userProfile.copyWith(shareEnergyLevels: value));
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
@@ -98,16 +98,17 @@ class SharingSettingsScreen extends ConsumerWidget {
|
||||
void _showShareDialog(BuildContext context, WidgetRef ref) {
|
||||
// Generate a simple pairing code
|
||||
final userProfile = ref.read(userProfileProvider);
|
||||
final pairingCode = userProfile?.id?.substring(0, 6).toUpperCase() ?? 'ABC123';
|
||||
final pairingCode =
|
||||
userProfile?.id.substring(0, 6).toUpperCase() ?? 'ABC123';
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Row(
|
||||
title: const Row(
|
||||
children: [
|
||||
Icon(Icons.share_outlined, color: AppColors.navyBlue),
|
||||
const SizedBox(width: 8),
|
||||
const Text('Share with Husband'),
|
||||
SizedBox(width: 8),
|
||||
Text('Share with Husband'),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
@@ -115,15 +116,17 @@ class SharingSettingsScreen extends ConsumerWidget {
|
||||
children: [
|
||||
Text(
|
||||
'Share this code with your husband so he can connect to your cycle data:',
|
||||
style: GoogleFonts.outfit(fontSize: 14, color: AppColors.warmGray),
|
||||
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),
|
||||
color: AppColors.navyBlue.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.navyBlue.withOpacity(0.3)),
|
||||
border: Border.all(
|
||||
color: AppColors.navyBlue.withValues(alpha: 0.3)),
|
||||
),
|
||||
child: SelectableText(
|
||||
pairingCode,
|
||||
@@ -138,7 +141,8 @@ class SharingSettingsScreen extends ConsumerWidget {
|
||||
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),
|
||||
style:
|
||||
GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -5,10 +5,9 @@ import '../../theme/app_theme.dart';
|
||||
import '../../models/user_profile.dart';
|
||||
import '../../providers/user_provider.dart';
|
||||
import '../../services/notification_service.dart';
|
||||
import '../../widgets/pad_settings_dialog.dart'; // We can reuse the logic, but maybe embed it directly or just link it.
|
||||
// Actually, let's rebuild the UI here properly as a screen instead of a dialog,
|
||||
// or for now, since we already have the dialog logic working well, let's just
|
||||
// have this screen trigger the dialog or embed the same widgets.
|
||||
// or for now, since we already have the dialog logic working well, let's just
|
||||
// have this screen trigger the dialog or embed the same widgets.
|
||||
// However, the user asked to "make a new setting page", so a full screen is better.
|
||||
// I'll copy the logic from the dialog into this screen for a seamless experience.
|
||||
|
||||
@@ -16,16 +15,18 @@ class SuppliesSettingsScreen extends ConsumerStatefulWidget {
|
||||
const SuppliesSettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<SuppliesSettingsScreen> createState() => _SuppliesSettingsScreenState();
|
||||
ConsumerState<SuppliesSettingsScreen> createState() =>
|
||||
_SuppliesSettingsScreenState();
|
||||
}
|
||||
|
||||
class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen> {
|
||||
class _SuppliesSettingsScreenState
|
||||
extends ConsumerState<SuppliesSettingsScreen> {
|
||||
bool _isTrackingEnabled = false;
|
||||
int _typicalFlow = 2;
|
||||
int _typicalFlow = 2;
|
||||
bool _isAutoInventoryEnabled = true;
|
||||
bool _showPadTimerMinutes = true;
|
||||
bool _showPadTimerSeconds = false;
|
||||
|
||||
|
||||
// Inventory
|
||||
List<SupplyItem> _supplies = [];
|
||||
int _lowInventoryThreshold = 5;
|
||||
@@ -41,7 +42,7 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
_lowInventoryThreshold = user.lowInventoryThreshold;
|
||||
_showPadTimerMinutes = user.showPadTimerMinutes;
|
||||
_showPadTimerSeconds = user.showPadTimerSeconds;
|
||||
|
||||
|
||||
// Load supplies
|
||||
if (user.padSupplies != null) {
|
||||
_supplies = List.from(user.padSupplies!);
|
||||
@@ -65,19 +66,21 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
padInventoryCount: totalCount,
|
||||
lowInventoryThreshold: _lowInventoryThreshold,
|
||||
);
|
||||
|
||||
await ref.read(userProfileProvider.notifier).updateProfile(updatedProfile);
|
||||
|
||||
await ref
|
||||
.read(userProfileProvider.notifier)
|
||||
.updateProfile(updatedProfile);
|
||||
|
||||
// Check for Low Supply Alert
|
||||
if (updatedProfile.notifyLowSupply &&
|
||||
if (updatedProfile.notifyLowSupply &&
|
||||
totalCount <= updatedProfile.lowInventoryThreshold) {
|
||||
NotificationService().showLocalNotification(
|
||||
id: 2001,
|
||||
title: 'Low Pad Supply',
|
||||
body: 'Your inventory is low ($totalCount left). Time to restock!',
|
||||
);
|
||||
NotificationService().showLocalNotification(
|
||||
id: 2001,
|
||||
title: 'Low Pad Supply',
|
||||
body: 'Your inventory is low ($totalCount left). Time to restock!',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Preferences saved')),
|
||||
@@ -121,7 +124,7 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Toggle
|
||||
// Toggle
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -137,14 +140,14 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
Switch(
|
||||
value: _isTrackingEnabled,
|
||||
onChanged: (val) => setState(() => _isTrackingEnabled = val),
|
||||
activeColor: AppColors.menstrualPhase,
|
||||
activeThumbColor: AppColors.menstrualPhase,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
if (_isTrackingEnabled) ...[
|
||||
const Divider(height: 32),
|
||||
|
||||
|
||||
// Inventory Section
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -161,7 +164,8 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
onPressed: () => _addOrEditSupply(),
|
||||
icon: const Icon(Icons.add),
|
||||
label: const Text('Add Item'),
|
||||
style: TextButton.styleFrom(foregroundColor: AppColors.menstrualPhase),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: AppColors.menstrualPhase),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -170,7 +174,7 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.withOpacity(0.1),
|
||||
color: Colors.grey.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Center(
|
||||
@@ -193,10 +197,12 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
tileColor: Theme.of(context).cardTheme.color,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(color: Colors.black.withOpacity(0.05)),
|
||||
side: BorderSide(
|
||||
color: Colors.black.withValues(alpha: 0.05)),
|
||||
),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: AppColors.menstrualPhase.withOpacity(0.1),
|
||||
backgroundColor:
|
||||
AppColors.menstrualPhase.withValues(alpha: 0.1),
|
||||
child: Text(
|
||||
item.count.toString(),
|
||||
style: GoogleFonts.outfit(
|
||||
@@ -205,10 +211,14 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
),
|
||||
),
|
||||
),
|
||||
title: Text(item.brand, style: GoogleFonts.outfit(fontWeight: FontWeight.w600)),
|
||||
subtitle: Text(item.type.label, style: GoogleFonts.outfit(fontSize: 12)),
|
||||
title: Text(item.brand,
|
||||
style:
|
||||
GoogleFonts.outfit(fontWeight: FontWeight.w600)),
|
||||
subtitle: Text(item.type.label,
|
||||
style: GoogleFonts.outfit(fontSize: 12)),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.delete_outline, color: Colors.red),
|
||||
icon:
|
||||
const Icon(Icons.delete_outline, color: Colors.red),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_supplies.removeAt(index);
|
||||
@@ -221,7 +231,7 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
),
|
||||
|
||||
const Divider(height: 32),
|
||||
|
||||
|
||||
// Typical Flow
|
||||
Text(
|
||||
'Typical Flow Intensity',
|
||||
@@ -234,7 +244,9 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Text('Light', style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray)),
|
||||
Text('Light',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 12, color: AppColors.warmGray)),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: _typicalFlow.toDouble(),
|
||||
@@ -242,42 +254,45 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
max: 5,
|
||||
divisions: 4,
|
||||
activeColor: AppColors.menstrualPhase,
|
||||
onChanged: (val) => setState(() => _typicalFlow = val.round()),
|
||||
onChanged: (val) =>
|
||||
setState(() => _typicalFlow = val.round()),
|
||||
),
|
||||
),
|
||||
Text('Heavy', style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray)),
|
||||
Text('Heavy',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 12, color: AppColors.warmGray)),
|
||||
],
|
||||
),
|
||||
Center(
|
||||
child: Text(
|
||||
'$_typicalFlow/5',
|
||||
style: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.menstrualPhase
|
||||
)
|
||||
),
|
||||
child: Text('$_typicalFlow/5',
|
||||
style: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.menstrualPhase)),
|
||||
),
|
||||
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
|
||||
// Auto Deduct Toggle
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
'Auto-deduct on Log',
|
||||
style: GoogleFonts.outfit(fontWeight: FontWeight.w500, color: AppColors.charcoal),
|
||||
),
|
||||
subtitle: Text(
|
||||
'Reduce count when you log a pad',
|
||||
style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray),
|
||||
),
|
||||
value: _isAutoInventoryEnabled,
|
||||
onChanged: (val) => setState(() => _isAutoInventoryEnabled = val),
|
||||
activeColor: AppColors.menstrualPhase,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
'Auto-deduct on Log',
|
||||
style: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.w500, color: AppColors.charcoal),
|
||||
),
|
||||
subtitle: Text(
|
||||
'Reduce count when you log a pad',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 12, color: AppColors.warmGray),
|
||||
),
|
||||
value: _isAutoInventoryEnabled,
|
||||
onChanged: (val) =>
|
||||
setState(() => _isAutoInventoryEnabled = val),
|
||||
activeThumbColor: AppColors.menstrualPhase,
|
||||
),
|
||||
|
||||
const Divider(height: 32),
|
||||
|
||||
|
||||
Text(
|
||||
'Timer Display Settings',
|
||||
style: GoogleFonts.outfit(
|
||||
@@ -289,35 +304,39 @@ class _SuppliesSettingsScreenState extends ConsumerState<SuppliesSettingsScreen>
|
||||
const SizedBox(height: 8),
|
||||
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
'Show Minutes',
|
||||
style: GoogleFonts.outfit(fontWeight: FontWeight.w500, color: AppColors.charcoal),
|
||||
),
|
||||
value: _showPadTimerMinutes,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_showPadTimerMinutes = val;
|
||||
if (!val) {
|
||||
_showPadTimerSeconds = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
activeColor: AppColors.menstrualPhase,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
'Show Minutes',
|
||||
style: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.w500, color: AppColors.charcoal),
|
||||
),
|
||||
value: _showPadTimerMinutes,
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_showPadTimerMinutes = val;
|
||||
if (!val) {
|
||||
_showPadTimerSeconds = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
activeThumbColor: AppColors.menstrualPhase,
|
||||
),
|
||||
|
||||
SwitchListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
'Show Seconds',
|
||||
style: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: _showPadTimerMinutes ? AppColors.charcoal : AppColors.warmGray
|
||||
),
|
||||
),
|
||||
value: _showPadTimerSeconds,
|
||||
onChanged: _showPadTimerMinutes ? (val) => setState(() => _showPadTimerSeconds = val) : null,
|
||||
activeColor: AppColors.menstrualPhase,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
'Show Seconds',
|
||||
style: GoogleFonts.outfit(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: _showPadTimerMinutes
|
||||
? AppColors.charcoal
|
||||
: AppColors.warmGray),
|
||||
),
|
||||
value: _showPadTimerSeconds,
|
||||
onChanged: _showPadTimerMinutes
|
||||
? (val) => setState(() => _showPadTimerSeconds = val)
|
||||
: null,
|
||||
activeThumbColor: AppColors.menstrualPhase,
|
||||
),
|
||||
],
|
||||
],
|
||||
@@ -345,11 +364,12 @@ class _SupplyDialogState extends State<_SupplyDialog> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_brandController = TextEditingController(text: widget.initialItem?.brand ?? '');
|
||||
_brandController =
|
||||
TextEditingController(text: widget.initialItem?.brand ?? '');
|
||||
_type = widget.initialItem?.type ?? PadType.regular;
|
||||
_count = widget.initialItem?.count ?? 0;
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_brandController.dispose();
|
||||
@@ -371,11 +391,13 @@ class _SupplyDialogState extends State<_SupplyDialog> {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<PadType>(
|
||||
value: _type,
|
||||
items: PadType.values.map((t) => DropdownMenuItem(
|
||||
value: t,
|
||||
child: Text(t.label),
|
||||
)).toList(),
|
||||
initialValue: _type,
|
||||
items: PadType.values
|
||||
.map((t) => DropdownMenuItem(
|
||||
value: t,
|
||||
child: Text(t.label),
|
||||
))
|
||||
.toList(),
|
||||
onChanged: (val) => setState(() => _type = val!),
|
||||
decoration: const InputDecoration(labelText: 'Type'),
|
||||
),
|
||||
@@ -383,14 +405,18 @@ class _SupplyDialogState extends State<_SupplyDialog> {
|
||||
TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(labelText: 'Quantity'),
|
||||
controller: TextEditingController(text: _count.toString()), // Hacky for demo, binding needed properly
|
||||
controller: TextEditingController(
|
||||
text: _count
|
||||
.toString()), // Hacky for demo, binding needed properly
|
||||
onChanged: (val) => _count = int.tryParse(val) ?? 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: const Text('Cancel')),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('Cancel')),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_brandController.text.isEmpty) return;
|
||||
|
||||
@@ -9,13 +9,15 @@ import '../providers/user_provider.dart';
|
||||
import 'husband/husband_home_screen.dart';
|
||||
|
||||
class SplashScreen extends ConsumerStatefulWidget {
|
||||
const SplashScreen({super.key});
|
||||
final bool isStartup;
|
||||
const SplashScreen({super.key, this.isStartup = false});
|
||||
|
||||
@override
|
||||
ConsumerState<SplashScreen> createState() => _SplashScreenState();
|
||||
}
|
||||
|
||||
class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerProviderStateMixin {
|
||||
class _SplashScreenState extends ConsumerState<SplashScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _fadeAnimation;
|
||||
late Animation<double> _scaleAnimation;
|
||||
@@ -44,16 +46,18 @@ class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerPr
|
||||
|
||||
_controller.forward();
|
||||
|
||||
// Navigate after splash
|
||||
Future.delayed(const Duration(milliseconds: 1200), () {
|
||||
_navigateToNextScreen();
|
||||
});
|
||||
// Navigate after splash ONLY if not managed by AppStartupWidget
|
||||
if (!widget.isStartup) {
|
||||
Future.delayed(const Duration(milliseconds: 1200), () {
|
||||
_navigateToNextScreen();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _navigateToNextScreen() {
|
||||
final user = ref.read(userProfileProvider);
|
||||
final hasProfile = user != null;
|
||||
|
||||
|
||||
Widget nextScreen;
|
||||
if (!hasProfile) {
|
||||
nextScreen = const OnboardingScreen();
|
||||
@@ -103,7 +107,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerPr
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColors.blushPink,
|
||||
AppColors.rose.withOpacity(0.8),
|
||||
AppColors.rose.withValues(alpha: 0.8),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -111,7 +115,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerPr
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.rose.withOpacity(0.3),
|
||||
color: AppColors.rose.withValues(alpha: 0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 10),
|
||||
),
|
||||
@@ -124,7 +128,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerPr
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
|
||||
// App Name placeholder
|
||||
Text(
|
||||
'Period Tracker',
|
||||
@@ -135,7 +139,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerPr
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
|
||||
// Tagline
|
||||
Text(
|
||||
'Faith-Centered Wellness',
|
||||
@@ -147,7 +151,7 @@ class _SplashScreenState extends ConsumerState<SplashScreen> with SingleTickerPr
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
|
||||
|
||||
// Scripture
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 48),
|
||||
|
||||
Reference in New Issue
Block a user