Skip to content

Commit

Permalink
[Presentation] Set a max size for the artifacts / weapons / materials
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jul 18, 2021
1 parent 3dc7e56 commit e91746d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lib/presentation/artifact/artifact_page.dart
Expand Up @@ -50,6 +50,8 @@ class _PortraitLayout extends StatelessWidget {
color: rarityColor,
fullImage: state.image,
charDescriptionHeight: 120,
widthOnPortrait: 240,
heightOnPortrait: 240,
appBar: const DetailAppBar(),
isAnSmallImage: true,
generalCard: DetailGeneralCard(
Expand Down
3 changes: 3 additions & 0 deletions lib/presentation/material/widgets/material_detail_top.dart
Expand Up @@ -26,9 +26,12 @@ class MaterialDetailTop extends StatelessWidget {

@override
Widget build(BuildContext context) {
final isPortrait = MediaQuery.of(context).orientation == Orientation.portrait;
return DetailTopLayout(
fullImage: image,
charDescriptionHeight: 160,
heightOnPortrait: isPortrait ? 250 : null,
widthOnPortrait: isPortrait ? 250 : null,
isAnSmallImage: MediaQuery.of(context).orientation == Orientation.portrait,
heightOnLandscape: MediaQuery.of(context).size.height * 0.7,
decoration: BoxDecoration(gradient: rarity.getRarityGradient()),
Expand Down
35 changes: 23 additions & 12 deletions lib/presentation/shared/details/detail_top_layout.dart
Expand Up @@ -11,14 +11,18 @@ double? _getWidthToUse(
}) {
final mediaQuery = MediaQuery.of(context);
final isPortrait = mediaQuery.orientation == Orientation.portrait;
final size = getDeviceType(mediaQuery.size);
// final size = getDeviceType(mediaQuery.size);
if (isPortrait) {
final value = widthOnPortrait ?? _imageWidthOnPortrait;
return size == DeviceScreenType.mobile
? !isAnSmallImage
? value
: (value / 2)
: value;
// final newValue = size == DeviceScreenType.mobile
// ? !isAnSmallImage
// ? value
// : (value / 2)
// : value;
// if (isAnSmallImage && newValue > 250) {
// return 250;
// }
return value;
}

final value = widthOnLandscape ?? _imageWidthOnPortrait;
Expand All @@ -33,15 +37,20 @@ double? _getHeightToUse(
}) {
final mediaQuery = MediaQuery.of(context);
final isPortrait = mediaQuery.orientation == Orientation.portrait;
final size = getDeviceType(mediaQuery.size);
// final size = getDeviceType(mediaQuery.size);
final imgHeight = mediaQuery.size.height;
if (isPortrait) {
final value = heightOnPortrait ?? imgHeight;
return size == DeviceScreenType.mobile
? !isAnSmallImage
? value
: (value / 2)
: value;
// final newValue = size == DeviceScreenType.mobile
// ? !isAnSmallImage
// ? value
// : (value / 2)
// : value;

// if (isAnSmallImage && newValue > 250) {
// return 250;
// }
return value;
}

final value = heightOnLandscape ?? imgHeight;
Expand Down Expand Up @@ -110,6 +119,8 @@ class DetailTopLayout extends StatelessWidget {
widthOnLandscape: widthOnLandscape,
heightOnLandscape: heightOnLandscape,
isAnSmallImage: isAnSmallImage,
heightOnPortrait: heightOnPortrait,
widthOnPortrait: widthOnPortrait,
),
Align(
alignment: imgAlignment,
Expand Down
3 changes: 3 additions & 0 deletions lib/presentation/weapon/widgets/weapon_detail_top.dart
Expand Up @@ -44,6 +44,9 @@ class WeaponDetailTop extends StatelessWidget {
heightOnLandscape: mediaQuery.size.height * 0.8,
showShadowImage: isPortrait,
charDescriptionHeight: 200,
widthOnPortrait: isPortrait ? 250 : null,
heightOnPortrait: isPortrait ? 350 : null,
isAnSmallImage: isPortrait,
generalCard: WeaponDetailGeneralCard(
type: type,
atk: atk,
Expand Down

0 comments on commit e91746d

Please sign in to comment.