import 'dart:math' as math; class GameConstants { static const double gemSize = 64.0; static const double gridPadding = 16.0; static const int minMatchLength = 3; // Gem types static const List gemTypes = [0, 1, 2, 3, 4, 5]; // Animation durations static const double swapDuration = 0.3; static const double fallDuration = 0.5; static const double matchDuration = 0.2; // Scoring static const int baseScore = 100; static const int comboMultiplier = 50; // Dynamic gem size calculation static double calculateGemSize(int gridWidth, int gridHeight, double availableWidth, double availableHeight) { // Calculate gem size based on available space and grid dimensions final gemSizeByWidth = (availableWidth - (2 * gridPadding)) / gridWidth; final gemSizeByHeight = (availableHeight - (2 * gridPadding)) / gridHeight; // Use the smaller dimension to ensure the grid fits in both directions final calculatedSize = math.min(gemSizeByWidth, gemSizeByHeight); // Ensure minimum size for playability and maximum size for performance return math.max(32.0, math.min(calculatedSize, 80.0)); } }