Files
plezy/lib/utils/layout_constants.dart
T

71 lines
2.3 KiB
Dart
Raw Normal View History

2025-12-13 00:16:50 +01:00
import 'package:flutter/widgets.dart';
2025-11-16 20:53:59 +01:00
/// Layout and sizing constants used throughout the application
/// Screen width breakpoints for responsive design
class ScreenBreakpoints {
2025-12-13 00:16:50 +01:00
static const double mobile = 600;
static const double wideTablet = 900;
2025-11-16 20:53:59 +01:00
static const double desktop = 1200;
static const double largeDesktop = 1600;
2025-12-13 00:16:50 +01:00
// Legacy alias for backward compatibility
static const double tablet = mobile;
static bool isMobile(double width) => width < mobile;
static bool isTablet(double width) => width >= mobile && width < desktop;
2025-12-15 02:29:03 +01:00
static bool isWideTablet(double width) => width >= wideTablet && width < desktop;
2025-12-13 00:16:50 +01:00
2025-12-15 02:29:03 +01:00
static bool isDesktop(double width) => width >= desktop && width < largeDesktop;
2025-12-13 00:16:50 +01:00
static bool isLargeDesktop(double width) => width >= largeDesktop;
static bool isDesktopOrLarger(double width) => width >= desktop;
static bool isWideTabletOrLarger(double width) => width >= wideTablet;
2025-11-16 20:53:59 +01:00
}
2026-04-25 03:16:11 +02:00
/// Animation and notification durations.
class AppDurations {
static const Duration animFast = Duration(milliseconds: 200);
static const Duration animMedium = Duration(milliseconds: 300);
static const Duration animSlow = Duration(milliseconds: 500);
static const Duration snackBarDefault = Duration(seconds: 3);
static const Duration snackBarLong = Duration(seconds: 4);
}
2025-11-16 20:53:59 +01:00
class GridLayoutConstants {
static const double posterAspectRatio = 2 / 3.3;
2026-01-08 14:42:49 +01:00
static const double episodeThumbnailAspectRatio = 16 / 9;
static const double episodeGridCellAspectRatio = 1.4;
2025-11-16 20:53:59 +01:00
static const double crossAxisSpacing = 0;
static const double mainAxisSpacing = 0;
2025-12-13 00:16:50 +01:00
/// Standard grid padding
2026-03-04 18:28:49 +01:00
static EdgeInsets get gridPadding => const EdgeInsets.only(left: 2, right: 2, bottom: 2);
2025-11-16 20:53:59 +01:00
}
2026-05-16 11:56:12 +02:00
class TvLayoutConstants {
static const double horizontalInset = 72;
static const double shelfHorizontalInset = 56;
static const double shelfVerticalGap = 32;
static const double heroContentMaxWidth = 760;
static const double heroLogoWidth = 520;
static const double heroLogoHeight = 150;
static const double compactHeroLogoWidth = 420;
static const double compactHeroLogoHeight = 112;
static double scaleForHeight(double height) => (height / 1080).clamp(0.85, 1.35).toDouble();
static double scaleForSize(Size size) => scaleForHeight(size.height);
static double scaleOf(BuildContext context) => scaleForSize(MediaQuery.sizeOf(context));
}