多语言支持

This commit is contained in:
ytc1012
2025-11-24 11:25:33 +08:00
parent 2c6ced5c14
commit 4444c401b9
14 changed files with 672 additions and 167 deletions

View File

@@ -1,21 +1,22 @@
/// Predefined distraction types
class DistractionType {
static const scrollingSocialMedia = 'scrolling_social_media';
static const gotInterrupted = 'got_interrupted';
static const feltOverwhelmed = 'felt_overwhelmed';
static const justZonedOut = 'just_zoned_out';
static const phoneNotification = 'phone_notification';
static const socialMedia = 'social_media';
static const thoughts = 'thoughts';
static const other = 'other';
/// Get display name for a distraction type
/// Get display name for a distraction type (returns key for localization)
static String getDisplayName(String type) {
// Returns the localization key - actual translation done in UI
switch (type) {
case scrollingSocialMedia:
return 'Scrolling social media';
case gotInterrupted:
return 'Got interrupted';
case feltOverwhelmed:
return 'Felt overwhelmed';
case justZonedOut:
return 'Just zoned out';
case phoneNotification:
return 'Phone / Notification';
case socialMedia:
return 'Social Media';
case thoughts:
return 'Thoughts / Daydream';
case other:
return 'Other';
default:
return 'Unknown';
}
@@ -24,14 +25,14 @@ class DistractionType {
/// Get emoji for a distraction type
static String getEmoji(String type) {
switch (type) {
case scrollingSocialMedia:
case phoneNotification:
return '📱';
case gotInterrupted:
return '👥';
case feltOverwhelmed:
return '😰';
case justZonedOut:
case socialMedia:
return '💬';
case thoughts:
return '💭';
case other:
return '🌟';
default:
return '';
}
@@ -39,9 +40,9 @@ class DistractionType {
/// Get all distraction types
static List<String> get all => [
scrollingSocialMedia,
gotInterrupted,
feltOverwhelmed,
justZonedOut,
phoneNotification,
socialMedia,
thoughts,
other,
];
}