Files
plezy/lib/utils/layout_constants.dart
T

84 lines
3.1 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
/// Breakpoint for mobile devices (< 600px)
static const double mobile = 600;
/// Breakpoint for wide tablets / small desktops (900px)
/// Used for intermediate responsive layouts
static const double wideTablet = 900;
2025-11-16 20:53:59 +01:00
/// Breakpoint for desktop devices (1200px)
static const double desktop = 1200;
/// Breakpoint for large desktop devices (1600px)
static const double largeDesktop = 1600;
2025-12-13 00:16:50 +01:00
// Legacy alias for backward compatibility
static const double tablet = mobile;
/// Whether width is mobile-sized (< 600px)
static bool isMobile(double width) => width < mobile;
/// Whether width is tablet-sized (600px - 1199px)
static bool isTablet(double width) => width >= mobile && width < desktop;
/// Whether width is wide tablet (900px - 1199px)
/// Useful for layouts that need more columns than phone but less than 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
/// Whether width is desktop-sized (1200px - 1599px)
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
/// Whether width is large desktop-sized (>= 1600px)
static bool isLargeDesktop(double width) => width >= largeDesktop;
/// Whether width is desktop or larger (>= 1200px)
static bool isDesktopOrLarger(double width) => width >= desktop;
/// Whether width is wide tablet or larger (>= 900px)
static bool isWideTabletOrLarger(double width) => width >= wideTablet;
2025-11-16 20:53:59 +01:00
}
/// Grid layout constants
class GridLayoutConstants {
/// Maximum cross-axis extent for grid items in comfortable density mode
static const double comfortableDesktop = 250;
static const double comfortableTablet = 210;
static const double comfortableMobile = 180;
2025-11-16 20:53:59 +01:00
/// Maximum cross-axis extent for grid items in compact density mode
static const double compactDesktop = 160;
static const double compactTablet = 140;
static const double compactMobile = 120;
2025-11-16 20:53:59 +01:00
/// Maximum cross-axis extent for grid items in normal density mode
static const double normalDesktop = 220;
static const double normalTablet = 185;
static const double normalMobile = 155;
2025-11-16 20:53:59 +01:00
2026-01-22 14:33:06 +01:00
/// Maximum cross-axis extent for grid items on TV (10ft viewing distance)
static const double comfortableTV = 200;
static const double normalTV = 170;
static const double compactTV = 140;
2026-01-08 14:42:49 +01:00
/// Default aspect ratio for media card grid cells (poster + text)
2025-11-16 20:53:59 +01:00
static const double posterAspectRatio = 2 / 3.3;
2026-01-08 14:42:49 +01:00
/// Aspect ratio for episode thumbnail image (16:9)
static const double episodeThumbnailAspectRatio = 16 / 9;
/// Aspect ratio for episode thumbnail grid cells (16:9 image + text area)
/// This is wider than posterAspectRatio but accounts for ~60px text below
static const double episodeGridCellAspectRatio = 1.4;
2025-12-13 00:16:50 +01:00
/// Grid spacing (edge-to-edge cards)
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-02-15 03:14:04 +01:00
static EdgeInsets get gridPadding => const EdgeInsets.only(left: 8, right: 8, bottom: 8);
2025-11-16 20:53:59 +01:00
}