优化
This commit is contained in:
169
lib/theme/app_constants.dart
Normal file
169
lib/theme/app_constants.dart
Normal file
@@ -0,0 +1,169 @@
|
||||
/// Design system constants for FocusBuddy app
|
||||
///
|
||||
/// This file contains all magic numbers extracted from the codebase
|
||||
/// to ensure consistency and maintainability.
|
||||
library;
|
||||
|
||||
/// Spacing constants following 8px grid system
|
||||
class AppSpacing {
|
||||
AppSpacing._();
|
||||
|
||||
static const double xs = 4.0;
|
||||
static const double sm = 8.0;
|
||||
static const double md = 12.0;
|
||||
static const double base = 16.0;
|
||||
static const double lg = 20.0;
|
||||
static const double xl = 24.0;
|
||||
static const double xxl = 32.0;
|
||||
static const double xxxl = 40.0;
|
||||
static const double huge = 48.0;
|
||||
static const double massive = 60.0;
|
||||
static const double gigantic = 80.0;
|
||||
}
|
||||
|
||||
/// Duration-related constants
|
||||
class AppDurations {
|
||||
AppDurations._();
|
||||
|
||||
// Default focus session duration (minutes)
|
||||
static const int defaultFocusDuration = 25;
|
||||
|
||||
// Available duration options (minutes)
|
||||
static const List<int> availableDurations = [15, 25, 45];
|
||||
|
||||
// Timer tick interval
|
||||
static const Duration timerTickInterval = Duration(seconds: 1);
|
||||
|
||||
// Seconds per minute (for conversions)
|
||||
static const int secondsPerMinute = 60;
|
||||
|
||||
// Notification update interval when app is backgrounded
|
||||
static const int notificationUpdateIntervalSeconds = 30;
|
||||
|
||||
// Animation durations
|
||||
static const Duration pageTransition = Duration(milliseconds: 300);
|
||||
|
||||
// SnackBar display durations
|
||||
static const Duration snackBarShort = Duration(seconds: 2);
|
||||
static const Duration snackBarMedium = Duration(seconds: 3);
|
||||
}
|
||||
|
||||
/// Onboarding screen constants
|
||||
class OnboardingConstants {
|
||||
OnboardingConstants._();
|
||||
|
||||
static const int totalPages = 3;
|
||||
static const double horizontalPadding = 32.0;
|
||||
static const double emojiSize = 80.0;
|
||||
static const double indicatorWidth = 24.0;
|
||||
static const double indicatorHeight = 4.0;
|
||||
static const double indicatorActiveWidth = 8.0;
|
||||
static const double indicatorActiveHeight = 8.0;
|
||||
}
|
||||
|
||||
/// Settings screen constants
|
||||
class SettingsConstants {
|
||||
SettingsConstants._();
|
||||
|
||||
static const double iconSize = 16.0;
|
||||
static const double sectionSpacing = 20.0;
|
||||
static const double optionHeight = 12.0;
|
||||
static const double optionSpacing = 2.0;
|
||||
static const double radioButtonSize = 20.0;
|
||||
static const double radioCheckIconSize = 12.0;
|
||||
static const double badgeFontSize = 12.0;
|
||||
}
|
||||
|
||||
/// Profile screen constants
|
||||
class ProfileConstants {
|
||||
ProfileConstants._();
|
||||
|
||||
static const double avatarRadius = 40.0;
|
||||
static const double avatarEmojiSize = 40.0;
|
||||
static const double statDividerHeight = 40.0;
|
||||
static const double progressBarHeight = 10.0;
|
||||
static const double progressBarRadius = 5.0;
|
||||
static const double calendarCellSize = 40.0;
|
||||
static const int calendarDisplayDays = 28;
|
||||
static const int maxDisplayedAchievements = 6;
|
||||
|
||||
// Check-in milestones
|
||||
static const int weeklyCheckInMilestone = 7;
|
||||
}
|
||||
|
||||
/// Completion screen constants
|
||||
class CompletionConstants {
|
||||
CompletionConstants._();
|
||||
|
||||
static const double emojiSize = 64.0;
|
||||
}
|
||||
|
||||
/// Calendar constants (shared between profile and session detail)
|
||||
class CalendarConstants {
|
||||
CalendarConstants._();
|
||||
|
||||
static const int displayDays = 28;
|
||||
static const int daysOffset = 27; // displayDays - 1
|
||||
}
|
||||
|
||||
/// Points and gamification constants
|
||||
class GameConstants {
|
||||
GameConstants._();
|
||||
|
||||
// Points calculation
|
||||
static const int pointsPerFocusMinute = 1;
|
||||
static const int honestyBonusMinutesPerDistraction = 10;
|
||||
|
||||
// Check-in rewards
|
||||
static const int checkInBasePoints = 5;
|
||||
static const int weeklyStreakDays = 7;
|
||||
static const int weeklyStreakBonus = 30;
|
||||
static const int monthlyStreakDays = 30;
|
||||
static const int monthlyStreakBonus = 100;
|
||||
|
||||
// Level progression
|
||||
static const int pointsPerLevel = 100;
|
||||
}
|
||||
|
||||
/// Notification IDs
|
||||
class NotificationIds {
|
||||
NotificationIds._();
|
||||
|
||||
static const int complete = 0;
|
||||
static const int reminder = 1;
|
||||
static const int ongoing = 2;
|
||||
}
|
||||
|
||||
/// Icon sizes
|
||||
class IconSizes {
|
||||
IconSizes._();
|
||||
|
||||
static const double small = 12.0;
|
||||
static const double medium = 16.0;
|
||||
static const double large = 20.0;
|
||||
static const double extraLarge = 24.0;
|
||||
}
|
||||
|
||||
/// Font sizes (complementing AppTextStyles)
|
||||
class FontSizes {
|
||||
FontSizes._();
|
||||
|
||||
static const double caption = 12.0;
|
||||
static const double body = 14.0;
|
||||
static const double bodyLarge = 16.0;
|
||||
static const double subtitle = 18.0;
|
||||
static const double title = 20.0;
|
||||
static const double heading = 28.0;
|
||||
static const double display = 32.0;
|
||||
}
|
||||
|
||||
/// Border radius values
|
||||
class BorderRadii {
|
||||
BorderRadii._();
|
||||
|
||||
static const double small = 8.0;
|
||||
static const double medium = 12.0;
|
||||
static const double large = 16.0;
|
||||
static const double extraLarge = 24.0;
|
||||
static const double circular = 999.0;
|
||||
}
|
||||
Reference in New Issue
Block a user