Resolve all lints and deprecation warnings

This commit is contained in:
2026-01-09 10:04:51 -06:00
parent 512577b092
commit a799e9cf59
56 changed files with 2819 additions and 3159 deletions

View File

@@ -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,
),
],