diff --git a/lib/presentation/screens/tower/towers.dart b/lib/presentation/screens/tower/towers.dart index d472c43..f6715b1 100644 --- a/lib/presentation/screens/tower/towers.dart +++ b/lib/presentation/screens/tower/towers.dart @@ -74,9 +74,11 @@ class _TowersState extends State { contentPadding: const EdgeInsets.symmetric(horizontal: 8), horizontalTitleGap: 8, + minVerticalPadding: -4, leading: ImageOutliner( imageName: tower.image, imagePath: towerImage(tower.image), + width: constraintsValues[towerImageWidth], ), title: Text( tower.name, diff --git a/lib/presentation/widgets/image_outline.dart b/lib/presentation/widgets/image_outline.dart index 4be06b5..c1ffb58 100644 --- a/lib/presentation/widgets/image_outline.dart +++ b/lib/presentation/widgets/image_outline.dart @@ -4,19 +4,23 @@ class ImageOutliner extends StatelessWidget { final String imageName; final String imagePath; final double? width; - const ImageOutliner( - {super.key, - required this.imageName, - required this.imagePath, - this.width}); + final double? height; + + const ImageOutliner({ + super.key, + required this.imageName, + required this.imagePath, + this.width, + this.height, + }); @override Widget build(BuildContext context) { double maxWidth = width ?? 65; - double maxHeight = 90; + double maxHeight = height ?? 90; return SizedBox( width: maxWidth, - height: maxHeight, + // height: maxHeight, child: Stack( alignment: AlignmentDirectional.center, fit: StackFit.loose, diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index 08421f9..ce8ce9d 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -176,6 +176,7 @@ const String towerAspectRatio = 'towerChildAspectRatio'; const String towerTitleStyle = 'towerTitleStyle'; const String towerSubtitleStyle = 'towerSubtitleStyle'; const String towerSubtitleRows = 'towerSubtitleMaxRows'; +const String towerImageWidth = 'towerImageWidth'; const String heroCrossCount = 'heroCrossAxisCount'; const String heroAspectRatio = 'heroChildAspectRatio'; diff --git a/lib/utilities/layout_presets.dart b/lib/utilities/layout_presets.dart index f259e38..b25eda4 100644 --- a/lib/utilities/layout_presets.dart +++ b/lib/utilities/layout_presets.dart @@ -1,120 +1,5 @@ import '/utilities/constants.dart'; -// // ----- Towers and Heroes ----- -// const Map constraintsSmallPreset = { -// "crossAxisCount": 1, -// "rowsToShow": 2, -// "childAspectRatio": 3.1, -// "titleFontSize": 17.0, -// "subtitleFontSize": 15.0, -// }; - -// const Map constraintsNormalPreset = { -// "crossAxisCount": 1, -// "rowsToShow": 2, -// "childAspectRatio": 3.7, -// "titleFontSize": 18.0, -// "subtitleFontSize": 15.0, -// }; - -// const Map constraintsWidePreset = { -// "crossAxisCount": 2, -// "rowsToShow": 3, -// "childAspectRatio": 2.4, -// "titleFontSize": 20.0, -// "subtitleFontSize": 16.0, -// }; - -// const Map constraintsUWPreset = { -// "crossAxisCount": 3, -// "rowsToShow": 3, -// "childAspectRatio": 2.0, -// "titleFontSize": 24.0, -// "subtitleFontSize": 15.0, -// }; - -// // ----- Bloons ----- -// const Map constraintsBloonSmallPreset = { -// "crossAxisCount": 2, -// "crossAxisCountBoss": 1, -// "childAspectRatio": 1.95, -// "childAspectRatioBoss": 3.45, -// "titleFontSize": 16.0, -// "imageWidth": 29.0, -// "textStyleBoss": bolderNormalStyle, -// }; - -// const Map constraintsBloonNormalPreset = { -// "crossAxisCount": 2, -// "crossAxisCountBoss": 1, -// "childAspectRatio": 2.3, -// "childAspectRatioBoss": 4.05, -// "titleFontSize": 19.0, -// "imageWidth": 35.0, -// "textStyleBoss": smallTitleStyle, -// }; - -// const Map constraintsBloonWidePreset = { -// "crossAxisCount": 3, -// "crossAxisCountBoss": 2, -// "childAspectRatio": 2.2, -// "childAspectRatioBoss": 3.5, -// "titleFontSize": 19.0, -// "imageWidth": 42.0, -// "textStyleBoss": smallTitleStyle, -// }; - -// const Map constraintsBloonUWPreset = { -// "crossAxisCount": 3, -// "crossAxisCountBoss": 2, -// "childAspectRatio": 2.2, -// "childAspectRatioBoss": 3.5, -// "titleFontSize": 22.0, -// "imageWidth": 56.0, -// "textStyleBoss": titleStyle, -// }; - -// // ----- Maps ----- -// const Map constraintsMapsSmallPreset = { -// "crossAxisCount": 2, -// "rowsToShow": 2, -// "childAspectRatio": 0.95, -// "titleFontSize": 17.0, -// "subtitleFontSize": 15.0, -// "mainAxisSpacing": 0.0, -// "crossAxisSpacing": 0.0, -// }; - -// const Map constraintsMapsNormalPreset = { -// "crossAxisCount": 2, -// "rowsToShow": 3, -// "childAspectRatio": 1, -// "titleFontSize": 24.0, -// "subtitleFontSize": 15.0, -// "mainAxisSpacing": 3.0, -// "crossAxisSpacing": 3.0 -// }; - -// const Map constraintsMapsWidePreset = { -// "crossAxisCount": 3, -// "rowsToShow": 3, -// "childAspectRatio": 0.9, -// "titleFontSize": 24.0, -// "subtitleFontSize": 15.0, -// "mainAxisSpacing": 7.5, -// "crossAxisSpacing": 7.5, -// }; - -// const Map constraintsMapsUWPreset = { -// "crossAxisCount": 4, -// "rowsToShow": 3, -// "childAspectRatio": 0.9, -// "titleFontSize": 24.0, -// "subtitleFontSize": 15.0, -// "mainAxisSpacing": 12.0, -// "crossAxisSpacing": 8.0 -// }; - Map presetUS = { // towers towerCrossCount: 1, @@ -122,6 +7,7 @@ Map presetUS = { towerTitleStyle: titleStyle.copyWith(fontSize: 12.0), towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 12.0), towerSubtitleRows: 2, + towerImageWidth: 50, // heroes heroCrossCount: 1, heroAspectRatio: 3.5, @@ -143,9 +29,213 @@ Map presetUS = { mapCrossCount: 1, mapAspectRatio: 1.5, }; -const Map presetXS = {}; -const Map presetSM = {}; -const Map presetMD = {}; -const Map presetLG = {}; -const Map presetXL = {}; -const Map presetUL = {}; +Map presetXS = { + // towers + towerCrossCount: 1, + towerAspectRatio: 3.55, + towerTitleStyle: titleStyle.copyWith(fontSize: 15.0), + towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 13.0), + towerSubtitleRows: 2, + towerImageWidth: 55, + + // heroes + heroCrossCount: 1, + heroAspectRatio: 3.5, + heroTitleStyle: titleStyle.copyWith(fontSize: 15.0), + heroSubtitleStyle: subtitleStyle.copyWith(fontSize: 13.0), + heroSubtitleRows: 2, + skinCrossCount: 1, + skinAspectRatio: 1.0, + // bloons + bloonCrossCount: 2, + bloonAspectRatio: 2.0, + bloonTitleStyle: smallTitleStyle.copyWith(fontSize: 12.0), + bloonImageWidth: 28.0, + // bosses + bossCrossCount: 1, + bossAspectRatio: 3.0, + bossTitleStyle: titleStyle.copyWith(fontSize: 12), + // maps + mapCrossCount: 1, + mapAspectRatio: 1.5, +}; +Map presetSM = { + // towers + towerCrossCount: 1, + towerAspectRatio: 3.55, + towerTitleStyle: titleStyle.copyWith(fontSize: 17.0), + towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 14.0), + towerSubtitleRows: 2, + towerImageWidth: 65, + + // heroes + heroCrossCount: 1, + heroAspectRatio: 3.5, + heroTitleStyle: titleStyle.copyWith(fontSize: 18.0), + heroSubtitleStyle: subtitleStyle.copyWith(fontSize: 15.0), + heroSubtitleRows: 2, + skinCrossCount: 1, + skinAspectRatio: 1.0, + // bloons + bloonCrossCount: 2, + bloonAspectRatio: 2.0, + bloonTitleStyle: smallTitleStyle.copyWith(fontSize: 12.0), + bloonImageWidth: 28.0, + // bosses + bossCrossCount: 1, + bossAspectRatio: 3.0, + bossTitleStyle: titleStyle.copyWith(fontSize: 12), + // maps + mapCrossCount: 1, + mapAspectRatio: 1.5, +}; +Map presetMD = { + // towers + towerCrossCount: 1, + towerAspectRatio: 3.7, + towerTitleStyle: titleStyle.copyWith(fontSize: 18.0), + towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 14.5), + towerSubtitleRows: 3, + towerImageWidth: 70, + + // heroes + heroCrossCount: 1, + heroAspectRatio: 3.5, + heroTitleStyle: titleStyle.copyWith(fontSize: 20), + heroSubtitleStyle: subtitleStyle.copyWith(fontSize: 16.0), + heroSubtitleRows: 2, + skinCrossCount: 1, + skinAspectRatio: 1.0, + // bloons + bloonCrossCount: 2, + bloonAspectRatio: 2.0, + bloonTitleStyle: smallTitleStyle.copyWith(fontSize: 12.0), + bloonImageWidth: 28.0, + // bosses + bossCrossCount: 1, + bossAspectRatio: 3.0, + bossTitleStyle: titleStyle.copyWith(fontSize: 12), + // maps + mapCrossCount: 1, + mapAspectRatio: 1.5, +}; +Map presetLG = { + // towers + towerCrossCount: 1, + towerAspectRatio: 4.0, + towerTitleStyle: titleStyle.copyWith(fontSize: 20.0), + towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 15), + towerSubtitleRows: 2, + towerImageWidth: 90, + + // heroes + heroCrossCount: 1, + heroAspectRatio: 4.3, + heroTitleStyle: titleStyle.copyWith(fontSize: 20), + heroSubtitleStyle: subtitleStyle.copyWith(fontSize: 16.0), + heroSubtitleRows: 2, + skinCrossCount: 1, + skinAspectRatio: 1.0, + // bloons + bloonCrossCount: 2, + bloonAspectRatio: 2.0, + bloonTitleStyle: smallTitleStyle.copyWith(fontSize: 12.0), + bloonImageWidth: 28.0, + // bosses + bossCrossCount: 1, + bossAspectRatio: 3.0, + bossTitleStyle: titleStyle.copyWith(fontSize: 12), + // maps + mapCrossCount: 1, + mapAspectRatio: 1.5, +}; +Map presetXL = { + // towers + towerCrossCount: 2, + towerAspectRatio: 2.9, + towerTitleStyle: titleStyle.copyWith(fontSize: 16.0), + towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 14.0), + towerSubtitleRows: 2, + towerImageWidth: 50, + + // heroes + heroCrossCount: 2, + heroAspectRatio: 3.0, + heroTitleStyle: titleStyle.copyWith(fontSize: 16), + heroSubtitleStyle: subtitleStyle.copyWith(fontSize: 14.0), + heroSubtitleRows: 2, + skinCrossCount: 2, + skinAspectRatio: 1.0, + // bloons + bloonCrossCount: 2, + bloonAspectRatio: 2.0, + bloonTitleStyle: smallTitleStyle.copyWith(fontSize: 12.0), + bloonImageWidth: 28.0, + // bosses + bossCrossCount: 1, + bossAspectRatio: 3.0, + bossTitleStyle: titleStyle.copyWith(fontSize: 12), + // maps + mapCrossCount: 1, + mapAspectRatio: 1.5, +}; +Map presetXXL = { + // towers + towerCrossCount: 3, + towerAspectRatio: 2.15, + towerTitleStyle: titleStyle.copyWith(fontSize: 16.0), + towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 14.0), + towerSubtitleRows: 2, + towerImageWidth: 65, + + // heroes + heroCrossCount: 2, + heroAspectRatio: 3.5, + heroTitleStyle: titleStyle.copyWith(fontSize: 20), + heroSubtitleStyle: subtitleStyle.copyWith(fontSize: 16.0), + heroSubtitleRows: 2, + skinCrossCount: 3, + skinAspectRatio: 1.0, + // bloons + bloonCrossCount: 2, + bloonAspectRatio: 2.0, + bloonTitleStyle: smallTitleStyle.copyWith(fontSize: 12.0), + bloonImageWidth: 28.0, + // bosses + bossCrossCount: 1, + bossAspectRatio: 3.0, + bossTitleStyle: titleStyle.copyWith(fontSize: 12), + // maps + mapCrossCount: 1, + mapAspectRatio: 1.5, +}; +Map presetXXXL = { + // towers + towerCrossCount: 3, + towerAspectRatio: 2.2, + towerTitleStyle: titleStyle.copyWith(fontSize: 18.0), + towerSubtitleStyle: subtitleStyle.copyWith(fontSize: 14.5), + towerSubtitleRows: 3, + towerImageWidth: 90, + + // heroes + heroCrossCount: 3, + heroAspectRatio: 2.5, + heroTitleStyle: titleStyle.copyWith(fontSize: 20), + heroSubtitleStyle: subtitleStyle.copyWith(fontSize: 16.0), + heroSubtitleRows: 3, + skinCrossCount: 5, + skinAspectRatio: 1.0, + // bloons + bloonCrossCount: 2, + bloonAspectRatio: 2.0, + bloonTitleStyle: smallTitleStyle.copyWith(fontSize: 12.0), + bloonImageWidth: 28.0, + // bosses + bossCrossCount: 1, + bossAspectRatio: 3.0, + bossTitleStyle: titleStyle.copyWith(fontSize: 12), + // maps + mapCrossCount: 1, + mapAspectRatio: 1.5, +}; diff --git a/lib/utilities/utils.dart b/lib/utilities/utils.dart index 0537359..e6e4d2f 100644 --- a/lib/utilities/utils.dart +++ b/lib/utilities/utils.dart @@ -161,66 +161,22 @@ Future openMail(String mailString) async { } } -// Map selectSizePreset(String category, Size size) { -// if (category == kBloons) { -// return _getBloonsSizePreset(size); -// } else if (category == kMaps) { -// return _getMapsSizePreset(size); -// } else { -// return _getDefaultSizePreset(size); -// } -// } - -// Map _getBloonsSizePreset(Size size) { -// if (size.width < 380) { -// return constraintsBloonSmallPreset; -// } else if (size.width < 480) { -// return constraintsBloonNormalPreset; -// } else if (size.width < 850) { -// return constraintsBloonWidePreset; -// } else { -// return constraintsBloonUWPreset; -// } -// } - -// Map _getMapsSizePreset(Size size) { -// if (size.width < 380) { -// return constraintsMapsSmallPreset; -// } else if (size.width < 480) { -// return constraintsMapsNormalPreset; -// } else if (size.width < 850) { -// return constraintsMapsWidePreset; -// } else { -// return constraintsMapsUWPreset; -// } -// } - -// Map _getDefaultSizePreset(Size size) { -// if (size.width < 380) { -// return constraintsSmallPreset; -// } else if (size.width < 480) { -// return constraintsNormalPreset; -// } else if (size.width < 850) { -// return constraintsWidePreset; -// } else { -// return constraintsUWPreset; -// } -// } - Map getPreset(Size size) { if (size.width < 310) { return presetUS; - } else if (size.width < 576) { + } else if (size.width < 360) { return presetXS; - } else if (size.width < 768) { + } else if (size.width < 415) { return presetSM; - } else if (size.width < 992) { + } else if (size.width < 450) { return presetMD; - } else if (size.width < 1200) { + } else if (size.width < 550) { return presetLG; - } else if (size.width < 2000) { + } else if (size.width < 750) { return presetXL; + } else if (size.width < 1000) { + return presetXXL; } else { - return presetUL; + return presetXXXL; } }