Initial commit: Fixes for linting and compilation
This commit is contained in:
195
lib/widgets/cycle_ring.dart
Normal file
195
lib/widgets/cycle_ring.dart
Normal file
@@ -0,0 +1,195 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'dart:math' as math;
|
||||
import '../theme/app_theme.dart';
|
||||
import '../models/cycle_entry.dart';
|
||||
|
||||
class CycleRing extends StatelessWidget {
|
||||
final int dayOfCycle;
|
||||
final int totalDays;
|
||||
final CyclePhase phase;
|
||||
|
||||
const CycleRing({
|
||||
super.key,
|
||||
required this.dayOfCycle,
|
||||
required this.totalDays,
|
||||
required this.phase,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final progress = dayOfCycle / totalDays;
|
||||
final daysUntilNextPeriod = totalDays - dayOfCycle;
|
||||
|
||||
return Container(
|
||||
width: 220,
|
||||
height: 220,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
// Background ring
|
||||
CustomPaint(
|
||||
size: const Size(220, 220),
|
||||
painter: _CycleRingPainter(
|
||||
progress: progress,
|
||||
phase: phase,
|
||||
),
|
||||
),
|
||||
|
||||
// Center content
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Day $dayOfCycle',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 32,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.charcoal,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: _getPhaseColor(phase).withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
phase.emoji,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
phase.label,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: _getPhaseColor(phase),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
daysUntilNextPeriod > 0
|
||||
? '$daysUntilNextPeriod days until period'
|
||||
: 'Period expected',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 12,
|
||||
color: AppColors.warmGray,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Color _getPhaseColor(CyclePhase phase) {
|
||||
switch (phase) {
|
||||
case CyclePhase.menstrual:
|
||||
return AppColors.menstrualPhase;
|
||||
case CyclePhase.follicular:
|
||||
return AppColors.follicularPhase;
|
||||
case CyclePhase.ovulation:
|
||||
return AppColors.ovulationPhase;
|
||||
case CyclePhase.luteal:
|
||||
return AppColors.lutealPhase;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _CycleRingPainter extends CustomPainter {
|
||||
final double progress;
|
||||
final CyclePhase phase;
|
||||
|
||||
_CycleRingPainter({required this.progress, required this.phase});
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final center = Offset(size.width / 2, size.height / 2);
|
||||
final radius = size.width / 2 - 15;
|
||||
const strokeWidth = 12.0;
|
||||
|
||||
// Background arc
|
||||
final bgPaint = Paint()
|
||||
..color = AppColors.lightGray.withOpacity(0.2)
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = strokeWidth
|
||||
..strokeCap = StrokeCap.round;
|
||||
|
||||
canvas.drawCircle(center, radius, bgPaint);
|
||||
|
||||
// Progress arc
|
||||
final progressPaint = Paint()
|
||||
..shader = SweepGradient(
|
||||
startAngle: -math.pi / 2,
|
||||
endAngle: math.pi * 1.5,
|
||||
colors: _getGradientColors(phase),
|
||||
stops: const [0.0, 0.5, 1.0],
|
||||
).createShader(Rect.fromCircle(center: center, radius: radius))
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = strokeWidth
|
||||
..strokeCap = StrokeCap.round;
|
||||
|
||||
canvas.drawArc(
|
||||
Rect.fromCircle(center: center, radius: radius),
|
||||
-math.pi / 2,
|
||||
2 * math.pi * progress,
|
||||
false,
|
||||
progressPaint,
|
||||
);
|
||||
|
||||
// Dot at current position
|
||||
final dotAngle = -math.pi / 2 + 2 * math.pi * progress;
|
||||
final dotX = center.dx + radius * math.cos(dotAngle);
|
||||
final dotY = center.dy + radius * math.sin(dotAngle);
|
||||
|
||||
final dotPaint = Paint()
|
||||
..color = Colors.white
|
||||
..style = PaintingStyle.fill;
|
||||
|
||||
final dotBorderPaint = Paint()
|
||||
..color = _getPhaseColor(phase)
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = 3;
|
||||
|
||||
canvas.drawCircle(Offset(dotX, dotY), 8, dotPaint);
|
||||
canvas.drawCircle(Offset(dotX, dotY), 8, dotBorderPaint);
|
||||
}
|
||||
|
||||
List<Color> _getGradientColors(CyclePhase phase) {
|
||||
switch (phase) {
|
||||
case CyclePhase.menstrual:
|
||||
return [AppColors.rose, AppColors.menstrualPhase, AppColors.blushPink];
|
||||
case CyclePhase.follicular:
|
||||
return [AppColors.sageGreen, AppColors.follicularPhase, AppColors.sageGreen.withOpacity(0.7)];
|
||||
case CyclePhase.ovulation:
|
||||
return [AppColors.lavender, AppColors.ovulationPhase, AppColors.rose];
|
||||
case CyclePhase.luteal:
|
||||
return [AppColors.lutealPhase, AppColors.lavender, AppColors.blushPink];
|
||||
}
|
||||
}
|
||||
|
||||
Color _getPhaseColor(CyclePhase phase) {
|
||||
switch (phase) {
|
||||
case CyclePhase.menstrual:
|
||||
return AppColors.menstrualPhase;
|
||||
case CyclePhase.follicular:
|
||||
return AppColors.follicularPhase;
|
||||
case CyclePhase.ovulation:
|
||||
return AppColors.ovulationPhase;
|
||||
case CyclePhase.luteal:
|
||||
return AppColors.lutealPhase;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
|
||||
}
|
||||
95
lib/widgets/quick_log_buttons.dart
Normal file
95
lib/widgets/quick_log_buttons.dart
Normal file
@@ -0,0 +1,95 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../theme/app_theme.dart';
|
||||
import '../screens/log/log_screen.dart';
|
||||
|
||||
class QuickLogButtons extends StatelessWidget {
|
||||
const QuickLogButtons({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
_buildQuickButton(
|
||||
icon: Icons.water_drop_outlined,
|
||||
label: 'Period',
|
||||
color: AppColors.menstrualPhase,
|
||||
onTap: () => _navigateToLog(context),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildQuickButton(
|
||||
icon: Icons.emoji_emotions_outlined,
|
||||
label: 'Mood',
|
||||
color: AppColors.softGold,
|
||||
onTap: () => _navigateToLog(context),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildQuickButton(
|
||||
icon: Icons.flash_on_outlined,
|
||||
label: 'Energy',
|
||||
color: AppColors.follicularPhase,
|
||||
onTap: () => _navigateToLog(context),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
_buildQuickButton(
|
||||
icon: Icons.healing_outlined,
|
||||
label: 'Symptoms',
|
||||
color: AppColors.lavender,
|
||||
onTap: () => _navigateToLog(context),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
void _navigateToLog(BuildContext context) {
|
||||
// Navigate to the Log tab (index 2) of HomeScreen if possible,
|
||||
// but since we are inside a tab, we can't easily switch the parent tab index without context. Using a provider or callback would be best.
|
||||
// For now, let's push the LogScreen as a new route for "Quick Log" feel.
|
||||
// Ideally we would switch the BottomNavBar index.
|
||||
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => const Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size.fromHeight(0),
|
||||
child: SizedBox.shrink()
|
||||
),
|
||||
body: LogScreen()
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildQuickButton({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
required Color color,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.15),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, color: color, size: 24),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
label,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
134
lib/widgets/scripture_card.dart
Normal file
134
lib/widgets/scripture_card.dart
Normal file
@@ -0,0 +1,134 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../theme/app_theme.dart';
|
||||
import '../models/cycle_entry.dart';
|
||||
|
||||
class ScriptureCard extends StatelessWidget {
|
||||
final String verse;
|
||||
final String reference;
|
||||
final CyclePhase phase;
|
||||
|
||||
const ScriptureCard({
|
||||
super.key,
|
||||
required this.verse,
|
||||
required this.reference,
|
||||
required this.phase,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: _getGradientColors(phase),
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: _getPhaseColor(phase).withOpacity(0.2),
|
||||
blurRadius: 15,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Scripture icon
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.menu_book_outlined,
|
||||
size: 18,
|
||||
color: AppColors.charcoal.withOpacity(0.8),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Today\'s Verse',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.charcoal.withOpacity(0.7),
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Verse
|
||||
Text(
|
||||
'"$verse"',
|
||||
style: GoogleFonts.lora(
|
||||
fontSize: 16,
|
||||
fontStyle: FontStyle.italic,
|
||||
color: AppColors.charcoal,
|
||||
height: 1.6,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Reference
|
||||
Text(
|
||||
'— $reference',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.warmGray,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Color> _getGradientColors(CyclePhase phase) {
|
||||
switch (phase) {
|
||||
case CyclePhase.menstrual:
|
||||
return [
|
||||
AppColors.blushPink.withOpacity(0.6),
|
||||
AppColors.cream,
|
||||
];
|
||||
case CyclePhase.follicular:
|
||||
return [
|
||||
AppColors.sageGreen.withOpacity(0.3),
|
||||
AppColors.cream,
|
||||
];
|
||||
case CyclePhase.ovulation:
|
||||
return [
|
||||
AppColors.lavender.withOpacity(0.5),
|
||||
AppColors.cream,
|
||||
];
|
||||
case CyclePhase.luteal:
|
||||
return [
|
||||
AppColors.lutealPhase.withOpacity(0.3),
|
||||
AppColors.cream,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Color _getPhaseColor(CyclePhase phase) {
|
||||
switch (phase) {
|
||||
case CyclePhase.menstrual:
|
||||
return AppColors.menstrualPhase;
|
||||
case CyclePhase.follicular:
|
||||
return AppColors.follicularPhase;
|
||||
case CyclePhase.ovulation:
|
||||
return AppColors.ovulationPhase;
|
||||
case CyclePhase.luteal:
|
||||
return AppColors.lutealPhase;
|
||||
}
|
||||
}
|
||||
}
|
||||
95
lib/widgets/tip_card.dart
Normal file
95
lib/widgets/tip_card.dart
Normal file
@@ -0,0 +1,95 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import '../theme/app_theme.dart';
|
||||
import '../models/cycle_entry.dart';
|
||||
|
||||
class TipCard extends StatelessWidget {
|
||||
final CyclePhase phase;
|
||||
final bool isMarried;
|
||||
|
||||
const TipCard({
|
||||
super.key,
|
||||
required this.phase,
|
||||
required this.isMarried,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tip = _getTipForPhase(phase, isMarried);
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.charcoal.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.sageGreen.withOpacity(0.15),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.lightbulb_outline,
|
||||
color: AppColors.sageGreen,
|
||||
size: 22,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Today\'s Tip',
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.charcoal,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
tip,
|
||||
style: GoogleFonts.outfit(
|
||||
fontSize: 13,
|
||||
color: AppColors.warmGray,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _getTipForPhase(CyclePhase phase, bool isMarried) {
|
||||
switch (phase) {
|
||||
case CyclePhase.menstrual:
|
||||
return 'This is a time for rest. Honor your body with extra sleep, warm drinks, and gentle movement. God designed your body with wisdom.';
|
||||
case CyclePhase.follicular:
|
||||
return 'Your energy is rising! This is a great time to start new projects, exercise more intensely, and spend time in community.';
|
||||
case CyclePhase.ovulation:
|
||||
if (isMarried) {
|
||||
return 'This is your most fertile window. You may feel more social and energetic. Prioritize connection with your spouse.';
|
||||
}
|
||||
return 'You may feel more social and confident during this phase. It\'s a great time for important conversations and presentations.';
|
||||
case CyclePhase.luteal:
|
||||
return 'As you enter the luteal phase, focus on nourishing foods, adequate sleep, and stress management. Be gentle with yourself.';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user