147 lines
4.4 KiB
Dart
147 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class AppDimensions {
|
|
// Private constructor to prevent instantiation
|
|
AppDimensions._();
|
|
|
|
// Screen breakpoints
|
|
static const double smallScreenWidth = 460;
|
|
static const double tabletWidth = 600;
|
|
static const double largeScreenWidth = 1200;
|
|
|
|
// Padding values
|
|
static const double paddingXS = 4.0;
|
|
static const double paddingS = 8.0;
|
|
static const double paddingM = 12.0;
|
|
static const double paddingL = 16.0;
|
|
static const double paddingXL = 25.0;
|
|
static const double paddingXXL = 30.0;
|
|
static const double paddingXXXL = 30.0;
|
|
static const double paddingHuge = 40.0;
|
|
|
|
// Spacing values
|
|
static const double spacingXS = 4.0;
|
|
static const double spacingS = 8.0;
|
|
static const double spacingM = 12.0;
|
|
static const double spacingL = 16.0;
|
|
static const double spacingXL = 20.0;
|
|
static const double spacingXXL = 23.0;
|
|
static const double spacingXXXL = 30.0;
|
|
static const double spacingHuge = 40.0;
|
|
|
|
// Font sizes
|
|
static const double fontSizeXS = 10.0;
|
|
static const double fontSizeS = 12.0;
|
|
static const double fontSizeM = 14.0;
|
|
static const double fontSizeL = 16.0;
|
|
static const double fontSizeXL = 18.0;
|
|
static const double fontSizeXXL = 20.0;
|
|
static const double fontSizeXXXL = 22.0;
|
|
static const double fontSizeHuge = 24.0;
|
|
static const double fontSizeTitle = 36.0;
|
|
static const double fontSizeTitleLarge = 42.0;
|
|
|
|
// Icon sizes
|
|
static const double iconSizeXS = 16.0;
|
|
static const double iconSizeS = 20.0;
|
|
static const double iconSizeM = 24.0;
|
|
static const double iconSizeL = 30.0;
|
|
static const double iconSizeXL = 33.0;
|
|
static const double iconSizeXXL = 40.0;
|
|
static const double iconSizeHuge = 60.0;
|
|
|
|
// Border radius
|
|
static const double radiusXS = 3.0;
|
|
static const double radiusS = 5.0;
|
|
static const double radiusM = 8.0;
|
|
static const double radiusL = 10.0;
|
|
static const double radiusXL = 15.0;
|
|
static const double radiusXXL = 20.0;
|
|
static const double radiusCircle = 50.0;
|
|
|
|
// Button heights
|
|
static const double buttonHeightS = 40.0;
|
|
static const double buttonHeightM = 48.0;
|
|
static const double buttonHeightL = 56.0;
|
|
|
|
// Image heights
|
|
static const double imageHeightS = 150.0;
|
|
static const double imageHeightM = 200.0;
|
|
static const double imageHeightL = 250.0;
|
|
|
|
// Page indicator sizes
|
|
static const double pageIndicatorSize = 10.0;
|
|
static const double pageIndicatorSizeActive = 16.0;
|
|
|
|
// Responsive methods
|
|
static bool isSmallScreen(BuildContext context) {
|
|
return MediaQuery.of(context).size.width < smallScreenWidth;
|
|
}
|
|
|
|
static bool isTablet(BuildContext context) {
|
|
final width = MediaQuery.of(context).size.width;
|
|
return width >= tabletWidth && width < largeScreenWidth;
|
|
}
|
|
|
|
static bool isLargeScreen(BuildContext context) {
|
|
return MediaQuery.of(context).size.width >= largeScreenWidth;
|
|
}
|
|
|
|
// Responsive padding
|
|
static double getHorizontalPadding(BuildContext context) {
|
|
return isSmallScreen(context) ? paddingXL : paddingXXL;
|
|
}
|
|
|
|
static double getVerticalPadding(BuildContext context) {
|
|
return isSmallScreen(context) ? paddingL : paddingXXL;
|
|
}
|
|
|
|
// Responsive font size
|
|
static double getTitleFontSize(BuildContext context) {
|
|
final screenWidth = MediaQuery.of(context).size.width;
|
|
if (isSmallScreen(context)) {
|
|
return screenWidth * 0.07;
|
|
} else if (isTablet(context)) {
|
|
return fontSizeTitleLarge;
|
|
} else {
|
|
return screenWidth * 0.08;
|
|
}
|
|
}
|
|
|
|
static double getSubtitleFontSize(BuildContext context) {
|
|
return isSmallScreen(context) ? fontSizeM : fontSizeL;
|
|
}
|
|
|
|
static double getBodyFontSize(BuildContext context) {
|
|
return isSmallScreen(context) ? fontSizeS : fontSizeM;
|
|
}
|
|
|
|
// Responsive spacing
|
|
static double getVerticalSpacing(BuildContext context) {
|
|
return isSmallScreen(context) ? spacingL : spacingXXL;
|
|
}
|
|
|
|
static double getSmallVerticalSpacing(BuildContext context) {
|
|
return isSmallScreen(context) ? spacingM : spacingL;
|
|
}
|
|
|
|
// Responsive icon size
|
|
static double getIconSize(BuildContext context) {
|
|
return isSmallScreen(context) ? iconSizeM : iconSizeXL;
|
|
}
|
|
|
|
// Screen dimensions
|
|
static double screenWidth(BuildContext context) {
|
|
return MediaQuery.of(context).size.width;
|
|
}
|
|
|
|
static double screenHeight(BuildContext context) {
|
|
return MediaQuery.of(context).size.height;
|
|
}
|
|
|
|
// Safe area padding
|
|
static EdgeInsets getSafeAreaPadding(BuildContext context) {
|
|
return MediaQuery.of(context).padding;
|
|
}
|
|
}
|