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

@@ -97,12 +97,12 @@ class _CycleRingState extends State<CycleRing>
horizontal: 12, vertical: 6),
decoration: BoxDecoration(
color: _getPhaseColor(widget.phase)
.withOpacity(isDark ? 0.3 : 0.2),
.withValues(alpha: isDark ? 0.3 : 0.2),
borderRadius: BorderRadius.circular(20),
border: isDark
? Border.all(
color: _getPhaseColor(widget.phase)
.withOpacity(0.5))
.withValues(alpha: 0.5))
: null,
),
child: Row(
@@ -133,8 +133,9 @@ class _CycleRingState extends State<CycleRing>
: 'Period expected',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 12,
color:
Theme.of(context).colorScheme.onSurfaceVariant,
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
),
),
],
@@ -181,8 +182,8 @@ class _CycleRingPainter extends CustomPainter {
// Background arc
final bgPaint = Paint()
..color =
(isDark ? Colors.white : AppColors.lightGray).withOpacity(isDark ? 0.05 : 0.1)
..color = (isDark ? Colors.white : AppColors.lightGray)
.withValues(alpha: isDark ? 0.05 : 0.1)
..style = PaintingStyle.stroke
..strokeWidth = strokeWidth
..strokeCap = StrokeCap.round;
@@ -235,16 +236,12 @@ class _CycleRingPainter extends CustomPainter {
return [
AppColors.sageGreen,
AppColors.follicularPhase,
AppColors.sageGreen.withOpacity(0.7)
AppColors.sageGreen.withValues(alpha: 0.7)
];
case CyclePhase.ovulation:
return [AppColors.lavender, AppColors.ovulationPhase, AppColors.rose];
case CyclePhase.luteal:
return [
AppColors.lutealPhase,
AppColors.lavender,
AppColors.blushPink
];
return [AppColors.lutealPhase, AppColors.lavender, AppColors.blushPink];
}
}

View File

