积分、成就系统
This commit is contained in:
@@ -231,5 +231,305 @@
|
||||
"hindi": "हिन्दी (Hindi)",
|
||||
"indonesian": "Bahasa Indonesia (Indonesian)",
|
||||
"italian": "Italiano (Italian)",
|
||||
"arabic": "العربية (Arabic)"
|
||||
"arabic": "العربية (Arabic)",
|
||||
|
||||
"points": "Points",
|
||||
"@points": {
|
||||
"description": "Points label"
|
||||
},
|
||||
|
||||
"level": "Level",
|
||||
"@level": {
|
||||
"description": "Level label"
|
||||
},
|
||||
|
||||
"checked": "Checked",
|
||||
"@checked": {
|
||||
"description": "Already checked in today"
|
||||
},
|
||||
|
||||
"checkIn": "Check In",
|
||||
"@checkIn": {
|
||||
"description": "Check in button text"
|
||||
},
|
||||
|
||||
"earnedPoints": "Earned:",
|
||||
"@earnedPoints": {
|
||||
"description": "Points earned label on complete screen"
|
||||
},
|
||||
|
||||
"basePoints": "Base Points",
|
||||
"@basePoints": {
|
||||
"description": "Base points from focus time"
|
||||
},
|
||||
|
||||
"honestyBonus": "Honesty Bonus",
|
||||
"@honestyBonus": {
|
||||
"description": "Bonus points for recording distractions"
|
||||
},
|
||||
|
||||
"totalPoints": "Total Points: {count} ⚡",
|
||||
"@totalPoints": {
|
||||
"description": "Total accumulated points",
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"distractionsRecorded": "({count} {distractionText} recorded)",
|
||||
"@distractionsRecorded": {
|
||||
"description": "Number of distractions recorded",
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
},
|
||||
"distractionText": {}
|
||||
}
|
||||
},
|
||||
|
||||
"achievementUnlocked": "🎖️ Achievement Unlocked!",
|
||||
"@achievementUnlocked": {
|
||||
"description": "Achievement unlocked title"
|
||||
},
|
||||
|
||||
"bonusPoints": "+{points} Points ⚡",
|
||||
"@bonusPoints": {
|
||||
"description": "Bonus points awarded",
|
||||
"placeholders": {
|
||||
"points": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"checkInSuccess": "Check-in successful! +{points} points ⚡",
|
||||
"@checkInSuccess": {
|
||||
"description": "Check-in success message",
|
||||
"placeholders": {
|
||||
"points": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"weeklyStreakBonus": "🎉 Weekly streak bonus!",
|
||||
"@weeklyStreakBonus": {
|
||||
"description": "Weekly streak bonus message"
|
||||
},
|
||||
|
||||
"newAchievementUnlocked": "🎖️ New achievement unlocked!",
|
||||
"@newAchievementUnlocked": {
|
||||
"description": "New achievement unlocked message"
|
||||
},
|
||||
|
||||
"alreadyCheckedIn": "You have already checked in today! Come back tomorrow 📅",
|
||||
"@alreadyCheckedIn": {
|
||||
"description": "Already checked in message"
|
||||
},
|
||||
|
||||
"checkInCalendar": "Check-In Calendar 📅",
|
||||
"@checkInCalendar": {
|
||||
"description": "Check-in calendar section title"
|
||||
},
|
||||
|
||||
"checkInToday": "📅 Check In Today",
|
||||
"@checkInToday": {
|
||||
"description": "Check in today button"
|
||||
},
|
||||
|
||||
"checkedInToday": "✓ Checked In Today",
|
||||
"@checkedInToday": {
|
||||
"description": "Already checked in today status"
|
||||
},
|
||||
|
||||
"currentStreak": "🔥 Current Streak",
|
||||
"@currentStreak": {
|
||||
"description": "Current check-in streak label"
|
||||
},
|
||||
|
||||
"longestStreak": "🏆 Longest Streak",
|
||||
"@longestStreak": {
|
||||
"description": "Longest check-in streak label"
|
||||
},
|
||||
|
||||
"days": "days",
|
||||
"@days": {
|
||||
"description": "Days label"
|
||||
},
|
||||
|
||||
"daysCount": "{count} days",
|
||||
"@daysCount": {
|
||||
"description": "Days with count",
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"achievements": "Achievements 🎖️",
|
||||
"@achievements": {
|
||||
"description": "Achievements section title"
|
||||
},
|
||||
|
||||
"viewAllAchievements": "View All Achievements",
|
||||
"@viewAllAchievements": {
|
||||
"description": "View all achievements button"
|
||||
},
|
||||
|
||||
"allAchievementsComingSoon": "Full achievements screen coming soon!",
|
||||
"@allAchievementsComingSoon": {
|
||||
"description": "Coming soon message for full achievements screen"
|
||||
},
|
||||
|
||||
"profile": "Profile",
|
||||
"@profile": {
|
||||
"description": "Profile screen title"
|
||||
},
|
||||
|
||||
"focuser": "Focuser",
|
||||
"@focuser": {
|
||||
"description": "Default user name"
|
||||
},
|
||||
|
||||
"pointsToNextLevel": "{points} points to Level {level}",
|
||||
"@pointsToNextLevel": {
|
||||
"description": "Points needed to reach next level",
|
||||
"placeholders": {
|
||||
"points": {
|
||||
"type": "int"
|
||||
},
|
||||
"level": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"achievement_first_session_name": "Focus Newbie",
|
||||
"@achievement_first_session_name": {
|
||||
"description": "First session achievement name"
|
||||
},
|
||||
"achievement_first_session_desc": "Complete your first focus session",
|
||||
"@achievement_first_session_desc": {
|
||||
"description": "First session achievement description"
|
||||
},
|
||||
|
||||
"achievement_sessions_10_name": "Getting Started",
|
||||
"@achievement_sessions_10_name": {
|
||||
"description": "10 sessions achievement name"
|
||||
},
|
||||
"achievement_sessions_10_desc": "Complete 10 focus sessions",
|
||||
"@achievement_sessions_10_desc": {
|
||||
"description": "10 sessions achievement description"
|
||||
},
|
||||
|
||||
"achievement_sessions_50_name": "Focus Enthusiast",
|
||||
"@achievement_sessions_50_name": {
|
||||
"description": "50 sessions achievement name"
|
||||
},
|
||||
"achievement_sessions_50_desc": "Complete 50 focus sessions",
|
||||
"@achievement_sessions_50_desc": {
|
||||
"description": "50 sessions achievement description"
|
||||
},
|
||||
|
||||
"achievement_sessions_100_name": "Focus Master",
|
||||
"@achievement_sessions_100_name": {
|
||||
"description": "100 sessions achievement name"
|
||||
},
|
||||
"achievement_sessions_100_desc": "Complete 100 focus sessions",
|
||||
"@achievement_sessions_100_desc": {
|
||||
"description": "100 sessions achievement description"
|
||||
},
|
||||
|
||||
"achievement_honest_bronze_name": "Honest Tracker · Bronze",
|
||||
"@achievement_honest_bronze_name": {
|
||||
"description": "50 distractions achievement name"
|
||||
},
|
||||
"achievement_honest_bronze_desc": "Record 50 distractions honestly",
|
||||
"@achievement_honest_bronze_desc": {
|
||||
"description": "50 distractions achievement description"
|
||||
},
|
||||
|
||||
"achievement_honest_silver_name": "Honest Tracker · Silver",
|
||||
"@achievement_honest_silver_name": {
|
||||
"description": "200 distractions achievement name"
|
||||
},
|
||||
"achievement_honest_silver_desc": "Record 200 distractions honestly",
|
||||
"@achievement_honest_silver_desc": {
|
||||
"description": "200 distractions achievement description"
|
||||
},
|
||||
|
||||
"achievement_honest_gold_name": "Honest Tracker · Gold",
|
||||
"@achievement_honest_gold_name": {
|
||||
"description": "500 distractions achievement name"
|
||||
},
|
||||
"achievement_honest_gold_desc": "Record 500 distractions honestly",
|
||||
"@achievement_honest_gold_desc": {
|
||||
"description": "500 distractions achievement description"
|
||||
},
|
||||
|
||||
"achievement_marathon_name": "Marathon Runner",
|
||||
"@achievement_marathon_name": {
|
||||
"description": "10 hours achievement name"
|
||||
},
|
||||
"achievement_marathon_desc": "Accumulate 10 hours of focus time",
|
||||
"@achievement_marathon_desc": {
|
||||
"description": "10 hours achievement description"
|
||||
},
|
||||
|
||||
"achievement_century_name": "Century Club",
|
||||
"@achievement_century_name": {
|
||||
"description": "100 hours achievement name"
|
||||
},
|
||||
"achievement_century_desc": "Accumulate 100 hours of focus time",
|
||||
"@achievement_century_desc": {
|
||||
"description": "100 hours achievement description"
|
||||
},
|
||||
|
||||
"achievement_master_name": "Focus Grandmaster",
|
||||
"@achievement_master_name": {
|
||||
"description": "1000 hours achievement name"
|
||||
},
|
||||
"achievement_master_desc": "Accumulate 1000 hours of focus time",
|
||||
"@achievement_master_desc": {
|
||||
"description": "1000 hours achievement description"
|
||||
},
|
||||
|
||||
"achievement_persistence_star_name": "Persistence Star",
|
||||
"@achievement_persistence_star_name": {
|
||||
"description": "7 day streak achievement name"
|
||||
},
|
||||
"achievement_persistence_star_desc": "Check in for 7 consecutive days",
|
||||
"@achievement_persistence_star_desc": {
|
||||
"description": "7 day streak achievement description"
|
||||
},
|
||||
|
||||
"achievement_monthly_habit_name": "Monthly Habit",
|
||||
"@achievement_monthly_habit_name": {
|
||||
"description": "30 day streak achievement name"
|
||||
},
|
||||
"achievement_monthly_habit_desc": "Check in for 30 consecutive days",
|
||||
"@achievement_monthly_habit_desc": {
|
||||
"description": "30 day streak achievement description"
|
||||
},
|
||||
|
||||
"achievement_centurion_name": "Centurion",
|
||||
"@achievement_centurion_name": {
|
||||
"description": "100 day streak achievement name"
|
||||
},
|
||||
"achievement_centurion_desc": "Check in for 100 consecutive days",
|
||||
"@achievement_centurion_desc": {
|
||||
"description": "100 day streak achievement description"
|
||||
},
|
||||
|
||||
"achievement_year_warrior_name": "Year Warrior",
|
||||
"@achievement_year_warrior_name": {
|
||||
"description": "365 day streak achievement name"
|
||||
},
|
||||
"achievement_year_warrior_desc": "Check in for 365 consecutive days",
|
||||
"@achievement_year_warrior_desc": {
|
||||
"description": "365 day streak achievement description"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,6 +656,342 @@ abstract class AppLocalizations {
|
||||
/// In en, this message translates to:
|
||||
/// **'العربية (Arabic)'**
|
||||
String get arabic;
|
||||
|
||||
/// Points label
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Points'**
|
||||
String get points;
|
||||
|
||||
/// Level label
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Level'**
|
||||
String get level;
|
||||
|
||||
/// Already checked in today
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Checked'**
|
||||
String get checked;
|
||||
|
||||
/// Check in button text
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Check In'**
|
||||
String get checkIn;
|
||||
|
||||
/// Points earned label on complete screen
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Earned:'**
|
||||
String get earnedPoints;
|
||||
|
||||
/// Base points from focus time
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Base Points'**
|
||||
String get basePoints;
|
||||
|
||||
/// Bonus points for recording distractions
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Honesty Bonus'**
|
||||
String get honestyBonus;
|
||||
|
||||
/// Total accumulated points
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Total Points: {count} ⚡'**
|
||||
String totalPoints(int count);
|
||||
|
||||
/// Number of distractions recorded
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'({count} {distractionText} recorded)'**
|
||||
String distractionsRecorded(int count, Object distractionText);
|
||||
|
||||
/// Achievement unlocked title
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'🎖️ Achievement Unlocked!'**
|
||||
String get achievementUnlocked;
|
||||
|
||||
/// Bonus points awarded
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'+{points} Points ⚡'**
|
||||
String bonusPoints(int points);
|
||||
|
||||
/// Check-in success message
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Check-in successful! +{points} points ⚡'**
|
||||
String checkInSuccess(int points);
|
||||
|
||||
/// Weekly streak bonus message
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'🎉 Weekly streak bonus!'**
|
||||
String get weeklyStreakBonus;
|
||||
|
||||
/// New achievement unlocked message
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'🎖️ New achievement unlocked!'**
|
||||
String get newAchievementUnlocked;
|
||||
|
||||
/// Already checked in message
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'You have already checked in today! Come back tomorrow 📅'**
|
||||
String get alreadyCheckedIn;
|
||||
|
||||
/// Check-in calendar section title
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Check-In Calendar 📅'**
|
||||
String get checkInCalendar;
|
||||
|
||||
/// Check in today button
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'📅 Check In Today'**
|
||||
String get checkInToday;
|
||||
|
||||
/// Already checked in today status
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'✓ Checked In Today'**
|
||||
String get checkedInToday;
|
||||
|
||||
/// Current check-in streak label
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'🔥 Current Streak'**
|
||||
String get currentStreak;
|
||||
|
||||
/// Longest check-in streak label
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'🏆 Longest Streak'**
|
||||
String get longestStreak;
|
||||
|
||||
/// Days label
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'days'**
|
||||
String get days;
|
||||
|
||||
/// Days with count
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'{count} days'**
|
||||
String daysCount(int count);
|
||||
|
||||
/// Achievements section title
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Achievements 🎖️'**
|
||||
String get achievements;
|
||||
|
||||
/// View all achievements button
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'View All Achievements'**
|
||||
String get viewAllAchievements;
|
||||
|
||||
/// Coming soon message for full achievements screen
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Full achievements screen coming soon!'**
|
||||
String get allAchievementsComingSoon;
|
||||
|
||||
/// Profile screen title
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Profile'**
|
||||
String get profile;
|
||||
|
||||
/// Default user name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Focuser'**
|
||||
String get focuser;
|
||||
|
||||
/// Points needed to reach next level
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'{points} points to Level {level}'**
|
||||
String pointsToNextLevel(int points, int level);
|
||||
|
||||
/// First session achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Focus Newbie'**
|
||||
String get achievement_first_session_name;
|
||||
|
||||
/// First session achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Complete your first focus session'**
|
||||
String get achievement_first_session_desc;
|
||||
|
||||
/// 10 sessions achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Getting Started'**
|
||||
String get achievement_sessions_10_name;
|
||||
|
||||
/// 10 sessions achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Complete 10 focus sessions'**
|
||||
String get achievement_sessions_10_desc;
|
||||
|
||||
/// 50 sessions achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Focus Enthusiast'**
|
||||
String get achievement_sessions_50_name;
|
||||
|
||||
/// 50 sessions achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Complete 50 focus sessions'**
|
||||
String get achievement_sessions_50_desc;
|
||||
|
||||
/// 100 sessions achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Focus Master'**
|
||||
String get achievement_sessions_100_name;
|
||||
|
||||
/// 100 sessions achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Complete 100 focus sessions'**
|
||||
String get achievement_sessions_100_desc;
|
||||
|
||||
/// 50 distractions achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Honest Tracker · Bronze'**
|
||||
String get achievement_honest_bronze_name;
|
||||
|
||||
/// 50 distractions achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Record 50 distractions honestly'**
|
||||
String get achievement_honest_bronze_desc;
|
||||
|
||||
/// 200 distractions achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Honest Tracker · Silver'**
|
||||
String get achievement_honest_silver_name;
|
||||
|
||||
/// 200 distractions achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Record 200 distractions honestly'**
|
||||
String get achievement_honest_silver_desc;
|
||||
|
||||
/// 500 distractions achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Honest Tracker · Gold'**
|
||||
String get achievement_honest_gold_name;
|
||||
|
||||
/// 500 distractions achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Record 500 distractions honestly'**
|
||||
String get achievement_honest_gold_desc;
|
||||
|
||||
/// 10 hours achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Marathon Runner'**
|
||||
String get achievement_marathon_name;
|
||||
|
||||
/// 10 hours achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Accumulate 10 hours of focus time'**
|
||||
String get achievement_marathon_desc;
|
||||
|
||||
/// 100 hours achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Century Club'**
|
||||
String get achievement_century_name;
|
||||
|
||||
/// 100 hours achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Accumulate 100 hours of focus time'**
|
||||
String get achievement_century_desc;
|
||||
|
||||
/// 1000 hours achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Focus Grandmaster'**
|
||||
String get achievement_master_name;
|
||||
|
||||
/// 1000 hours achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Accumulate 1000 hours of focus time'**
|
||||
String get achievement_master_desc;
|
||||
|
||||
/// 7 day streak achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Persistence Star'**
|
||||
String get achievement_persistence_star_name;
|
||||
|
||||
/// 7 day streak achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Check in for 7 consecutive days'**
|
||||
String get achievement_persistence_star_desc;
|
||||
|
||||
/// 30 day streak achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Monthly Habit'**
|
||||
String get achievement_monthly_habit_name;
|
||||
|
||||
/// 30 day streak achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Check in for 30 consecutive days'**
|
||||
String get achievement_monthly_habit_desc;
|
||||
|
||||
/// 100 day streak achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Centurion'**
|
||||
String get achievement_centurion_name;
|
||||
|
||||
/// 100 day streak achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Check in for 100 consecutive days'**
|
||||
String get achievement_centurion_desc;
|
||||
|
||||
/// 365 day streak achievement name
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Year Warrior'**
|
||||
String get achievement_year_warrior_name;
|
||||
|
||||
/// 365 day streak achievement description
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Check in for 365 consecutive days'**
|
||||
String get achievement_year_warrior_desc;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@@ -333,4 +333,192 @@ class AppLocalizationsAr extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -336,4 +336,192 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -334,4 +334,192 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية (Arabic)';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -337,4 +337,192 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -337,4 +337,192 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -336,4 +336,192 @@ class AppLocalizationsHi extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -336,4 +336,192 @@ class AppLocalizationsId extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -338,4 +338,192 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -329,4 +329,192 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -330,4 +330,192 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -335,4 +335,192 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -341,4 +341,192 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => 'Points';
|
||||
|
||||
@override
|
||||
String get level => 'Level';
|
||||
|
||||
@override
|
||||
String get checked => 'Checked';
|
||||
|
||||
@override
|
||||
String get checkIn => 'Check In';
|
||||
|
||||
@override
|
||||
String get earnedPoints => 'Earned:';
|
||||
|
||||
@override
|
||||
String get basePoints => 'Base Points';
|
||||
|
||||
@override
|
||||
String get honestyBonus => 'Honesty Bonus';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return 'Total Points: $count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText recorded)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ Achievement Unlocked!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points Points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return 'Check-in successful! +$points points ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 Weekly streak bonus!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ New achievement unlocked!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn =>
|
||||
'You have already checked in today! Come back tomorrow 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => 'Check-In Calendar 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 Check In Today';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ Checked In Today';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 Current Streak';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 Longest Streak';
|
||||
|
||||
@override
|
||||
String get days => 'days';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count days';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => 'Achievements 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => 'View All Achievements';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon =>
|
||||
'Full achievements screen coming soon!';
|
||||
|
||||
@override
|
||||
String get profile => 'Profile';
|
||||
|
||||
@override
|
||||
String get focuser => 'Focuser';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '$points points to Level $level';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => 'Focus Newbie';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc =>
|
||||
'Complete your first focus session';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => 'Getting Started';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => 'Complete 10 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => 'Focus Enthusiast';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => 'Complete 50 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => 'Focus Master';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => 'Complete 100 focus sessions';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => 'Honest Tracker · Bronze';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc =>
|
||||
'Record 50 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => 'Honest Tracker · Silver';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc =>
|
||||
'Record 200 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => 'Honest Tracker · Gold';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => 'Record 500 distractions honestly';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => 'Marathon Runner';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => 'Accumulate 10 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => 'Century Club';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => 'Accumulate 100 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => 'Focus Grandmaster';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => 'Accumulate 1000 hours of focus time';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => 'Persistence Star';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc =>
|
||||
'Check in for 7 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => 'Monthly Habit';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc =>
|
||||
'Check in for 30 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => 'Centurion';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => 'Check in for 100 consecutive days';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => 'Year Warrior';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc =>
|
||||
'Check in for 365 consecutive days';
|
||||
}
|
||||
|
||||
@@ -326,4 +326,184 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get arabic => 'العربية';
|
||||
|
||||
@override
|
||||
String get points => '积分';
|
||||
|
||||
@override
|
||||
String get level => '等级';
|
||||
|
||||
@override
|
||||
String get checked => '已签到';
|
||||
|
||||
@override
|
||||
String get checkIn => '签到';
|
||||
|
||||
@override
|
||||
String get earnedPoints => '获得:';
|
||||
|
||||
@override
|
||||
String get basePoints => '基础积分';
|
||||
|
||||
@override
|
||||
String get honestyBonus => '诚实奖励';
|
||||
|
||||
@override
|
||||
String totalPoints(int count) {
|
||||
return '总积分:$count ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String distractionsRecorded(int count, Object distractionText) {
|
||||
return '($count $distractionText 已记录)';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievementUnlocked => '🎖️ 成就解锁!';
|
||||
|
||||
@override
|
||||
String bonusPoints(int points) {
|
||||
return '+$points 积分 ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String checkInSuccess(int points) {
|
||||
return '签到成功!+$points 积分 ⚡';
|
||||
}
|
||||
|
||||
@override
|
||||
String get weeklyStreakBonus => '🎉 连续签到一周奖励!';
|
||||
|
||||
@override
|
||||
String get newAchievementUnlocked => '🎖️ 新成就解锁!';
|
||||
|
||||
@override
|
||||
String get alreadyCheckedIn => '你今天已经签到过了!明天再来 📅';
|
||||
|
||||
@override
|
||||
String get checkInCalendar => '签到日历 📅';
|
||||
|
||||
@override
|
||||
String get checkInToday => '📅 今日签到';
|
||||
|
||||
@override
|
||||
String get checkedInToday => '✓ 今日已签到';
|
||||
|
||||
@override
|
||||
String get currentStreak => '🔥 当前连续';
|
||||
|
||||
@override
|
||||
String get longestStreak => '🏆 最长连续';
|
||||
|
||||
@override
|
||||
String get days => '天';
|
||||
|
||||
@override
|
||||
String daysCount(int count) {
|
||||
return '$count 天';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievements => '成就 🎖️';
|
||||
|
||||
@override
|
||||
String get viewAllAchievements => '查看所有成就';
|
||||
|
||||
@override
|
||||
String get allAchievementsComingSoon => '完整成就页面即将推出!';
|
||||
|
||||
@override
|
||||
String get profile => '个人资料';
|
||||
|
||||
@override
|
||||
String get focuser => '专注者';
|
||||
|
||||
@override
|
||||
String pointsToNextLevel(int points, int level) {
|
||||
return '距离等级 $level 还需 $points 积分';
|
||||
}
|
||||
|
||||
@override
|
||||
String get achievement_first_session_name => '专注新手';
|
||||
|
||||
@override
|
||||
String get achievement_first_session_desc => '完成首个专注会话';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_name => '初露锋芒';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_10_desc => '完成 10 次专注会话';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_name => '专注达人';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_50_desc => '完成 50 次专注会话';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_name => '专注大师';
|
||||
|
||||
@override
|
||||
String get achievement_sessions_100_desc => '完成 100 次专注会话';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_name => '诚实记录者·铜';
|
||||
|
||||
@override
|
||||
String get achievement_honest_bronze_desc => '诚实记录 50 次分心';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_name => '诚实记录者·银';
|
||||
|
||||
@override
|
||||
String get achievement_honest_silver_desc => '诚实记录 200 次分心';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_name => '诚实记录者·金';
|
||||
|
||||
@override
|
||||
String get achievement_honest_gold_desc => '诚实记录 500 次分心';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_name => '马拉松跑者';
|
||||
|
||||
@override
|
||||
String get achievement_marathon_desc => '累计专注 10 小时';
|
||||
|
||||
@override
|
||||
String get achievement_century_name => '百时俱乐部';
|
||||
|
||||
@override
|
||||
String get achievement_century_desc => '累计专注 100 小时';
|
||||
|
||||
@override
|
||||
String get achievement_master_name => '专注宗师';
|
||||
|
||||
@override
|
||||
String get achievement_master_desc => '累计专注 1000 小时';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_name => '坚持之星';
|
||||
|
||||
@override
|
||||
String get achievement_persistence_star_desc => '连续签到 7 天';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_name => '月度习惯';
|
||||
|
||||
@override
|
||||
String get achievement_monthly_habit_desc => '连续签到 30 天';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_name => '百日勇士';
|
||||
|
||||
@override
|
||||
String get achievement_centurion_desc => '连续签到 100 天';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_name => '年度战士';
|
||||
|
||||
@override
|
||||
String get achievement_year_warrior_desc => '连续签到 365 天';
|
||||
}
|
||||
|
||||
@@ -121,5 +121,63 @@
|
||||
"hindi": "हिन्दी",
|
||||
"indonesian": "Bahasa Indonesia",
|
||||
"italian": "Italiano",
|
||||
"arabic": "العربية"
|
||||
"arabic": "العربية",
|
||||
|
||||
"points": "积分",
|
||||
"level": "等级",
|
||||
"checked": "已签到",
|
||||
"checkIn": "签到",
|
||||
"earnedPoints": "获得:",
|
||||
"basePoints": "基础积分",
|
||||
"honestyBonus": "诚实奖励",
|
||||
"totalPoints": "总积分:{count} ⚡",
|
||||
"distractionsRecorded": "({count} {distractionText} 已记录)",
|
||||
"achievementUnlocked": "🎖️ 成就解锁!",
|
||||
"bonusPoints": "+{points} 积分 ⚡",
|
||||
"checkInSuccess": "签到成功!+{points} 积分 ⚡",
|
||||
"weeklyStreakBonus": "🎉 连续签到一周奖励!",
|
||||
"newAchievementUnlocked": "🎖️ 新成就解锁!",
|
||||
"alreadyCheckedIn": "你今天已经签到过了!明天再来 📅",
|
||||
"checkInCalendar": "签到日历 📅",
|
||||
"checkInToday": "📅 今日签到",
|
||||
"checkedInToday": "✓ 今日已签到",
|
||||
"currentStreak": "🔥 当前连续",
|
||||
"longestStreak": "🏆 最长连续",
|
||||
"days": "天",
|
||||
"daysCount": "{count} 天",
|
||||
"achievements": "成就 🎖️",
|
||||
"viewAllAchievements": "查看所有成就",
|
||||
"allAchievementsComingSoon": "完整成就页面即将推出!",
|
||||
"profile": "个人资料",
|
||||
"focuser": "专注者",
|
||||
"pointsToNextLevel": "距离等级 {level} 还需 {points} 积分",
|
||||
|
||||
"achievement_first_session_name": "专注新手",
|
||||
"achievement_first_session_desc": "完成首个专注会话",
|
||||
"achievement_sessions_10_name": "初露锋芒",
|
||||
"achievement_sessions_10_desc": "完成 10 次专注会话",
|
||||
"achievement_sessions_50_name": "专注达人",
|
||||
"achievement_sessions_50_desc": "完成 50 次专注会话",
|
||||
"achievement_sessions_100_name": "专注大师",
|
||||
"achievement_sessions_100_desc": "完成 100 次专注会话",
|
||||
"achievement_honest_bronze_name": "诚实记录者·铜",
|
||||
"achievement_honest_bronze_desc": "诚实记录 50 次分心",
|
||||
"achievement_honest_silver_name": "诚实记录者·银",
|
||||
"achievement_honest_silver_desc": "诚实记录 200 次分心",
|
||||
"achievement_honest_gold_name": "诚实记录者·金",
|
||||
"achievement_honest_gold_desc": "诚实记录 500 次分心",
|
||||
"achievement_marathon_name": "马拉松跑者",
|
||||
"achievement_marathon_desc": "累计专注 10 小时",
|
||||
"achievement_century_name": "百时俱乐部",
|
||||
"achievement_century_desc": "累计专注 100 小时",
|
||||
"achievement_master_name": "专注宗师",
|
||||
"achievement_master_desc": "累计专注 1000 小时",
|
||||
"achievement_persistence_star_name": "坚持之星",
|
||||
"achievement_persistence_star_desc": "连续签到 7 天",
|
||||
"achievement_monthly_habit_name": "月度习惯",
|
||||
"achievement_monthly_habit_desc": "连续签到 30 天",
|
||||
"achievement_centurion_name": "百日勇士",
|
||||
"achievement_centurion_desc": "连续签到 100 天",
|
||||
"achievement_year_warrior_name": "年度战士",
|
||||
"achievement_year_warrior_desc": "连续签到 365 天"
|
||||
}
|
||||
|
||||
190
lib/models/achievement_config.dart
Normal file
190
lib/models/achievement_config.dart
Normal file
@@ -0,0 +1,190 @@
|
||||
/// Achievement types for tracking progress
|
||||
enum AchievementType {
|
||||
sessionCount, // Total number of completed sessions
|
||||
distractionCount, // Total number of recorded distractions
|
||||
totalMinutes, // Total minutes of focus time
|
||||
consecutiveDays, // Consecutive check-in days
|
||||
}
|
||||
|
||||
/// Configuration for a single achievement
|
||||
class AchievementConfig {
|
||||
final String id;
|
||||
final String nameKey; // Localization key for name
|
||||
final String descKey; // Localization key for description
|
||||
final String icon; // Emoji icon
|
||||
final AchievementType type;
|
||||
final int requiredValue;
|
||||
final int bonusPoints; // Points awarded when unlocked
|
||||
|
||||
const AchievementConfig({
|
||||
required this.id,
|
||||
required this.nameKey,
|
||||
required this.descKey,
|
||||
required this.icon,
|
||||
required this.type,
|
||||
required this.requiredValue,
|
||||
required this.bonusPoints,
|
||||
});
|
||||
|
||||
/// All available achievements in the app
|
||||
static List<AchievementConfig> get all => [
|
||||
// First session
|
||||
const AchievementConfig(
|
||||
id: 'first_session',
|
||||
nameKey: 'achievement_first_session_name',
|
||||
descKey: 'achievement_first_session_desc',
|
||||
icon: '🎖️',
|
||||
type: AchievementType.sessionCount,
|
||||
requiredValue: 1,
|
||||
bonusPoints: 10,
|
||||
),
|
||||
|
||||
// Session milestones
|
||||
const AchievementConfig(
|
||||
id: 'sessions_10',
|
||||
nameKey: 'achievement_sessions_10_name',
|
||||
descKey: 'achievement_sessions_10_desc',
|
||||
icon: '⭐',
|
||||
type: AchievementType.sessionCount,
|
||||
requiredValue: 10,
|
||||
bonusPoints: 50,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'sessions_50',
|
||||
nameKey: 'achievement_sessions_50_name',
|
||||
descKey: 'achievement_sessions_50_desc',
|
||||
icon: '🌟',
|
||||
type: AchievementType.sessionCount,
|
||||
requiredValue: 50,
|
||||
bonusPoints: 200,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'sessions_100',
|
||||
nameKey: 'achievement_sessions_100_name',
|
||||
descKey: 'achievement_sessions_100_desc',
|
||||
icon: '💫',
|
||||
type: AchievementType.sessionCount,
|
||||
requiredValue: 100,
|
||||
bonusPoints: 500,
|
||||
),
|
||||
|
||||
// Honesty tracking series (KEY INNOVATION)
|
||||
const AchievementConfig(
|
||||
id: 'honest_bronze',
|
||||
nameKey: 'achievement_honest_bronze_name',
|
||||
descKey: 'achievement_honest_bronze_desc',
|
||||
icon: '🧠',
|
||||
type: AchievementType.distractionCount,
|
||||
requiredValue: 50,
|
||||
bonusPoints: 50,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'honest_silver',
|
||||
nameKey: 'achievement_honest_silver_name',
|
||||
descKey: 'achievement_honest_silver_desc',
|
||||
icon: '🧠',
|
||||
type: AchievementType.distractionCount,
|
||||
requiredValue: 200,
|
||||
bonusPoints: 100,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'honest_gold',
|
||||
nameKey: 'achievement_honest_gold_name',
|
||||
descKey: 'achievement_honest_gold_desc',
|
||||
icon: '🧠',
|
||||
type: AchievementType.distractionCount,
|
||||
requiredValue: 500,
|
||||
bonusPoints: 300,
|
||||
),
|
||||
|
||||
// Focus time milestones
|
||||
const AchievementConfig(
|
||||
id: 'focus_5h',
|
||||
nameKey: 'achievement_focus_5h_name',
|
||||
descKey: 'achievement_focus_5h_desc',
|
||||
icon: '⏱️',
|
||||
type: AchievementType.totalMinutes,
|
||||
requiredValue: 300, // 5 hours
|
||||
bonusPoints: 100,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'focus_25h',
|
||||
nameKey: 'achievement_focus_25h_name',
|
||||
descKey: 'achievement_focus_25h_desc',
|
||||
icon: '⏰',
|
||||
type: AchievementType.totalMinutes,
|
||||
requiredValue: 1500, // 25 hours
|
||||
bonusPoints: 300,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'focus_100h',
|
||||
nameKey: 'achievement_focus_100h_name',
|
||||
descKey: 'achievement_focus_100h_desc',
|
||||
icon: '👑',
|
||||
type: AchievementType.totalMinutes,
|
||||
requiredValue: 6000, // 100 hours
|
||||
bonusPoints: 1000,
|
||||
),
|
||||
|
||||
// Check-in streaks
|
||||
const AchievementConfig(
|
||||
id: 'streak_3',
|
||||
nameKey: 'achievement_streak_3_name',
|
||||
descKey: 'achievement_streak_3_desc',
|
||||
icon: '🔥',
|
||||
type: AchievementType.consecutiveDays,
|
||||
requiredValue: 3,
|
||||
bonusPoints: 20,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'streak_7',
|
||||
nameKey: 'achievement_streak_7_name',
|
||||
descKey: 'achievement_streak_7_desc',
|
||||
icon: '🔥',
|
||||
type: AchievementType.consecutiveDays,
|
||||
requiredValue: 7,
|
||||
bonusPoints: 50,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'streak_30',
|
||||
nameKey: 'achievement_streak_30_name',
|
||||
descKey: 'achievement_streak_30_desc',
|
||||
icon: '🔥',
|
||||
type: AchievementType.consecutiveDays,
|
||||
requiredValue: 30,
|
||||
bonusPoints: 200,
|
||||
),
|
||||
|
||||
const AchievementConfig(
|
||||
id: 'streak_100',
|
||||
nameKey: 'achievement_streak_100_name',
|
||||
descKey: 'achievement_streak_100_desc',
|
||||
icon: '🔥',
|
||||
type: AchievementType.consecutiveDays,
|
||||
requiredValue: 100,
|
||||
bonusPoints: 1000,
|
||||
),
|
||||
];
|
||||
|
||||
/// Get achievement by ID
|
||||
static AchievementConfig? getById(String id) {
|
||||
try {
|
||||
return all.firstWhere((achievement) => achievement.id == id);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get all achievements of a specific type
|
||||
static List<AchievementConfig> getByType(AchievementType type) {
|
||||
return all.where((achievement) => achievement.type == type).toList();
|
||||
}
|
||||
}
|
||||
144
lib/models/user_progress.dart
Normal file
144
lib/models/user_progress.dart
Normal file
@@ -0,0 +1,144 @@
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
part 'user_progress.g.dart';
|
||||
|
||||
@HiveType(typeId: 1)
|
||||
class UserProgress extends HiveObject {
|
||||
@HiveField(0)
|
||||
int totalPoints;
|
||||
|
||||
@HiveField(1)
|
||||
int currentPoints;
|
||||
|
||||
@HiveField(2)
|
||||
DateTime? lastCheckInDate;
|
||||
|
||||
@HiveField(3)
|
||||
int consecutiveCheckIns;
|
||||
|
||||
@HiveField(4)
|
||||
Map<String, DateTime> unlockedAchievements;
|
||||
|
||||
@HiveField(5)
|
||||
int totalFocusMinutes;
|
||||
|
||||
@HiveField(6)
|
||||
int totalDistractions;
|
||||
|
||||
@HiveField(7)
|
||||
int totalSessions;
|
||||
|
||||
@HiveField(8)
|
||||
List<DateTime> checkInHistory;
|
||||
|
||||
UserProgress({
|
||||
this.totalPoints = 0,
|
||||
this.currentPoints = 0,
|
||||
this.lastCheckInDate,
|
||||
this.consecutiveCheckIns = 0,
|
||||
Map<String, DateTime>? unlockedAchievements,
|
||||
this.totalFocusMinutes = 0,
|
||||
this.totalDistractions = 0,
|
||||
this.totalSessions = 0,
|
||||
List<DateTime>? checkInHistory,
|
||||
}) : unlockedAchievements = unlockedAchievements ?? {},
|
||||
checkInHistory = checkInHistory ?? [];
|
||||
|
||||
/// Get current level based on total points
|
||||
int get level {
|
||||
return LevelSystem.getLevel(totalPoints);
|
||||
}
|
||||
|
||||
/// Get progress to next level (0.0 - 1.0)
|
||||
double get levelProgress {
|
||||
return LevelSystem.getLevelProgress(totalPoints);
|
||||
}
|
||||
|
||||
/// Get points needed to reach next level
|
||||
int get pointsToNextLevel {
|
||||
return LevelSystem.getPointsToNextLevel(totalPoints);
|
||||
}
|
||||
|
||||
/// Check if checked in today
|
||||
bool get hasCheckedInToday {
|
||||
if (lastCheckInDate == null) return false;
|
||||
final now = DateTime.now();
|
||||
return lastCheckInDate!.year == now.year &&
|
||||
lastCheckInDate!.month == now.month &&
|
||||
lastCheckInDate!.day == now.day;
|
||||
}
|
||||
|
||||
/// Get longest check-in streak from history
|
||||
int get longestCheckInStreak {
|
||||
if (checkInHistory.isEmpty) return 0;
|
||||
|
||||
int maxStreak = 1;
|
||||
int currentStreak = 1;
|
||||
|
||||
// Sort dates
|
||||
final sortedDates = List<DateTime>.from(checkInHistory)
|
||||
..sort((a, b) => a.compareTo(b));
|
||||
|
||||
for (int i = 1; i < sortedDates.length; i++) {
|
||||
final diff = sortedDates[i].difference(sortedDates[i - 1]).inDays;
|
||||
if (diff == 1) {
|
||||
currentStreak++;
|
||||
maxStreak = currentStreak > maxStreak ? currentStreak : maxStreak;
|
||||
} else {
|
||||
currentStreak = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return maxStreak;
|
||||
}
|
||||
}
|
||||
|
||||
/// Level system configuration
|
||||
class LevelSystem {
|
||||
static const List<int> levelThresholds = [
|
||||
0, // Level 0 → 1: 0 points
|
||||
50, // Level 1 → 2: 50 points
|
||||
150, // Level 2 → 3: 150 points
|
||||
300, // Level 3 → 4: 300 points
|
||||
500, // Level 4 → 5: 500 points
|
||||
800, // Level 5 → 6: 800 points
|
||||
1200, // Level 6 → 7: 1200 points
|
||||
1800, // Level 7 → 8: 1800 points
|
||||
2500, // Level 8 → 9: 2500 points
|
||||
3500, // Level 9 → 10: 3500 points
|
||||
];
|
||||
|
||||
static int getLevel(int points) {
|
||||
for (int i = levelThresholds.length - 1; i >= 0; i--) {
|
||||
if (points >= levelThresholds[i]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static double getLevelProgress(int points) {
|
||||
int currentLevel = getLevel(points);
|
||||
if (currentLevel >= levelThresholds.length - 1) return 1.0;
|
||||
|
||||
int currentThreshold = levelThresholds[currentLevel];
|
||||
int nextThreshold = levelThresholds[currentLevel + 1];
|
||||
|
||||
return (points - currentThreshold) / (nextThreshold - currentThreshold);
|
||||
}
|
||||
|
||||
static int getPointsToNextLevel(int points) {
|
||||
int currentLevel = getLevel(points);
|
||||
if (currentLevel >= levelThresholds.length - 1) return 0;
|
||||
|
||||
return levelThresholds[currentLevel + 1] - points;
|
||||
}
|
||||
|
||||
static int getNextLevelThreshold(int points) {
|
||||
int currentLevel = getLevel(points);
|
||||
if (currentLevel >= levelThresholds.length - 1) {
|
||||
return levelThresholds.last;
|
||||
}
|
||||
return levelThresholds[currentLevel + 1];
|
||||
}
|
||||
}
|
||||
65
lib/models/user_progress.g.dart
Normal file
65
lib/models/user_progress.g.dart
Normal file
@@ -0,0 +1,65 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user_progress.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// TypeAdapterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class UserProgressAdapter extends TypeAdapter<UserProgress> {
|
||||
@override
|
||||
final int typeId = 1;
|
||||
|
||||
@override
|
||||
UserProgress read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return UserProgress(
|
||||
totalPoints: fields[0] as int,
|
||||
currentPoints: fields[1] as int,
|
||||
lastCheckInDate: fields[2] as DateTime?,
|
||||
consecutiveCheckIns: fields[3] as int,
|
||||
unlockedAchievements: (fields[4] as Map?)?.cast<String, DateTime>(),
|
||||
totalFocusMinutes: fields[5] as int,
|
||||
totalDistractions: fields[6] as int,
|
||||
totalSessions: fields[7] as int,
|
||||
checkInHistory: (fields[8] as List?)?.cast<DateTime>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, UserProgress obj) {
|
||||
writer
|
||||
..writeByte(9)
|
||||
..writeByte(0)
|
||||
..write(obj.totalPoints)
|
||||
..writeByte(1)
|
||||
..write(obj.currentPoints)
|
||||
..writeByte(2)
|
||||
..write(obj.lastCheckInDate)
|
||||
..writeByte(3)
|
||||
..write(obj.consecutiveCheckIns)
|
||||
..writeByte(4)
|
||||
..write(obj.unlockedAchievements)
|
||||
..writeByte(5)
|
||||
..write(obj.totalFocusMinutes)
|
||||
..writeByte(6)
|
||||
..write(obj.totalDistractions)
|
||||
..writeByte(7)
|
||||
..write(obj.totalSessions)
|
||||
..writeByte(8)
|
||||
..write(obj.checkInHistory);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserProgressAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import '../theme/app_colors.dart';
|
||||
import '../theme/app_text_styles.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../services/encouragement_service.dart';
|
||||
import '../models/achievement_config.dart';
|
||||
import 'home_screen.dart';
|
||||
import 'history_screen.dart';
|
||||
|
||||
@@ -11,12 +12,22 @@ import 'history_screen.dart';
|
||||
class CompleteScreen extends StatelessWidget {
|
||||
final int focusedMinutes;
|
||||
final int distractionCount;
|
||||
final int pointsEarned;
|
||||
final int basePoints;
|
||||
final int honestyBonus;
|
||||
final int totalPoints;
|
||||
final List<String> newAchievements;
|
||||
final EncouragementService encouragementService;
|
||||
|
||||
const CompleteScreen({
|
||||
super.key,
|
||||
required this.focusedMinutes,
|
||||
required this.distractionCount,
|
||||
required this.pointsEarned,
|
||||
required this.basePoints,
|
||||
required this.honestyBonus,
|
||||
required this.totalPoints,
|
||||
this.newAchievements = const [],
|
||||
required this.encouragementService,
|
||||
});
|
||||
|
||||
@@ -33,99 +44,413 @@ class CompleteScreen extends StatelessWidget {
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Success Icon
|
||||
const Text(
|
||||
'✨',
|
||||
style: TextStyle(fontSize: 64),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 40),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// You focused for X minutes
|
||||
Text(
|
||||
l10n.youFocusedFor,
|
||||
style: AppTextStyles.headline,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.minutesValue(focusedMinutes, l10n.minutes(focusedMinutes)),
|
||||
style: AppTextStyles.largeNumber,
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
|
||||
// Stats Card
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
// Success Icon
|
||||
const Text(
|
||||
'✨',
|
||||
style: TextStyle(fontSize: 64),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.totalToday(todayTotal),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
l10n.distractionsCount(todayDistractions, l10n.times(todayDistractions)),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'"$encouragement"',
|
||||
style: AppTextStyles.encouragementQuote,
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// You focused for X minutes
|
||||
Text(
|
||||
l10n.youFocusedFor,
|
||||
style: AppTextStyles.headline,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.minutesValue(focusedMinutes, l10n.minutes(focusedMinutes)),
|
||||
style: AppTextStyles.largeNumber,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Start Another Button
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
// Points Earned Section
|
||||
_buildPointsCard(context, l10n),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Achievement Unlocked (if any)
|
||||
if (newAchievements.isNotEmpty)
|
||||
..._buildAchievementCards(context, l10n),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Stats Card
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.totalToday(todayTotal),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
l10n.distractionsCount(todayDistractions, l10n.times(todayDistractions)),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'"$encouragement"',
|
||||
style: AppTextStyles.encouragementQuote,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Total Points Display
|
||||
Text(
|
||||
l10n.totalPoints(totalPoints),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Start Another Button
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => HomeScreen(
|
||||
encouragementService: encouragementService,
|
||||
),
|
||||
),
|
||||
(route) => false,
|
||||
);
|
||||
},
|
||||
child: Text(l10n.startAnother),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// View Full Report - Navigate to History
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => HomeScreen(
|
||||
encouragementService: encouragementService,
|
||||
),
|
||||
builder: (context) => const HistoryScreen(),
|
||||
),
|
||||
(route) => false,
|
||||
(route) => route.isFirst,
|
||||
);
|
||||
},
|
||||
child: Text(l10n.startAnother),
|
||||
child: Text(l10n.viewHistory),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// View Full Report - Navigate to History
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pushAndRemoveUntil(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const HistoryScreen(),
|
||||
),
|
||||
(route) => route.isFirst, // Keep only the home screen in stack
|
||||
);
|
||||
},
|
||||
child: Text(l10n.viewHistory),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build points earned card
|
||||
Widget _buildPointsCard(BuildContext context, AppLocalizations l10n) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: AppColors.primary.withValues(alpha: 0.3),
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Main points display
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
l10n.earnedPoints,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 18,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'+$pointsEarned',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
' ⚡',
|
||||
style: TextStyle(fontSize: 24),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
Divider(thickness: 1, color: AppColors.textSecondary.withValues(alpha: 0.2)),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Points breakdown
|
||||
_buildPointRow(
|
||||
l10n.basePoints,
|
||||
'+$basePoints',
|
||||
AppColors.success,
|
||||
),
|
||||
if (honestyBonus > 0) ...[
|
||||
const SizedBox(height: 8),
|
||||
_buildPointRow(
|
||||
l10n.honestyBonus,
|
||||
'+$honestyBonus',
|
||||
AppColors.success,
|
||||
subtitle: l10n.distractionsRecorded(distractionCount, l10n.distractions(distractionCount)),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build a single point row in the breakdown
|
||||
Widget _buildPointRow(
|
||||
String label,
|
||||
String points,
|
||||
Color color, {
|
||||
String? subtitle,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'├─ ',
|
||||
style: TextStyle(
|
||||
color: AppColors.textSecondary.withValues(alpha: 0.4),
|
||||
fontFamily: 'Nunito',
|
||||
),
|
||||
),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
points,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (subtitle != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 24, top: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondary.withValues(alpha: 0.7),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build achievement unlocked cards
|
||||
List<Widget> _buildAchievementCards(BuildContext context, AppLocalizations l10n) {
|
||||
return newAchievements.map((achievementId) {
|
||||
final achievement = AchievementConfig.getById(achievementId);
|
||||
if (achievement == null) return const SizedBox.shrink();
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFFFFD700), Color(0xFFFFC107)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.orange.withValues(alpha: 0.4),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
achievement.icon,
|
||||
style: const TextStyle(fontSize: 32),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
l10n.achievementUnlocked,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
_getLocalizedAchievementName(l10n, achievement.nameKey),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_getLocalizedAchievementDesc(l10n, achievement.descKey),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (achievement.bonusPoints > 0) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.bonusPoints(achievement.bonusPoints),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/// Get localized achievement name by key
|
||||
String _getLocalizedAchievementName(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'achievement_first_session_name':
|
||||
return l10n.achievement_first_session_name;
|
||||
case 'achievement_sessions_10_name':
|
||||
return l10n.achievement_sessions_10_name;
|
||||
case 'achievement_sessions_50_name':
|
||||
return l10n.achievement_sessions_50_name;
|
||||
case 'achievement_sessions_100_name':
|
||||
return l10n.achievement_sessions_100_name;
|
||||
case 'achievement_honest_bronze_name':
|
||||
return l10n.achievement_honest_bronze_name;
|
||||
case 'achievement_honest_silver_name':
|
||||
return l10n.achievement_honest_silver_name;
|
||||
case 'achievement_honest_gold_name':
|
||||
return l10n.achievement_honest_gold_name;
|
||||
case 'achievement_marathon_name':
|
||||
return l10n.achievement_marathon_name;
|
||||
case 'achievement_century_name':
|
||||
return l10n.achievement_century_name;
|
||||
case 'achievement_master_name':
|
||||
return l10n.achievement_master_name;
|
||||
case 'achievement_persistence_star_name':
|
||||
return l10n.achievement_persistence_star_name;
|
||||
case 'achievement_monthly_habit_name':
|
||||
return l10n.achievement_monthly_habit_name;
|
||||
case 'achievement_centurion_name':
|
||||
return l10n.achievement_centurion_name;
|
||||
case 'achievement_year_warrior_name':
|
||||
return l10n.achievement_year_warrior_name;
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get localized achievement description by key
|
||||
String _getLocalizedAchievementDesc(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'achievement_first_session_desc':
|
||||
return l10n.achievement_first_session_desc;
|
||||
case 'achievement_sessions_10_desc':
|
||||
return l10n.achievement_sessions_10_desc;
|
||||
case 'achievement_sessions_50_desc':
|
||||
return l10n.achievement_sessions_50_desc;
|
||||
case 'achievement_sessions_100_desc':
|
||||
return l10n.achievement_sessions_100_desc;
|
||||
case 'achievement_honest_bronze_desc':
|
||||
return l10n.achievement_honest_bronze_desc;
|
||||
case 'achievement_honest_silver_desc':
|
||||
return l10n.achievement_honest_silver_desc;
|
||||
case 'achievement_honest_gold_desc':
|
||||
return l10n.achievement_honest_gold_desc;
|
||||
case 'achievement_marathon_desc':
|
||||
return l10n.achievement_marathon_desc;
|
||||
case 'achievement_century_desc':
|
||||
return l10n.achievement_century_desc;
|
||||
case 'achievement_master_desc':
|
||||
return l10n.achievement_master_desc;
|
||||
case 'achievement_persistence_star_desc':
|
||||
return l10n.achievement_persistence_star_desc;
|
||||
case 'achievement_monthly_habit_desc':
|
||||
return l10n.achievement_monthly_habit_desc;
|
||||
case 'achievement_centurion_desc':
|
||||
return l10n.achievement_centurion_desc;
|
||||
case 'achievement_year_warrior_desc':
|
||||
return l10n.achievement_year_warrior_desc;
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import '../services/di.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../services/encouragement_service.dart';
|
||||
import '../services/notification_service.dart';
|
||||
import '../services/points_service.dart';
|
||||
import '../services/achievement_service.dart';
|
||||
import '../components/timer_display.dart';
|
||||
import '../components/distraction_button.dart';
|
||||
import '../components/control_buttons.dart';
|
||||
@@ -38,6 +40,8 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
bool _isInBackground = false;
|
||||
final NotificationService _notificationService = getIt<NotificationService>();
|
||||
final StorageService _storageService = getIt<StorageService>();
|
||||
final PointsService _pointsService = getIt<PointsService>();
|
||||
final AchievementService _achievementService = getIt<AchievementService>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -85,7 +89,8 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final minutes = _remainingSeconds ~/ 60;
|
||||
final seconds = _remainingSeconds % 60;
|
||||
final timeStr = '${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
final timeStr =
|
||||
'${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
_notificationService.showOngoingFocusNotification(
|
||||
remainingMinutes: minutes,
|
||||
remainingSeconds: seconds,
|
||||
@@ -107,7 +112,8 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final minutes = _remainingSeconds ~/ 60;
|
||||
final seconds = _remainingSeconds % 60;
|
||||
final timeStr = '${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
final timeStr =
|
||||
'${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
_notificationService.updateOngoingFocusNotification(
|
||||
remainingMinutes: minutes,
|
||||
remainingSeconds: seconds,
|
||||
@@ -130,7 +136,8 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
// Cancel ongoing notification and show completion notification
|
||||
await _notificationService.cancelOngoingFocusNotification();
|
||||
|
||||
await _saveFocusSession(completed: true);
|
||||
// Calculate points and update user progress
|
||||
final pointsData = await _saveFocusSession(completed: true);
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
@@ -162,6 +169,11 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
builder: (context) => CompleteScreen(
|
||||
focusedMinutes: widget.durationMinutes,
|
||||
distractionCount: _distractions.length,
|
||||
pointsEarned: pointsData['pointsEarned']!,
|
||||
basePoints: pointsData['basePoints']!,
|
||||
honestyBonus: pointsData['honestyBonus']!,
|
||||
totalPoints: pointsData['totalPoints']!,
|
||||
newAchievements: pointsData['newAchievements'] as List<String>,
|
||||
encouragementService: widget.encouragementService,
|
||||
),
|
||||
),
|
||||
@@ -183,8 +195,11 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
|
||||
void _stopEarly() {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final actualMinutes = ((widget.durationMinutes * 60 - _remainingSeconds) / 60).floor();
|
||||
final minuteText = actualMinutes == 1 ? l10n.minutes(1) : l10n.minutes(actualMinutes);
|
||||
final actualMinutes =
|
||||
((widget.durationMinutes * 60 - _remainingSeconds) / 60).floor();
|
||||
final minuteText = actualMinutes == 1
|
||||
? l10n.minutes(1)
|
||||
: l10n.minutes(actualMinutes);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -200,21 +215,36 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
child: Text(l10n.keepGoing),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context); // Close dialog
|
||||
onPressed: () async {
|
||||
// Close dialog immediately
|
||||
Navigator.pop(context);
|
||||
_timer.cancel();
|
||||
_saveFocusSession(completed: false);
|
||||
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CompleteScreen(
|
||||
focusedMinutes: actualMinutes,
|
||||
distractionCount: _distractions.length,
|
||||
encouragementService: widget.encouragementService,
|
||||
),
|
||||
),
|
||||
);
|
||||
// Calculate points and update user progress
|
||||
final pointsData = await _saveFocusSession(completed: false);
|
||||
|
||||
// Create a new context for navigation
|
||||
if (mounted) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CompleteScreen(
|
||||
focusedMinutes: actualMinutes,
|
||||
distractionCount: _distractions.length,
|
||||
pointsEarned: pointsData['pointsEarned']!,
|
||||
basePoints: pointsData['basePoints']!,
|
||||
honestyBonus: pointsData['honestyBonus']!,
|
||||
totalPoints: pointsData['totalPoints']!,
|
||||
newAchievements: pointsData['newAchievements'] as List<String>,
|
||||
encouragementService: widget.encouragementService,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Text(l10n.yesStop),
|
||||
),
|
||||
@@ -223,7 +253,9 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _saveFocusSession({required bool completed}) async {
|
||||
Future<Map<String, dynamic>> _saveFocusSession({
|
||||
required bool completed,
|
||||
}) async {
|
||||
try {
|
||||
final actualMinutes = completed
|
||||
? widget.durationMinutes
|
||||
@@ -238,9 +270,47 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
distractionTypes: _distractions,
|
||||
);
|
||||
|
||||
// Save session
|
||||
await _storageService.saveFocusSession(session);
|
||||
|
||||
// Calculate points
|
||||
final pointsBreakdown = _pointsService.calculateSessionPoints(session);
|
||||
|
||||
// Update user progress
|
||||
final progress = _storageService.getUserProgress();
|
||||
|
||||
// Add points (convert to int explicitly)
|
||||
progress.totalPoints += (pointsBreakdown['total']! as num).toInt();
|
||||
progress.currentPoints += (pointsBreakdown['total']! as num).toInt();
|
||||
|
||||
// Update statistics
|
||||
progress.totalSessions += 1;
|
||||
progress.totalFocusMinutes += actualMinutes;
|
||||
progress.totalDistractions += _distractions.length;
|
||||
|
||||
final newAchievements = await _achievementService.checkAchievementsAsync(
|
||||
progress,
|
||||
);
|
||||
|
||||
// Save updated progress
|
||||
await _storageService.saveUserProgress(progress);
|
||||
|
||||
return {
|
||||
'pointsEarned': pointsBreakdown['total']!,
|
||||
'basePoints': pointsBreakdown['basePoints']!,
|
||||
'honestyBonus': pointsBreakdown['honestyBonus']!,
|
||||
'totalPoints': progress.totalPoints,
|
||||
'newAchievements': newAchievements,
|
||||
};
|
||||
} catch (e) {
|
||||
// Ignore save errors silently
|
||||
// Return default values on error
|
||||
return {
|
||||
'pointsEarned': 0,
|
||||
'basePoints': 0,
|
||||
'honestyBonus': 0,
|
||||
'totalPoints': 0,
|
||||
'newAchievements': <String>[],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +319,10 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
|
||||
// Map distraction types to translations
|
||||
final distractionOptions = [
|
||||
(type: DistractionType.phoneNotification, label: l10n.distractionPhoneNotification),
|
||||
(
|
||||
type: DistractionType.phoneNotification,
|
||||
label: l10n.distractionPhoneNotification,
|
||||
),
|
||||
(type: DistractionType.socialMedia, label: l10n.distractionSocialMedia),
|
||||
(type: DistractionType.thoughts, label: l10n.distractionThoughts),
|
||||
(type: DistractionType.other, label: l10n.distractionOther),
|
||||
@@ -356,7 +429,11 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
// Show distraction-specific encouragement toast
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(widget.encouragementService.getRandomMessage(EncouragementType.distraction)),
|
||||
content: Text(
|
||||
widget.encouragementService.getRandomMessage(
|
||||
EncouragementType.distraction,
|
||||
),
|
||||
),
|
||||
duration: const Duration(seconds: 2),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
),
|
||||
@@ -377,9 +454,8 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.2,
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.2),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.2),
|
||||
|
||||
// Timer Display Component
|
||||
TimerDisplay(remainingSeconds: _remainingSeconds),
|
||||
@@ -403,10 +479,8 @@ class _FocusScreenState extends State<FocusScreen> with WidgetsBindingObserver {
|
||||
resumeText: l10n.resume,
|
||||
stopText: l10n.stopSession,
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.2,
|
||||
),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.2),
|
||||
SizedBox(height: MediaQuery.of(context).size.height * 0.2),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_text_styles.dart';
|
||||
import '../models/focus_session.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import 'session_detail_screen.dart';
|
||||
|
||||
/// History Screen - Shows past focus sessions
|
||||
class HistoryScreen extends StatefulWidget {
|
||||
@@ -81,10 +82,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'📊',
|
||||
style: TextStyle(fontSize: 64),
|
||||
),
|
||||
const Text('📊', style: TextStyle(fontSize: 64)),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
l10n.noFocusSessionsYet,
|
||||
@@ -108,7 +106,12 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTodaySummary(AppLocalizations l10n, int totalMins, int distractions, int sessions) {
|
||||
Widget _buildTodaySummary(
|
||||
AppLocalizations l10n,
|
||||
int totalMins,
|
||||
int distractions,
|
||||
int sessions,
|
||||
) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
@@ -155,13 +158,20 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildStat('Total', l10n.minutesValue(totalMins, l10n.minutes(totalMins)), '⏱️'),
|
||||
child: _buildStat(
|
||||
'Total',
|
||||
l10n.minutesValue(totalMins, l10n.minutes(totalMins)),
|
||||
'⏱️',
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _buildStat(
|
||||
'Distractions',
|
||||
l10n.distractionsCount(distractions, l10n.times(distractions)),
|
||||
l10n.distractionsCount(
|
||||
distractions,
|
||||
l10n.times(distractions),
|
||||
),
|
||||
'🤚',
|
||||
),
|
||||
),
|
||||
@@ -176,10 +186,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
emoji,
|
||||
style: const TextStyle(fontSize: 24),
|
||||
),
|
||||
Text(emoji, style: const TextStyle(fontSize: 24)),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
label,
|
||||
@@ -204,7 +211,11 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDateSection(AppLocalizations l10n, DateTime date, List<FocusSession> sessions) {
|
||||
Widget _buildDateSection(
|
||||
AppLocalizations l10n,
|
||||
DateTime date,
|
||||
List<FocusSession> sessions,
|
||||
) {
|
||||
final isToday = _isToday(date);
|
||||
final dateLabel = isToday
|
||||
? l10n.today
|
||||
@@ -257,83 +268,108 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
||||
final statusEmoji = session.completed ? '✅' : '⏸️';
|
||||
final statusText = session.completed ? l10n.completed : l10n.stoppedEarly;
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: AppColors.divider,
|
||||
width: 1,
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SessionDetailScreen(session: session),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.divider, width: 1),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Time
|
||||
Text(
|
||||
timeStr,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// Duration
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.minutesValue(session.actualMinutes, l10n.minutes(session.actualMinutes)),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
if (session.distractionCount > 0)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(
|
||||
l10n.distractionsCount(session.distractionCount, l10n.times(session.distractionCount)),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Status badge
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: session.completed
|
||||
? AppColors.success.withValues(alpha: 0.1)
|
||||
: AppColors.distractionButton,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'$statusEmoji $statusText',
|
||||
style: TextStyle(
|
||||
child: Row(
|
||||
children: [
|
||||
// Time
|
||||
Text(
|
||||
timeStr,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: session.completed
|
||||
? AppColors.success
|
||||
: AppColors.textSecondary,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(width: 16),
|
||||
|
||||
// Duration
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.minutesValue(
|
||||
session.actualMinutes,
|
||||
l10n.minutes(session.actualMinutes),
|
||||
),
|
||||
style: AppTextStyles.bodyText,
|
||||
),
|
||||
if (session.distractionCount > 0)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(
|
||||
l10n.distractionsCount(
|
||||
session.distractionCount,
|
||||
l10n.times(session.distractionCount),
|
||||
),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Status badge
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: session.completed
|
||||
? AppColors.success.withValues(alpha: 0.1)
|
||||
: AppColors.distractionButton,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
'$statusEmoji $statusText',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: session.completed
|
||||
? AppColors.success
|
||||
: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Arrow indicator
|
||||
const SizedBox(width: 8),
|
||||
const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 12,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ import '../l10n/app_localizations.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_text_styles.dart';
|
||||
import '../services/encouragement_service.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../services/di.dart';
|
||||
import 'focus_screen.dart';
|
||||
import 'history_screen.dart';
|
||||
import 'settings_screen.dart';
|
||||
import 'profile_screen.dart';
|
||||
|
||||
/// Home Screen - Loads default duration from settings
|
||||
class HomeScreen extends StatefulWidget {
|
||||
@@ -22,6 +25,7 @@ class HomeScreen extends StatefulWidget {
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
int _defaultDuration = 25;
|
||||
final StorageService _storageService = getIt<StorageService>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -46,6 +50,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final progress = _storageService.getUserProgress();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
@@ -53,8 +58,12 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Points Card at the top
|
||||
_buildPointsCard(context, progress),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// App Title
|
||||
Text(
|
||||
l10n.appTitle,
|
||||
@@ -100,9 +109,10 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
),
|
||||
);
|
||||
// Reload duration when returning
|
||||
// Reload duration and refresh points when returning
|
||||
if (result == true || mounted) {
|
||||
_loadDefaultDuration();
|
||||
setState(() {}); // Refresh to show updated points
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
@@ -168,4 +178,156 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build points card widget
|
||||
Widget _buildPointsCard(BuildContext context, progress) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
// Navigate to ProfileScreen
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ProfileScreen(),
|
||||
),
|
||||
);
|
||||
// Refresh points when returning from ProfileScreen
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColors.primary.withValues(alpha: 0.1),
|
||||
AppColors.primary.withValues(alpha: 0.05),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: AppColors.primary.withValues(alpha: 0.2),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Left side: Points and Level
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
// Points
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'⚡',
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${progress.totalPoints}',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
l10n.points,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Level
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'🎖️',
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Lv ${progress.level}',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
l10n.level,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Right side: Check-in status
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: progress.hasCheckedInToday
|
||||
? AppColors.success.withValues(alpha: 0.1)
|
||||
: AppColors.white.withValues(alpha: 0.5),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
progress.hasCheckedInToday ? '✓' : '📅',
|
||||
style: const TextStyle(fontSize: 20),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
progress.hasCheckedInToday ? l10n.checked : l10n.checkIn,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 10,
|
||||
color: progress.hasCheckedInToday
|
||||
? AppColors.success
|
||||
: AppColors.textSecondary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
if (progress.consecutiveCheckIns > 0)
|
||||
Text(
|
||||
'🔥 ${progress.consecutiveCheckIns}',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
821
lib/screens/profile_screen.dart
Normal file
821
lib/screens/profile_screen.dart
Normal file
@@ -0,0 +1,821 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../services/points_service.dart';
|
||||
import '../services/achievement_service.dart';
|
||||
import '../services/di.dart';
|
||||
import '../models/user_progress.dart';
|
||||
import '../models/achievement_config.dart';
|
||||
|
||||
/// Profile Screen - Shows user points, level, check-in calendar, and achievements
|
||||
class ProfileScreen extends StatefulWidget {
|
||||
const ProfileScreen({super.key});
|
||||
|
||||
@override
|
||||
State<ProfileScreen> createState() => _ProfileScreenState();
|
||||
}
|
||||
|
||||
class _ProfileScreenState extends State<ProfileScreen> {
|
||||
final StorageService _storageService = getIt<StorageService>();
|
||||
final PointsService _pointsService = getIt<PointsService>();
|
||||
final AchievementService _achievementService = getIt<AchievementService>();
|
||||
late UserProgress _progress;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_progress = _storageService.getUserProgress();
|
||||
}
|
||||
|
||||
Future<void> _handleCheckIn() async {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
|
||||
if (_progress.hasCheckedInToday) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(l10n.alreadyCheckedIn),
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Process check-in with detailed breakdown
|
||||
final checkInResult = _pointsService.processCheckIn(_progress);
|
||||
final pointsEarned = checkInResult['points'] as int;
|
||||
|
||||
// Add points
|
||||
_progress.totalPoints += pointsEarned;
|
||||
_progress.currentPoints += pointsEarned;
|
||||
|
||||
// Check for newly unlocked achievements (streak achievements) asynchronously
|
||||
final newAchievements = await _achievementService.checkAchievementsAsync(
|
||||
_progress,
|
||||
);
|
||||
|
||||
// Save progress
|
||||
await _storageService.saveUserProgress(_progress);
|
||||
|
||||
// Update UI
|
||||
setState(() {});
|
||||
|
||||
// Show success message
|
||||
if (!mounted) return;
|
||||
|
||||
String message = l10n.checkInSuccess(pointsEarned);
|
||||
if (_progress.consecutiveCheckIns % 7 == 0) {
|
||||
message += '\n${l10n.weeklyStreakBonus}';
|
||||
}
|
||||
if (newAchievements.isNotEmpty) {
|
||||
message += '\n${l10n.newAchievementUnlocked}';
|
||||
}
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
duration: const Duration(seconds: 3),
|
||||
backgroundColor: AppColors.success,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
title: Text(
|
||||
l10n.profile,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: [
|
||||
// User header card
|
||||
_buildUserHeaderCard(l10n),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Check-in calendar
|
||||
_buildCheckInCalendar(l10n),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Achievement wall
|
||||
_buildAchievementWall(l10n),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build user header card with points, level, and progress bar
|
||||
Widget _buildUserHeaderCard(AppLocalizations l10n) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [AppColors.primary, AppColors.primary.withValues(alpha: 0.8)],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.primary.withValues(alpha: 0.3),
|
||||
blurRadius: 12,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// User icon (placeholder)
|
||||
const CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundColor: Colors.white,
|
||||
child: Text('👤', style: TextStyle(fontSize: 40)),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// User name (placeholder)
|
||||
Text(
|
||||
l10n.focuser,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Points and Level row
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
// Points
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text('⚡', style: TextStyle(fontSize: 28)),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${_progress.totalPoints}',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
l10n.points,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// Divider
|
||||
Container(
|
||||
height: 40,
|
||||
width: 1,
|
||||
color: Colors.white.withValues(alpha: 0.3),
|
||||
),
|
||||
|
||||
// Level
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Text('🎖️', style: TextStyle(fontSize: 24)),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Lv ${_progress.level}',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
l10n.level,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Level progress bar
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
l10n.pointsToNextLevel(
|
||||
_progress.pointsToNextLevel,
|
||||
_progress.level + 1,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: Colors.white.withValues(alpha: 0.9),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Stack(
|
||||
children: [
|
||||
// Background bar
|
||||
Container(
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
),
|
||||
// Progress bar
|
||||
FractionallySizedBox(
|
||||
widthFactor: _progress.levelProgress,
|
||||
child: Container(
|
||||
height: 10,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${(_progress.levelProgress * 100).toInt()}%',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: Colors.white.withValues(alpha: 0.9),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build check-in calendar section
|
||||
Widget _buildCheckInCalendar(AppLocalizations l10n) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
l10n.checkInCalendar,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
l10n.daysCount(_progress.checkInHistory.length),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Check-in button
|
||||
if (!_progress.hasCheckedInToday)
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: _handleCheckIn,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primary,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
l10n.checkInToday,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (_progress.hasCheckedInToday)
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.success.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
l10n.checkedInToday,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.success,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Stats row
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
_buildStatItem(
|
||||
l10n.currentStreak,
|
||||
l10n.daysCount(_progress.consecutiveCheckIns),
|
||||
),
|
||||
Container(height: 40, width: 1, color: AppColors.divider),
|
||||
_buildStatItem(
|
||||
l10n.longestStreak,
|
||||
l10n.daysCount(_progress.longestCheckInStreak),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Calendar grid (last 28 days)
|
||||
_buildCalendarGrid(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build calendar grid showing check-in history
|
||||
Widget _buildCalendarGrid() {
|
||||
final now = DateTime.now();
|
||||
final today = DateTime(now.year, now.month, now.day);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
// Weekday labels
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
||||
.map(
|
||||
(day) => SizedBox(
|
||||
width: 40,
|
||||
child: Center(
|
||||
child: Text(
|
||||
day,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Calendar days (last 4 weeks)
|
||||
Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 4,
|
||||
children: List.generate(28, (index) {
|
||||
final date = today.subtract(Duration(days: 27 - index));
|
||||
final isCheckedIn = _progress.checkInHistory.any(
|
||||
(checkInDate) =>
|
||||
checkInDate.year == date.year &&
|
||||
checkInDate.month == date.month &&
|
||||
checkInDate.day == date.day,
|
||||
);
|
||||
final isToday = date == today;
|
||||
|
||||
return Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: isCheckedIn
|
||||
? AppColors.primary.withValues(alpha: 0.2)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: isToday
|
||||
? Border.all(color: AppColors.primary, width: 2)
|
||||
: null,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
isCheckedIn ? '✓' : date.day.toString(),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isCheckedIn
|
||||
? AppColors.primary
|
||||
: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Build a stat item
|
||||
Widget _buildStatItem(String label, String value) {
|
||||
return Column(
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Build achievement wall section
|
||||
Widget _buildAchievementWall(AppLocalizations l10n) {
|
||||
final allAchievements = AchievementConfig.all;
|
||||
final unlockedCount = _progress.unlockedAchievements.length;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
l10n.achievements,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$unlockedCount/${allAchievements.length}',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Achievement list
|
||||
...allAchievements.take(6).map((achievement) {
|
||||
final isUnlocked = _progress.unlockedAchievements.containsKey(
|
||||
achievement.id,
|
||||
);
|
||||
final progress = _achievementService.getAchievementProgress(
|
||||
_progress,
|
||||
achievement,
|
||||
);
|
||||
final currentValue = _achievementService.getAchievementCurrentValue(
|
||||
_progress,
|
||||
achievement,
|
||||
);
|
||||
|
||||
return _buildAchievementItem(
|
||||
l10n: l10n,
|
||||
achievement: achievement,
|
||||
isUnlocked: isUnlocked,
|
||||
progress: progress,
|
||||
currentValue: currentValue,
|
||||
);
|
||||
}),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// View all button
|
||||
Center(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(l10n.allAchievementsComingSoon),
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
l10n.viewAllAchievements,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.arrow_forward, size: 16),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build a single achievement item
|
||||
Widget _buildAchievementItem({
|
||||
required AppLocalizations l10n,
|
||||
required AchievementConfig achievement,
|
||||
required bool isUnlocked,
|
||||
required double progress,
|
||||
required int currentValue,
|
||||
}) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: isUnlocked
|
||||
? AppColors.success.withValues(alpha: 0.05)
|
||||
: AppColors.background,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: isUnlocked
|
||||
? AppColors.success.withValues(alpha: 0.3)
|
||||
: AppColors.divider,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Icon
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: isUnlocked
|
||||
? AppColors.success.withValues(alpha: 0.1)
|
||||
: Colors.grey.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
achievement.icon,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
color: isUnlocked ? null : Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 12),
|
||||
|
||||
// Content
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_getLocalizedAchievementName(l10n, achievement.nameKey),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isUnlocked
|
||||
? AppColors.textPrimary
|
||||
: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_getLocalizedAchievementDesc(l10n, achievement.descKey),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondary.withValues(alpha: 0.8),
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (!isUnlocked) ...[
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: LinearProgressIndicator(
|
||||
value: progress,
|
||||
backgroundColor: Colors.grey.withValues(alpha: 0.2),
|
||||
valueColor: const AlwaysStoppedAnimation(
|
||||
AppColors.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'$currentValue/${achievement.requiredValue}',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 10,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(width: 8),
|
||||
|
||||
// Status icon
|
||||
if (isUnlocked)
|
||||
const Icon(Icons.check_circle, color: AppColors.success, size: 24)
|
||||
else
|
||||
const Icon(
|
||||
Icons.lock_outline,
|
||||
color: AppColors.textSecondary,
|
||||
size: 24,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Get localized achievement name by key
|
||||
String _getLocalizedAchievementName(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'achievement_first_session_name':
|
||||
return l10n.achievement_first_session_name;
|
||||
case 'achievement_sessions_10_name':
|
||||
return l10n.achievement_sessions_10_name;
|
||||
case 'achievement_sessions_50_name':
|
||||
return l10n.achievement_sessions_50_name;
|
||||
case 'achievement_sessions_100_name':
|
||||
return l10n.achievement_sessions_100_name;
|
||||
case 'achievement_honest_bronze_name':
|
||||
return l10n.achievement_honest_bronze_name;
|
||||
case 'achievement_honest_silver_name':
|
||||
return l10n.achievement_honest_silver_name;
|
||||
case 'achievement_honest_gold_name':
|
||||
return l10n.achievement_honest_gold_name;
|
||||
case 'achievement_marathon_name':
|
||||
return l10n.achievement_marathon_name;
|
||||
case 'achievement_century_name':
|
||||
return l10n.achievement_century_name;
|
||||
case 'achievement_master_name':
|
||||
return l10n.achievement_master_name;
|
||||
case 'achievement_persistence_star_name':
|
||||
return l10n.achievement_persistence_star_name;
|
||||
case 'achievement_monthly_habit_name':
|
||||
return l10n.achievement_monthly_habit_name;
|
||||
case 'achievement_centurion_name':
|
||||
return l10n.achievement_centurion_name;
|
||||
case 'achievement_year_warrior_name':
|
||||
return l10n.achievement_year_warrior_name;
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get localized achievement description by key
|
||||
String _getLocalizedAchievementDesc(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'achievement_first_session_desc':
|
||||
return l10n.achievement_first_session_desc;
|
||||
case 'achievement_sessions_10_desc':
|
||||
return l10n.achievement_sessions_10_desc;
|
||||
case 'achievement_sessions_50_desc':
|
||||
return l10n.achievement_sessions_50_desc;
|
||||
case 'achievement_sessions_100_desc':
|
||||
return l10n.achievement_sessions_100_desc;
|
||||
case 'achievement_honest_bronze_desc':
|
||||
return l10n.achievement_honest_bronze_desc;
|
||||
case 'achievement_honest_silver_desc':
|
||||
return l10n.achievement_honest_silver_desc;
|
||||
case 'achievement_honest_gold_desc':
|
||||
return l10n.achievement_honest_gold_desc;
|
||||
case 'achievement_marathon_desc':
|
||||
return l10n.achievement_marathon_desc;
|
||||
case 'achievement_century_desc':
|
||||
return l10n.achievement_century_desc;
|
||||
case 'achievement_master_desc':
|
||||
return l10n.achievement_master_desc;
|
||||
case 'achievement_persistence_star_desc':
|
||||
return l10n.achievement_persistence_star_desc;
|
||||
case 'achievement_monthly_habit_desc':
|
||||
return l10n.achievement_monthly_habit_desc;
|
||||
case 'achievement_centurion_desc':
|
||||
return l10n.achievement_centurion_desc;
|
||||
case 'achievement_year_warrior_desc':
|
||||
return l10n.achievement_year_warrior_desc;
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
581
lib/screens/session_detail_screen.dart
Normal file
581
lib/screens/session_detail_screen.dart
Normal file
@@ -0,0 +1,581 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
import '../theme/app_text_styles.dart';
|
||||
import '../models/focus_session.dart';
|
||||
import '../models/achievement_config.dart';
|
||||
import '../services/points_service.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../services/encouragement_service.dart';
|
||||
import '../services/di.dart';
|
||||
|
||||
/// Session Detail Screen - Shows detailed information about a past focus session
|
||||
class SessionDetailScreen extends StatelessWidget {
|
||||
final FocusSession session;
|
||||
|
||||
const SessionDetailScreen({super.key, required this.session});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final pointsService = getIt<PointsService>();
|
||||
final storageService = getIt<StorageService>();
|
||||
final encouragementService = getIt<EncouragementService>();
|
||||
|
||||
// Calculate points for this session
|
||||
final pointsBreakdown = pointsService.calculateSessionPoints(session);
|
||||
final pointsEarned = pointsBreakdown['total'] as int;
|
||||
final basePoints = pointsBreakdown['basePoints'] as int;
|
||||
final honestyBonus = pointsBreakdown['honestyBonus'] as int;
|
||||
|
||||
// Get user progress to show total points
|
||||
final progress = storageService.getUserProgress();
|
||||
final encouragement = encouragementService.getRandomMessage();
|
||||
|
||||
// Find achievements that might have been unlocked during this session
|
||||
final sessionAchievements = _findSessionAchievements(
|
||||
session,
|
||||
storageService,
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.background,
|
||||
appBar: AppBar(
|
||||
title: const Text('会话详情'),
|
||||
backgroundColor: AppColors.background,
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Session Date and Time
|
||||
_buildSessionHeader(context, l10n),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Focused Time Section
|
||||
Text(l10n.youFocusedFor, style: AppTextStyles.headline),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.minutesValue(
|
||||
session.actualMinutes,
|
||||
l10n.minutes(session.actualMinutes),
|
||||
),
|
||||
style: AppTextStyles.largeNumber,
|
||||
),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Points Earned Section
|
||||
_buildPointsCard(
|
||||
context,
|
||||
l10n,
|
||||
pointsEarned,
|
||||
basePoints,
|
||||
honestyBonus,
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Session Stats Card
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('会话统计', style: AppTextStyles.headline),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
_buildStatRow(
|
||||
icon: '⏱️',
|
||||
label: '计划时长',
|
||||
value: l10n.minutesValue(
|
||||
session.durationMinutes,
|
||||
l10n.minutes(session.durationMinutes),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
_buildStatRow(
|
||||
icon: '✅',
|
||||
label: '实际专注',
|
||||
value: l10n.minutesValue(
|
||||
session.actualMinutes,
|
||||
l10n.minutes(session.actualMinutes),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
_buildStatRow(
|
||||
icon: '🤚',
|
||||
label: '分心次数',
|
||||
value: l10n.distractionsCount(
|
||||
session.distractionCount,
|
||||
l10n.times(session.distractionCount),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
_buildStatRow(
|
||||
icon: '🏁',
|
||||
label: '状态',
|
||||
value: session.completed
|
||||
? l10n.completed
|
||||
: l10n.stoppedEarly,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
Text(
|
||||
'"$encouragement"',
|
||||
style: AppTextStyles.encouragementQuote,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Achievements Unlocked Section
|
||||
if (sessionAchievements.isNotEmpty)
|
||||
..._buildAchievementCards(context, l10n, sessionAchievements),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Total Points Display
|
||||
Text(
|
||||
l10n.totalPoints(progress.totalPoints),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build session header with date and time
|
||||
Widget _buildSessionHeader(BuildContext context, AppLocalizations l10n) {
|
||||
final dateStr = session.startTime.toLocal().toString().split(' ')[0];
|
||||
final timeStr = session.startTime
|
||||
.toLocal()
|
||||
.toString()
|
||||
.split(' ')[1]
|
||||
.substring(0, 5);
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(dateStr, style: AppTextStyles.headline),
|
||||
const SizedBox(height: 8),
|
||||
Text(timeStr, style: AppTextStyles.largeNumber),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build points earned card
|
||||
Widget _buildPointsCard(
|
||||
BuildContext context,
|
||||
AppLocalizations l10n,
|
||||
int pointsEarned,
|
||||
int basePoints,
|
||||
int honestyBonus,
|
||||
) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: AppColors.primary.withValues(alpha: 0.3),
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
// Main points display
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
l10n.earnedPoints,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 18,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'+$pointsEarned',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
const Text(' ⚡', style: TextStyle(fontSize: 24)),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
Divider(
|
||||
thickness: 1,
|
||||
color: AppColors.textSecondary.withValues(alpha: 0.2),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Points breakdown
|
||||
_buildPointRow(l10n.basePoints, '+$basePoints', AppColors.success),
|
||||
if (honestyBonus > 0) ...[
|
||||
const SizedBox(height: 8),
|
||||
_buildPointRow(
|
||||
l10n.honestyBonus,
|
||||
'+$honestyBonus',
|
||||
AppColors.success,
|
||||
subtitle: l10n.distractionsRecorded(
|
||||
session.distractionCount,
|
||||
l10n.distractions(session.distractionCount),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build a single point row in the breakdown
|
||||
Widget _buildPointRow(
|
||||
String label,
|
||||
String points,
|
||||
Color color, {
|
||||
String? subtitle,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'├─ ',
|
||||
style: TextStyle(
|
||||
color: AppColors.textSecondary.withValues(alpha: 0.4),
|
||||
fontFamily: 'Nunito',
|
||||
),
|
||||
),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: AppColors.textSecondary,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
points,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (subtitle != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 24, top: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
subtitle,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 12,
|
||||
color: AppColors.textSecondary.withValues(alpha: 0.7),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build a single stat row
|
||||
Widget _buildStatRow({
|
||||
required String icon,
|
||||
required String label,
|
||||
required String value,
|
||||
}) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(icon, style: const TextStyle(fontSize: 20)),
|
||||
const SizedBox(width: 12),
|
||||
Text(label, style: AppTextStyles.bodyText),
|
||||
const Spacer(),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Find achievements that might have been unlocked during this session
|
||||
List<AchievementConfig> _findSessionAchievements(
|
||||
FocusSession session,
|
||||
StorageService storageService,
|
||||
) {
|
||||
final allAchievements = AchievementConfig.all;
|
||||
final unlockedAchievements = storageService
|
||||
.getUserProgress()
|
||||
.unlockedAchievements;
|
||||
final sessionAchievements = <AchievementConfig>[];
|
||||
|
||||
// Get all sessions to determine the state before this one
|
||||
final allSessions = storageService.getAllSessions();
|
||||
final sessionIndex = allSessions.indexOf(session);
|
||||
|
||||
// Calculate stats before this session
|
||||
int sessionsBefore = sessionIndex;
|
||||
int distractionsBefore = allSessions
|
||||
.sublist(0, sessionIndex)
|
||||
.fold(0, (sum, s) => sum + s.distractionCount);
|
||||
int minutesBefore = allSessions
|
||||
.sublist(0, sessionIndex)
|
||||
.fold(0, (sum, s) => sum + s.actualMinutes);
|
||||
|
||||
// Check which achievements might have been unlocked by this session
|
||||
for (final achievement in allAchievements) {
|
||||
// Skip if not unlocked
|
||||
if (!unlockedAchievements.containsKey(achievement.id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if this session could have unlocked the achievement
|
||||
bool unlockedByThisSession = false;
|
||||
switch (achievement.type) {
|
||||
case AchievementType.sessionCount:
|
||||
unlockedByThisSession =
|
||||
sessionsBefore < achievement.requiredValue &&
|
||||
(sessionsBefore + 1) >= achievement.requiredValue;
|
||||
break;
|
||||
case AchievementType.distractionCount:
|
||||
unlockedByThisSession =
|
||||
distractionsBefore < achievement.requiredValue &&
|
||||
(distractionsBefore + session.distractionCount) >=
|
||||
achievement.requiredValue;
|
||||
break;
|
||||
case AchievementType.totalMinutes:
|
||||
unlockedByThisSession =
|
||||
minutesBefore < achievement.requiredValue &&
|
||||
(minutesBefore + session.actualMinutes) >=
|
||||
achievement.requiredValue;
|
||||
break;
|
||||
case AchievementType.consecutiveDays:
|
||||
// Consecutive days are not directly related to a single session
|
||||
// but rather to check-ins, so we'll skip this type
|
||||
break;
|
||||
}
|
||||
|
||||
if (unlockedByThisSession) {
|
||||
sessionAchievements.add(achievement);
|
||||
}
|
||||
}
|
||||
|
||||
return sessionAchievements;
|
||||
}
|
||||
|
||||
/// Build achievement cards for achievements unlocked in this session
|
||||
List<Widget> _buildAchievementCards(
|
||||
BuildContext context,
|
||||
AppLocalizations l10n,
|
||||
List<AchievementConfig> achievements,
|
||||
) {
|
||||
return [
|
||||
Text('解锁的成就', style: AppTextStyles.headline),
|
||||
const SizedBox(height: 16),
|
||||
...achievements.map((achievement) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFFFFD700), Color(0xFFFFC107)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.orange.withValues(alpha: 0.4),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(achievement.icon, style: const TextStyle(fontSize: 32)),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
'成就解锁!',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
_getLocalizedAchievementName(l10n, achievement.nameKey),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
_getLocalizedAchievementDesc(l10n, achievement.descKey),
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 14,
|
||||
color: Colors.white,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
if (achievement.bonusPoints > 0)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'+${achievement.bonusPoints} 积分',
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Nunito',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/// Get localized achievement name by key
|
||||
String _getLocalizedAchievementName(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'achievement_first_session_name':
|
||||
return l10n.achievement_first_session_name;
|
||||
case 'achievement_sessions_10_name':
|
||||
return l10n.achievement_sessions_10_name;
|
||||
case 'achievement_sessions_50_name':
|
||||
return l10n.achievement_sessions_50_name;
|
||||
case 'achievement_sessions_100_name':
|
||||
return l10n.achievement_sessions_100_name;
|
||||
case 'achievement_honest_bronze_name':
|
||||
return l10n.achievement_honest_bronze_name;
|
||||
case 'achievement_honest_silver_name':
|
||||
return l10n.achievement_honest_silver_name;
|
||||
case 'achievement_honest_gold_name':
|
||||
return l10n.achievement_honest_gold_name;
|
||||
case 'achievement_marathon_name':
|
||||
return l10n.achievement_marathon_name;
|
||||
case 'achievement_century_name':
|
||||
return l10n.achievement_century_name;
|
||||
case 'achievement_master_name':
|
||||
return l10n.achievement_master_name;
|
||||
case 'achievement_persistence_star_name':
|
||||
return l10n.achievement_persistence_star_name;
|
||||
case 'achievement_monthly_habit_name':
|
||||
return l10n.achievement_monthly_habit_name;
|
||||
case 'achievement_centurion_name':
|
||||
return l10n.achievement_centurion_name;
|
||||
case 'achievement_year_warrior_name':
|
||||
return l10n.achievement_year_warrior_name;
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get localized achievement description by key
|
||||
String _getLocalizedAchievementDesc(AppLocalizations l10n, String key) {
|
||||
switch (key) {
|
||||
case 'achievement_first_session_desc':
|
||||
return l10n.achievement_first_session_desc;
|
||||
case 'achievement_sessions_10_desc':
|
||||
return l10n.achievement_sessions_10_desc;
|
||||
case 'achievement_sessions_50_desc':
|
||||
return l10n.achievement_sessions_50_desc;
|
||||
case 'achievement_sessions_100_desc':
|
||||
return l10n.achievement_sessions_100_desc;
|
||||
case 'achievement_honest_bronze_desc':
|
||||
return l10n.achievement_honest_bronze_desc;
|
||||
case 'achievement_honest_silver_desc':
|
||||
return l10n.achievement_honest_silver_desc;
|
||||
case 'achievement_honest_gold_desc':
|
||||
return l10n.achievement_honest_gold_desc;
|
||||
case 'achievement_marathon_desc':
|
||||
return l10n.achievement_marathon_desc;
|
||||
case 'achievement_century_desc':
|
||||
return l10n.achievement_century_desc;
|
||||
case 'achievement_master_desc':
|
||||
return l10n.achievement_master_desc;
|
||||
case 'achievement_persistence_star_desc':
|
||||
return l10n.achievement_persistence_star_desc;
|
||||
case 'achievement_monthly_habit_desc':
|
||||
return l10n.achievement_monthly_habit_desc;
|
||||
case 'achievement_centurion_desc':
|
||||
return l10n.achievement_centurion_desc;
|
||||
case 'achievement_year_warrior_desc':
|
||||
return l10n.achievement_year_warrior_desc;
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
111
lib/services/achievement_service.dart
Normal file
111
lib/services/achievement_service.dart
Normal file
@@ -0,0 +1,111 @@
|
||||
import '../models/user_progress.dart';
|
||||
import '../models/achievement_config.dart';
|
||||
|
||||
/// Service for managing achievements
|
||||
class AchievementService {
|
||||
/// Check for newly unlocked achievements asynchronously
|
||||
/// Returns list of newly unlocked achievement IDs
|
||||
Future<List<String>> checkAchievementsAsync(UserProgress progress) async {
|
||||
List<String> newlyUnlocked = [];
|
||||
|
||||
for (var achievement in AchievementConfig.all) {
|
||||
// Skip if already unlocked
|
||||
if (progress.unlockedAchievements.containsKey(achievement.id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if requirement is met
|
||||
bool unlocked = false;
|
||||
switch (achievement.type) {
|
||||
case AchievementType.sessionCount:
|
||||
unlocked = progress.totalSessions >= achievement.requiredValue;
|
||||
break;
|
||||
case AchievementType.distractionCount:
|
||||
unlocked = progress.totalDistractions >= achievement.requiredValue;
|
||||
break;
|
||||
case AchievementType.totalMinutes:
|
||||
unlocked = progress.totalFocusMinutes >= achievement.requiredValue;
|
||||
break;
|
||||
case AchievementType.consecutiveDays:
|
||||
unlocked = progress.consecutiveCheckIns >= achievement.requiredValue;
|
||||
break;
|
||||
}
|
||||
|
||||
if (unlocked) {
|
||||
// Mark as unlocked with timestamp
|
||||
progress.unlockedAchievements[achievement.id] = DateTime.now();
|
||||
|
||||
// Award bonus points
|
||||
progress.totalPoints += achievement.bonusPoints;
|
||||
progress.currentPoints += achievement.bonusPoints;
|
||||
|
||||
newlyUnlocked.add(achievement.id);
|
||||
}
|
||||
}
|
||||
|
||||
return newlyUnlocked;
|
||||
}
|
||||
|
||||
/// Get progress towards a specific achievement (0.0 - 1.0)
|
||||
double getAchievementProgress(
|
||||
UserProgress progress,
|
||||
AchievementConfig achievement,
|
||||
) {
|
||||
int currentValue = 0;
|
||||
|
||||
switch (achievement.type) {
|
||||
case AchievementType.sessionCount:
|
||||
currentValue = progress.totalSessions;
|
||||
break;
|
||||
case AchievementType.distractionCount:
|
||||
currentValue = progress.totalDistractions;
|
||||
break;
|
||||
case AchievementType.totalMinutes:
|
||||
currentValue = progress.totalFocusMinutes;
|
||||
break;
|
||||
case AchievementType.consecutiveDays:
|
||||
currentValue = progress.consecutiveCheckIns;
|
||||
break;
|
||||
}
|
||||
|
||||
return (currentValue / achievement.requiredValue).clamp(0.0, 1.0);
|
||||
}
|
||||
|
||||
/// Get current value for achievement type
|
||||
int getAchievementCurrentValue(
|
||||
UserProgress progress,
|
||||
AchievementConfig achievement,
|
||||
) {
|
||||
switch (achievement.type) {
|
||||
case AchievementType.sessionCount:
|
||||
return progress.totalSessions;
|
||||
case AchievementType.distractionCount:
|
||||
return progress.totalDistractions;
|
||||
case AchievementType.totalMinutes:
|
||||
return progress.totalFocusMinutes;
|
||||
case AchievementType.consecutiveDays:
|
||||
return progress.consecutiveCheckIns;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get all achievements with their current progress
|
||||
Map<AchievementConfig, double> getAllAchievementsWithProgress(
|
||||
UserProgress progress,
|
||||
) {
|
||||
final result = <AchievementConfig, double>{};
|
||||
for (var achievement in AchievementConfig.all) {
|
||||
result[achievement] = getAchievementProgress(progress, achievement);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Get newly unlocked achievements since last check
|
||||
/// This can be used to show notifications for achievements unlocked in background
|
||||
List<String> getNewlyUnlockedAchievements(
|
||||
UserProgress progress,
|
||||
Set<String> previouslyUnlocked,
|
||||
) {
|
||||
final currentlyUnlocked = progress.unlockedAchievements.keys.toSet();
|
||||
return currentlyUnlocked.difference(previouslyUnlocked).toList();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import 'package:flutter/foundation.dart';
|
||||
import 'storage_service.dart';
|
||||
import 'notification_service.dart';
|
||||
import 'encouragement_service.dart';
|
||||
import 'points_service.dart';
|
||||
import 'achievement_service.dart';
|
||||
|
||||
/// GetIt instance for dependency injection
|
||||
final getIt = GetIt.instance;
|
||||
@@ -31,6 +33,10 @@ Future<void> initializeDI() async {
|
||||
return service;
|
||||
});
|
||||
|
||||
// Register synchronous services
|
||||
getIt.registerSingleton<PointsService>(PointsService());
|
||||
getIt.registerSingleton<AchievementService>(AchievementService());
|
||||
|
||||
// Wait for all services to be initialized
|
||||
await getIt.allReady();
|
||||
|
||||
|
||||
160
lib/services/points_service.dart
Normal file
160
lib/services/points_service.dart
Normal file
@@ -0,0 +1,160 @@
|
||||
import 'dart:math';
|
||||
import '../models/focus_session.dart';
|
||||
import '../models/user_progress.dart';
|
||||
|
||||
/// Service for calculating and managing points
|
||||
class PointsService {
|
||||
/// Calculate points earned from a focus session
|
||||
/// Returns a map with breakdown: {basePoints, honestyBonus, total, breakdown}
|
||||
Map<String, dynamic> calculateSessionPoints(FocusSession session) {
|
||||
// Base points = actual minutes focused
|
||||
int basePoints = session.actualMinutes;
|
||||
|
||||
// Honesty bonus: reward for recording distractions (with cap to prevent abuse)
|
||||
int honestyBonus = _calculateHonestyBonus(
|
||||
session.distractionCount,
|
||||
session.actualMinutes,
|
||||
);
|
||||
|
||||
int total = basePoints + honestyBonus;
|
||||
|
||||
// Detailed breakdown for UI display
|
||||
List<Map<String, dynamic>> breakdown = [
|
||||
{
|
||||
'label': '专注时长',
|
||||
'value': basePoints,
|
||||
'description': '每专注1分钟获得1积分',
|
||||
},
|
||||
{
|
||||
'label': '诚实奖励',
|
||||
'value': honestyBonus,
|
||||
'description': '记录分心情况获得额外积分',
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
'basePoints': basePoints,
|
||||
'honestyBonus': honestyBonus,
|
||||
'total': total,
|
||||
'breakdown': breakdown,
|
||||
};
|
||||
}
|
||||
|
||||
/// Calculate honesty bonus with anti-abuse cap
|
||||
/// Strategy: Max 1 rewarded distraction per 10 minutes
|
||||
int _calculateHonestyBonus(int distractionCount, int minutes) {
|
||||
if (distractionCount == 0) return 0;
|
||||
|
||||
// Cap: 1 rewarded distraction per 10 minutes
|
||||
// 15 min → max 2 distractions
|
||||
// 25 min → max 3 distractions
|
||||
// 45 min → max 5 distractions
|
||||
int maxBonusDistraction = max(1, (minutes / 10).ceil());
|
||||
int rewardedCount = min(distractionCount, maxBonusDistraction);
|
||||
|
||||
return rewardedCount; // 1 point per recorded distraction (up to cap)
|
||||
}
|
||||
|
||||
/// Process daily check-in and return points earned with detailed breakdown
|
||||
Map<String, dynamic> processCheckIn(UserProgress progress) {
|
||||
final now = DateTime.now();
|
||||
|
||||
// Base check-in points
|
||||
int points = 5;
|
||||
List<Map<String, dynamic>> breakdown = [
|
||||
{
|
||||
'label': '每日签到',
|
||||
'value': 5,
|
||||
'description': '每日首次签到获得基础积分',
|
||||
},
|
||||
];
|
||||
|
||||
// Update check-in streak
|
||||
if (_isConsecutiveDay(progress.lastCheckInDate, now)) {
|
||||
progress.consecutiveCheckIns++;
|
||||
|
||||
// Bonus for streak milestones
|
||||
if (progress.consecutiveCheckIns % 7 == 0) {
|
||||
int weeklyBonus = 30;
|
||||
points += weeklyBonus;
|
||||
breakdown.add({
|
||||
'label': '连续签到奖励',
|
||||
'value': weeklyBonus,
|
||||
'description': '连续签到${progress.consecutiveCheckIns}天',
|
||||
});
|
||||
} else if (progress.consecutiveCheckIns % 30 == 0) {
|
||||
int monthlyBonus = 100;
|
||||
points += monthlyBonus;
|
||||
breakdown.add({
|
||||
'label': '连续签到奖励',
|
||||
'value': monthlyBonus,
|
||||
'description': '连续签到${progress.consecutiveCheckIns}天',
|
||||
});
|
||||
}
|
||||
} else {
|
||||
progress.consecutiveCheckIns = 1;
|
||||
}
|
||||
|
||||
// Update last check-in date
|
||||
progress.lastCheckInDate = now;
|
||||
|
||||
// Add to check-in history (store date only, not time)
|
||||
final dateOnly = DateTime(now.year, now.month, now.day);
|
||||
if (!progress.checkInHistory.any((date) =>
|
||||
date.year == dateOnly.year &&
|
||||
date.month == dateOnly.month &&
|
||||
date.day == dateOnly.day)) {
|
||||
progress.checkInHistory.add(dateOnly);
|
||||
}
|
||||
|
||||
return {
|
||||
'points': points,
|
||||
'consecutiveDays': progress.consecutiveCheckIns,
|
||||
'breakdown': breakdown,
|
||||
};
|
||||
}
|
||||
|
||||
/// Check if two dates are consecutive days
|
||||
bool _isConsecutiveDay(DateTime? lastDate, DateTime currentDate) {
|
||||
if (lastDate == null) return false;
|
||||
|
||||
final lastDateOnly = DateTime(lastDate.year, lastDate.month, lastDate.day);
|
||||
final currentDateOnly =
|
||||
DateTime(currentDate.year, currentDate.month, currentDate.day);
|
||||
|
||||
final diff = currentDateOnly.difference(lastDateOnly).inDays;
|
||||
return diff == 1;
|
||||
}
|
||||
|
||||
/// Calculate level based on total points
|
||||
Map<String, dynamic> calculateLevel(int totalPoints) {
|
||||
// Simple level calculation: each level requires 100 points
|
||||
int level = (totalPoints / 100).floor() + 1;
|
||||
int pointsForCurrentLevel = (level - 1) * 100;
|
||||
int pointsForNextLevel = level * 100;
|
||||
int pointsInCurrentLevel = totalPoints - pointsForCurrentLevel;
|
||||
double progress = pointsInCurrentLevel / 100;
|
||||
|
||||
return {
|
||||
'level': level,
|
||||
'pointsForCurrentLevel': pointsForCurrentLevel,
|
||||
'pointsForNextLevel': pointsForNextLevel,
|
||||
'pointsInCurrentLevel': pointsInCurrentLevel,
|
||||
'progress': progress,
|
||||
};
|
||||
}
|
||||
|
||||
/// Get points balance summary
|
||||
Map<String, dynamic> getPointsSummary(UserProgress progress) {
|
||||
final levelInfo = calculateLevel(progress.totalPoints);
|
||||
|
||||
return {
|
||||
'currentPoints': progress.currentPoints,
|
||||
'totalPoints': progress.totalPoints,
|
||||
'level': levelInfo['level'],
|
||||
'levelProgress': levelInfo['progress'],
|
||||
'consecutiveCheckIns': progress.consecutiveCheckIns,
|
||||
'totalCheckIns': progress.checkInHistory.length,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ import 'package:flutter/foundation.dart';
|
||||
import 'storage_service.dart';
|
||||
import 'notification_service.dart';
|
||||
import 'encouragement_service.dart';
|
||||
import 'points_service.dart';
|
||||
import 'achievement_service.dart';
|
||||
|
||||
/// Service Locator - 统一管理所有服务实例
|
||||
class ServiceLocator {
|
||||
@@ -13,6 +15,8 @@ class ServiceLocator {
|
||||
late StorageService _storageService;
|
||||
late NotificationService _notificationService;
|
||||
late EncouragementService _encouragementService;
|
||||
late PointsService _pointsService;
|
||||
late AchievementService _achievementService;
|
||||
bool _isInitialized = false;
|
||||
|
||||
/// 初始化所有服务
|
||||
@@ -33,6 +37,12 @@ class ServiceLocator {
|
||||
_encouragementService = EncouragementService();
|
||||
await _encouragementService.loadMessages();
|
||||
|
||||
// 初始化积分服务
|
||||
_pointsService = PointsService();
|
||||
|
||||
// 初始化成就服务
|
||||
_achievementService = AchievementService();
|
||||
|
||||
_isInitialized = true;
|
||||
if (kDebugMode) {
|
||||
print('ServiceLocator initialized successfully');
|
||||
@@ -63,6 +73,18 @@ class ServiceLocator {
|
||||
return _encouragementService;
|
||||
}
|
||||
|
||||
/// 获取积分服务实例
|
||||
PointsService get pointsService {
|
||||
_checkInitialized();
|
||||
return _pointsService;
|
||||
}
|
||||
|
||||
/// 获取成就服务实例
|
||||
AchievementService get achievementService {
|
||||
_checkInitialized();
|
||||
return _achievementService;
|
||||
}
|
||||
|
||||
/// 检查服务是否已初始化
|
||||
void _checkInitialized() {
|
||||
if (!_isInitialized) {
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../models/focus_session.dart';
|
||||
import '../models/user_progress.dart';
|
||||
|
||||
/// Service to manage local storage using Hive
|
||||
class StorageService {
|
||||
static const String _focusSessionBox = 'focus_sessions';
|
||||
|
||||
static const String _userProgressBox = 'user_progress';
|
||||
static const String _progressKey = 'user_progress_key';
|
||||
|
||||
// Cache for today's sessions to improve performance
|
||||
List<FocusSession>? _todaySessionsCache;
|
||||
DateTime? _cacheDate;
|
||||
|
||||
// Cache for user progress
|
||||
UserProgress? _userProgressCache;
|
||||
|
||||
/// Initialize Hive storage service
|
||||
///
|
||||
///
|
||||
/// This method initializes Hive, registers adapters, and opens the focus sessions box.
|
||||
/// It should be called once during app initialization.
|
||||
Future<void> init() async {
|
||||
@@ -20,10 +26,12 @@ class StorageService {
|
||||
|
||||
// Register adapters
|
||||
Hive.registerAdapter(FocusSessionAdapter());
|
||||
Hive.registerAdapter(UserProgressAdapter());
|
||||
|
||||
// Open boxes
|
||||
await Hive.openBox<FocusSession>(_focusSessionBox);
|
||||
|
||||
await Hive.openBox<UserProgress>(_userProgressBox);
|
||||
|
||||
if (kDebugMode) {
|
||||
print('StorageService initialized successfully');
|
||||
}
|
||||
@@ -37,13 +45,92 @@ class StorageService {
|
||||
|
||||
/// Get the focus sessions box
|
||||
Box<FocusSession> get _sessionsBox => Hive.box<FocusSession>(_focusSessionBox);
|
||||
|
||||
|
||||
/// Get the user progress box
|
||||
Box<UserProgress> get _progressBox => Hive.box<UserProgress>(_userProgressBox);
|
||||
|
||||
/// Invalidate the cache when data changes
|
||||
void _invalidateCache() {
|
||||
_todaySessionsCache = null;
|
||||
_cacheDate = null;
|
||||
}
|
||||
|
||||
/// Invalidate user progress cache
|
||||
void _invalidateProgressCache() {
|
||||
_userProgressCache = null;
|
||||
}
|
||||
|
||||
// ==================== User Progress Methods ====================
|
||||
|
||||
/// Get user progress (creates new one if doesn't exist)
|
||||
UserProgress getUserProgress() {
|
||||
try {
|
||||
// Return cached progress if available
|
||||
if (_userProgressCache != null) {
|
||||
return _userProgressCache!;
|
||||
}
|
||||
|
||||
// Try to get from box
|
||||
var progress = _progressBox.get(_progressKey);
|
||||
|
||||
// Create new progress if doesn't exist
|
||||
if (progress == null) {
|
||||
progress = UserProgress();
|
||||
_progressBox.put(_progressKey, progress);
|
||||
}
|
||||
|
||||
// Cache and return
|
||||
_userProgressCache = progress;
|
||||
return progress;
|
||||
} catch (e) {
|
||||
if (kDebugMode) {
|
||||
print('Failed to get user progress: $e');
|
||||
}
|
||||
// Return new progress as fallback
|
||||
return UserProgress();
|
||||
}
|
||||
}
|
||||
|
||||
/// Save user progress
|
||||
Future<void> saveUserProgress(UserProgress progress) async {
|
||||
try {
|
||||
await _progressBox.put(_progressKey, progress);
|
||||
_userProgressCache = progress; // Update cache
|
||||
} catch (e) {
|
||||
if (kDebugMode) {
|
||||
print('Failed to save user progress: $e');
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Update user progress with a function
|
||||
Future<void> updateUserProgress(Function(UserProgress) updateFn) async {
|
||||
try {
|
||||
final progress = getUserProgress();
|
||||
updateFn(progress);
|
||||
await saveUserProgress(progress);
|
||||
} catch (e) {
|
||||
if (kDebugMode) {
|
||||
print('Failed to update user progress: $e');
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Clear user progress (for testing/reset)
|
||||
Future<void> clearUserProgress() async {
|
||||
try {
|
||||
await _progressBox.delete(_progressKey);
|
||||
_invalidateProgressCache();
|
||||
} catch (e) {
|
||||
if (kDebugMode) {
|
||||
print('Failed to clear user progress: $e');
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Save a focus session to local storage
|
||||
///
|
||||
/// [session] - The focus session to save
|
||||
|
||||
Reference in New Issue
Block a user