Resolve all lints and deprecation warnings
This commit is contained in:
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(
|
||||
|
||||
Reference in New Issue
Block a user