@@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../theme/app_theme.dart';
import '../../providers/user_provider.dart';
import '../../models/user_profile.dart'; // Import UserProfile
class PadSettingsDialog extends ConsumerStatefulWidget {
const PadSettingsDialog({super.key});
@@ -16,12 +15,12 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
bool _isTrackingEnabled = false;
int _typicalFlow = 2; // Mediumish
int _padAbsorbency = 3; // Regular
// Inventory State
int _padInventoryCount = 0;
int _lowInventoryThreshold = 5;
bool _isAutoInventoryEnabled = true;
final TextEditingController _brandController = TextEditingController();
@override
@@ -32,12 +31,12 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
_isTrackingEnabled = user.isPadTrackingEnabled;
_typicalFlow = user.typicalFlowIntensity ?? 2;
_padAbsorbency = user.padAbsorbency ?? 3;
// Init Inventory
_padInventoryCount = user.padInventoryCount;
_lowInventoryThreshold = user.lowInventoryThreshold;
_isAutoInventoryEnabled = user.isAutoInventoryEnabled;
_brandController.text = user.padBrand ?? '';
}
}
@@ -58,12 +57,18 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
padInventoryCount: _padInventoryCount,
lowInventoryThreshold: _lowInventoryThreshold,
isAutoInventoryEnabled: _isAutoInventoryEnabled,
lastInventoryUpdate: (_padInventoryCount != (user.padInventoryCount)) ? DateTime.now() : user.lastInventoryUpdate,
padBrand: _brandController.text.trim().isEmpty ? null : _brandController.text.trim(),
lastInventoryUpdate: (_padInventoryCount != (user.padInventoryCount))
? DateTime.now()
: user.lastInventoryUpdate,
padBrand: _brandController.text.trim().isEmpty
? null
: _brandController.text.trim(),
);
await ref.read(userProfileProvider.notifier).updateProfile(updatedProfile);
await ref
.read(userProfileProvider.notifier)
.updateProfile(updatedProfile);
if (mounted) {
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
@@ -92,7 +97,7 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
),
),
const SizedBox(height: 24),
// Toggle
Row(
children: [
@@ -108,14 +113,14 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
Switch(
value: _isTrackingEnabled,
onChanged: (val) => setState(() => _isTrackingEnabled = val),
activeColor: AppColors.menstrualPhase,
activeThumbColor: AppColors.menstrualPhase,
),
],
),
if (_isTrackingEnabled) ...[
const Divider(height: 32),
// Typical Flow
Text(
'Typical Flow Intensity',
@@ -128,34 +133,40 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
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(),
min: 1,
max: 5,
divisions: 4,
activeColor: AppColors.menstrualPhase,
onChanged: (val) => setState(() => _typicalFlow = val.round()),
activeColor: AppColors
.menstrualPhase, // Slider still uses activeColor in many versions, check specifically.
// If it's SwitchListTile, it's activeColor, Slider is activeColor.
// Actually, let's keep it as is if it's not deprecated for Slider.
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: 20),
// Pad Absorbency
Text(
Text(
'Pad Absorbency/Capacity',
style: GoogleFonts.outfit(
fontSize: 14,
@@ -166,11 +177,15 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
const SizedBox(height: 4),
Text(
'Regular(3), Super(4), Overnight(5)',
style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray.withOpacity(0.8)),
style: GoogleFonts.outfit(
fontSize: 12,
color: AppColors.warmGray.withValues(alpha: 0.8)),
),
Row(
children: [
Text('Low', style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray)),
Text('Low',
style: GoogleFonts.outfit(
fontSize: 12, color: AppColors.warmGray)),
Expanded(
child: Slider(
value: _padAbsorbency.toDouble(),
@@ -178,24 +193,24 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
max: 5,
divisions: 4,
activeColor: AppColors.menstrualPhase,
onChanged: (val) => setState(() => _padAbsorbency = val.round()),
onChanged: (val) =>
setState(() => _padAbsorbency = val.round()),
),
),
Text('High', style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray)),
Text('High',
style: GoogleFonts.outfit(
fontSize: 12, color: AppColors.warmGray)),
],
),
Center(
child: Text(
'$_padAbsorbency/5',
style: GoogleFonts.outfit(
fontWeight: FontWeight.bold,
color: AppColors.menstrualPhase
)
),
child: Text('$_padAbsorbency/5',
style: GoogleFonts.outfit(
fontWeight: FontWeight.bold,
color: AppColors.menstrualPhase)),
),
const SizedBox(height: 20),
// Brand
Text(
'Preferred Brand',
@@ -211,12 +226,13 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
decoration: InputDecoration(
hintText: 'e.g., Always Infinity, Cora, Period Undies...',
filled: true,
fillColor: AppColors.warmCream.withOpacity(0.5),
fillColor: AppColors.warmCream.withValues(alpha: 0.5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide.none,
),
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
contentPadding:
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
),
),
@@ -227,9 +243,10 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
// Inventory Management Header
Row(
children: [
Icon(Icons.inventory_2_outlined, size: 20, color: AppColors.navyBlue),
const SizedBox(width: 8),
Text(
const Icon(Icons.inventory_2_outlined,
size: 20, color: AppColors.navyBlue),
const SizedBox(width: 8),
Text(
'Inventory Tracking',
style: GoogleFonts.outfit(
fontSize: 16,
@@ -250,38 +267,45 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
children: [
Text(
'Current Stock',
style: GoogleFonts.outfit(fontWeight: FontWeight.w500, color: AppColors.warmGray),
style: GoogleFonts.outfit(
fontWeight: FontWeight.w500,
color: AppColors.warmGray),
),
Text(
'Pad Inventory',
style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray.withOpacity(0.8)),
style: GoogleFonts.outfit(
fontSize: 12,
color: AppColors.warmGray.withValues(alpha: 0.8)),
),
],
),
),
Container(
decoration: BoxDecoration(
color: AppColors.warmCream.withOpacity(0.5),
color: AppColors.warmCream.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(12),
),
child: Row(
children: [
IconButton(
icon: const Icon(Icons.remove, size: 20, color: AppColors.navyBlue),
icon: const Icon(Icons.remove,
size: 20, color: AppColors.navyBlue),
onPressed: () {
if (_padInventoryCount > 0) setState(() => _padInventoryCount--);
if (_padInventoryCount > 0) {
setState(() => _padInventoryCount--);
}
},
),
Text(
'$_padInventoryCount',
style: GoogleFonts.outfit(
fontSize: 18,
fontWeight: FontWeight.bold,
color: AppColors.navyBlue
),
fontSize: 18,
fontWeight: FontWeight.bold,
color: AppColors.navyBlue),
),
IconButton(
icon: const Icon(Icons.add, size: 20, color: AppColors.navyBlue),
icon: const Icon(Icons.add,
size: 20, color: AppColors.navyBlue),
onPressed: () => setState(() => _padInventoryCount++),
),
],
@@ -289,7 +313,7 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
),
],
),
const SizedBox(height: 16),
// Low Stock Threshold
@@ -301,11 +325,15 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
children: [
Text(
'Low Stock Alert',
style: GoogleFonts.outfit(fontWeight: FontWeight.w500, color: AppColors.warmGray),
style: GoogleFonts.outfit(
fontWeight: FontWeight.w500,
color: AppColors.warmGray),
),
Text(
'Warn when below $_lowInventoryThreshold',
style: GoogleFonts.outfit(fontSize: 12, color: AppColors.warmGray.withOpacity(0.8)),
style: GoogleFonts.outfit(
fontSize: 12,
color: AppColors.warmGray.withValues(alpha: 0.8)),
),
],
),
@@ -318,7 +346,8 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
max: 20,
divisions: 19,
activeColor: AppColors.rose,
onChanged: (val) => setState(() => _lowInventoryThreshold = val.round()),
onChanged: (val) =>
setState(() => _lowInventoryThreshold = val.round()),
),
),
],
@@ -326,23 +355,26 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
// 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 SizedBox(height: 32),
// Buttons
Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -360,7 +392,8 @@ class _PadSettingsDialogState extends ConsumerState<PadSettingsDialog> {
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.navyBlue,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
),
child: const Text('Save'),
),

