Refactor: Implement multi-item inventory for Pad Tracker and dynamic navigation
This commit is contained in:
@@ -742,6 +742,136 @@ class _HusbandTipsScreen extends StatelessWidget {
|
||||
'🙏 Pray for her physical comfort',
|
||||
]),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Period Supplies (Dynamic)
|
||||
Consumer(
|
||||
builder: (context, ref, child) {
|
||||
final user = ref.watch(userProfileProvider);
|
||||
if (user == null || !user.isPadTrackingEnabled) return const SizedBox.shrink();
|
||||
|
||||
final brand = user.padBrand ?? 'Not specified';
|
||||
final flow = user.typicalFlowIntensity;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.menstrualPhase.withOpacity(0.15),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: AppColors.menstrualPhase.withOpacity(0.3)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(Icons.shopping_bag_outlined, color: AppColors.menstrualPhase, size: 20),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'Period Supplies',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.navyBlue,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'She uses:',
|
||||
style: GoogleFonts.outfit(fontSize: 14, color: AppColors.warmGray),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
brand,
|
||||
style: GoogleFonts.outfit(fontSize: 18, fontWeight: FontWeight.bold, color: AppColors.navyBlue),
|
||||
),
|
||||
if (flow != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Typical Flow: $flow/5',
|
||||
style: GoogleFonts.outfit(fontSize: 14, color: AppColors.charcoal),
|
||||
),
|
||||
],
|
||||
if (user.padAbsorbency != null) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'Absorbency: ${user.padAbsorbency}/5',
|
||||
style: GoogleFonts.outfit(fontSize: 14, color: AppColors.charcoal),
|
||||
),
|
||||
],
|
||||
|
||||
// Low Stock Warning
|
||||
if (user.padInventoryCount <= user.lowInventoryThreshold) ...[
|
||||
const SizedBox(height: 12),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.rose.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.rose),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.warning_amber_rounded, color: AppColors.rose, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'LOW STOCK! (${user.padInventoryCount} left)',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.rose
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigate to settings
|
||||
final parentState = context.findAncestorStateOfType<_HusbandHomeScreenState>();
|
||||
if (parentState != null) {
|
||||
parentState.setState(() {
|
||||
parentState._selectedIndex = 5; // Settings tab
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'Check Settings to Sync',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 12,
|
||||
decoration: TextDecoration.underline,
|
||||
color: AppColors.rose,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
_buildTipCategory('Follicular Phase', [
|
||||
'🎉 Plan dates or activities—her energy is returning',
|
||||
'💬 She may be more talkative and social',
|
||||
@@ -781,6 +911,14 @@ class _HusbandTipsScreen extends StatelessWidget {
|
||||
'🌹 Small gestures matter more than grand ones',
|
||||
'🙏 Pray for her daily',
|
||||
]),
|
||||
const SizedBox(height: 16),
|
||||
_buildTipCategory("Men's Health", [
|
||||
'💪 Exercise regularly to boost energy and mood',
|
||||
'🥗 Eat a balanced diet rich in protein and vegetables',
|
||||
'😴 Prioritize 7-8 hours of sleep for recovery',
|
||||
'💧 Stay hydrated throughout the day',
|
||||
'🧠 Practice stress management techniques',
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user