View File

@@ -136,8 +136,9 @@ class _PadTrackerCardState extends ConsumerState<PadTrackerCard> {
@override
Widget build(BuildContext context) {
final user = ref.watch(userProfileProvider);
if (user == null || !user.isPadTrackingEnabled)
if (user == null || !user.isPadTrackingEnabled) {
return const SizedBox.shrink();
}
return GestureDetector(
onTap: () {
@@ -151,10 +152,10 @@ class _PadTrackerCardState extends ConsumerState<PadTrackerCard> {
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: _statusColor.withOpacity(0.3)),
border: Border.all(color: _statusColor.withValues(alpha: 0.3)),
boxShadow: [
BoxShadow(
color: _statusColor.withOpacity(0.1),
color: _statusColor.withValues(alpha: 0.1),
blurRadius: 10,
offset: const Offset(0, 4),
),
@@ -167,7 +168,7 @@ class _PadTrackerCardState extends ConsumerState<PadTrackerCard> {
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: _statusColor.withOpacity(0.1),
color: _statusColor.withValues(alpha: 0.1),
shape: BoxShape.circle,
),
child:
@@ -224,7 +225,7 @@ class _PadTrackerCardState extends ConsumerState<PadTrackerCard> {
borderRadius: BorderRadius.circular(4),
child: LinearProgressIndicator(
value: _progress,
backgroundColor: _statusColor.withOpacity(0.1),
backgroundColor: _statusColor.withValues(alpha: 0.1),
valueColor: AlwaysStoppedAnimation<Color>(_statusColor),
minHeight: 6,
),

View File

@@ -3,8 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart';
import '../providers/user_provider.dart';
import '../theme/app_theme.dart';
import '../providers/navigation_provider.dart';
import '../models/user_profile.dart';
import 'quick_log_dialog.dart';
class QuickLogButtons extends ConsumerWidget {
@@ -92,8 +90,9 @@ class QuickLogButtons extends ConsumerWidget {
}) {
final isDark = Theme.of(context).brightness == Brightness.dark;
return Container(
width: 100, // Fixed width for grid item
return SizedBox(
height: 80,
width: 75,
child: Material(
color: Colors.transparent,
child: InkWell(
@@ -102,9 +101,11 @@ class QuickLogButtons extends ConsumerWidget {
child: Container(
padding: const EdgeInsets.symmetric(vertical: 16),
decoration: BoxDecoration(
color: color.withOpacity(isDark ? 0.2 : 0.15),
color: color.withValues(alpha: isDark ? 0.2 : 0.15),
borderRadius: BorderRadius.circular(12),
border: isDark ? Border.all(color: color.withOpacity(0.3)) : null,
border: isDark
? Border.all(color: color.withValues(alpha: 0.3))
: null,
),
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -117,7 +118,7 @@ class QuickLogButtons extends ConsumerWidget {
style: GoogleFonts.outfit(
fontSize: 12, // Slightly larger text
fontWeight: FontWeight.w600,
color: isDark ? Colors.white.withOpacity(0.9) : color,
color: isDark ? Colors.white.withValues(alpha: 0.9) : color,
),
),
],

View File

@@ -7,7 +7,7 @@ import '../models/cycle_entry.dart';
import '../providers/user_provider.dart';
import '../providers/navigation_provider.dart';
import '../screens/log/pad_tracker_screen.dart';
import '../theme/app_theme.dart';
import '../services/notification_service.dart';
class QuickLogDialog extends ConsumerStatefulWidget {
final String logType;
@@ -39,7 +39,7 @@ class _QuickLogDialogState extends ConsumerState<QuickLogDialog> {
};
final TextEditingController _cravingController = TextEditingController();
List<String> _cravings = [];
final List<String> _cravings = [];
List<String> _recentCravings = [];
@override
@@ -110,7 +110,7 @@ class _QuickLogDialogState extends ConsumerState<QuickLogDialog> {
}
Widget _buildSymptomsLog() {
return Container(
return SizedBox(
width: double.maxFinite,
child: ListView(
shrinkWrap: true,
@@ -139,7 +139,7 @@ class _QuickLogDialogState extends ConsumerState<QuickLogDialog> {
}
Widget _buildCravingsLog() {
return Container(
return SizedBox(
width: double.maxFinite,
child: Column(
mainAxisSize: MainAxisSize.min,

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '../theme/app_theme.dart';
import '../models/cycle_entry.dart';
@@ -35,11 +34,12 @@ class ScriptureCard extends StatelessWidget {
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: isDark
? Colors.white.withOpacity(0.05)
: Colors.black.withOpacity(0.05)),
? Colors.white.withValues(alpha: 0.05)
: Colors.black.withValues(alpha: 0.05)),
boxShadow: [
BoxShadow(
color: _getPhaseColor(phase).withOpacity(isDark ? 0.05 : 0.15),
color:
_getPhaseColor(phase).withValues(alpha: isDark ? 0.05 : 0.15),
blurRadius: 15,
offset: const Offset(0, 8),
),
@@ -60,7 +60,7 @@ class ScriptureCard extends StatelessWidget {
height: 32,
decoration: BoxDecoration(
color: (isDark ? Colors.white : Colors.black)
.withOpacity(0.1),
.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(
@@ -68,7 +68,7 @@ class ScriptureCard extends StatelessWidget {
size: 18,
color: isDark
? Colors.white70
: AppColors.charcoal.withOpacity(0.8),
: AppColors.charcoal.withValues(alpha: 0.8),
),
),
const SizedBox(width: 8),
@@ -78,7 +78,7 @@ class ScriptureCard extends StatelessWidget {
fontSize: 12,
color: isDark
? const Color(0xFFE0E0E0)
: AppColors.charcoal.withOpacity(0.7),
: AppColors.charcoal.withValues(alpha: 0.7),
letterSpacing: 0.5,
),
),
@@ -111,11 +111,11 @@ class ScriptureCard extends StatelessWidget {
horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: (isDark ? Colors.white : Colors.black)
.withOpacity(0.05),
.withValues(alpha: 0.05),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: (isDark ? Colors.white : Colors.black)
.withOpacity(0.1),
.withValues(alpha: 0.1),
),
),
child: Row(
@@ -133,9 +133,8 @@ class ScriptureCard extends StatelessWidget {
Icon(
Icons.swap_horiz,
size: 14,
color: isDark
? Colors.white38
: AppColors.warmGray,
color:
isDark ? Colors.white38 : AppColors.warmGray,
),
],
),
@@ -157,22 +156,22 @@ class ScriptureCard extends StatelessWidget {
switch (phase) {
case CyclePhase.menstrual:
return [
AppColors.menstrualPhase.withOpacity(isDark ? 0.15 : 0.6),
AppColors.menstrualPhase.withValues(alpha: isDark ? 0.15 : 0.6),
baseColor,
];
case CyclePhase.follicular:
return [
AppColors.follicularPhase.withOpacity(isDark ? 0.15 : 0.3),
AppColors.follicularPhase.withValues(alpha: isDark ? 0.15 : 0.3),
baseColor,
];
case CyclePhase.ovulation:
return [
AppColors.ovulationPhase.withOpacity(isDark ? 0.15 : 0.5),
AppColors.ovulationPhase.withValues(alpha: isDark ? 0.15 : 0.5),
baseColor,
];
case CyclePhase.luteal:
return [
AppColors.lutealPhase.withOpacity(isDark ? 0.15 : 0.3),
AppColors.lutealPhase.withValues(alpha: isDark ? 0.15 : 0.3),
baseColor,
];
}

View File

@@ -25,12 +25,13 @@ class TipCard extends StatelessWidget {
decoration: BoxDecoration(
color: theme.cardColor,
borderRadius: BorderRadius.circular(16),
border:
isDark ? Border.all(color: Colors.white.withOpacity(0.05)) : null,
border: isDark
? Border.all(color: Colors.white.withValues(alpha: 0.05))
: null,
boxShadow: [
BoxShadow(
color: (isDark ? Colors.black : AppColors.charcoal)
.withOpacity(0.05),
.withValues(alpha: 0.05),
blurRadius: 10,
offset: const Offset(0, 4),
),
@@ -43,7 +44,7 @@ class TipCard extends StatelessWidget {
width: 40,
height: 40,
decoration: BoxDecoration(
color: AppColors.sageGreen.withOpacity(isDark ? 0.2 : 0.15),
color: AppColors.sageGreen.withValues(alpha: isDark ? 0.2 : 0.15),
borderRadius: BorderRadius.circular(10),
),
child: const Icon(