Skip to content

Commit

Permalink
[Presentation] Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfteam committed Jan 28, 2024
1 parent e2b0a1c commit 396836f
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/presentation/artifact/artifact_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ArtifactPage extends StatelessWidget {
create: (context) => Injection.artifactBloc..add(ArtifactEvent.loadFromKey(key: itemKey)),
child: BlocBuilder<ArtifactBloc, ArtifactState>(
builder: (context, state) => state.map(
loading: (_) => const Loading.column(),
loading: (_) => const Loading.scaffold(),
loaded: (state) {
final color = state.maxRarity.getRarityColors().first;

Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/character/character_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CharacterPage extends StatelessWidget {
create: (context) => Injection.characterBloc..add(CharacterEvent.loadFromKey(key: itemKey)),
child: BlocBuilder<CharacterBloc, CharacterState>(
builder: (context, state) => state.map(
loading: (_) => const Loading.column(),
loading: (_) => const Loading.scaffold(),
loaded: (state) {
final Color color = state.elementType.getElementColorFromContext(context);

Expand Down
2 changes: 1 addition & 1 deletion lib/presentation/material/material_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MaterialPage extends StatelessWidget {
create: (context) => Injection.materialBloc..add(bloc.MaterialEvent.loadFromKey(key: itemKey)),
child: BlocBuilder<bloc.MaterialBloc, bloc.MaterialState>(
builder: (context, state) => state.map(
loading: (_) => const Loading.column(),
loading: (_) => const Loading.scaffold(),
loaded: (state) {
final color = state.rarity.getRarityColors().first;
final main = _Main(
Expand Down
16 changes: 0 additions & 16 deletions lib/presentation/shared/details/constants.dart

This file was deleted.

17 changes: 15 additions & 2 deletions lib/presentation/shared/details/detail_main_content.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:shiori/presentation/shared/details/constants.dart';
import 'package:transparent_image/transparent_image.dart';

class DetailMainContent extends StatelessWidget {
Expand Down Expand Up @@ -36,8 +35,9 @@ class DetailMainContent extends StatelessWidget {
? Alignment.centerLeft
: Alignment.bottomLeft
: Alignment.center;
final double? height = isPortrait ? _getHeight(context, isAnSmallImage) : null;
return Container(
height: isPortrait ? getTopHeightForPortrait(context, isAnSmallImage) : null,
height: height,
color: color,
decoration: decoration,
child: Stack(
Expand Down Expand Up @@ -73,6 +73,16 @@ class DetailMainContent extends StatelessWidget {
),
);
}

double _getHeight(BuildContext context, bool isAnSmallImage) {
final factor = isAnSmallImage ? 0.5 : 0.7;
final value = MediaQuery.of(context).size.height * factor;
//The max char height
if (value > 700) {
return 700;
}
return value;
}
}

class ShadowImage extends StatelessWidget {
Expand Down Expand Up @@ -129,6 +139,9 @@ class _Image extends StatelessWidget {
fit: BoxFit.contain,
filterQuality: FilterQuality.high,
image: FileImage(File(secondFullImage ?? fullImage)),
placeholderFit: BoxFit.contain,
fadeInDuration: const Duration(milliseconds: 300),
fadeOutDuration: const Duration(milliseconds: 100),
);
}
}
5 changes: 3 additions & 2 deletions lib/presentation/shared/weapons_button_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class WeaponsButtonBar extends StatelessWidget {
Widget build(BuildContext context) {
final s = S.of(context);
final theme = Theme.of(context);
final double size = iconSize * 1.3;
return Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
alignment: WrapAlignment.spaceEvenly,
Expand All @@ -33,8 +34,8 @@ class WeaponsButtonBar extends StatelessWidget {
opacity: !isSelected ? 1 : 0.2,
child: Image.asset(
e.getWeaponNormalSkillAssetPath(),
width: iconSize * 1.3,
height: iconSize * 1.3,
width: size,
height: size,
color: theme.brightness == Brightness.dark ? Colors.white : Colors.black.withOpacity(0.5),
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/presentation/weapon/weapon_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class WeaponPage extends StatelessWidget {
create: (context) => Injection.weaponBloc..add(WeaponEvent.loadFromKey(key: itemKey)),
child: BlocBuilder<WeaponBloc, WeaponState>(
builder: (context, state) => state.map(
loading: (_) => const Loading.column(),
loading: (_) => const Loading.scaffold(),
loaded: (state) {
final Color color = state.rarity.getRarityColors().first;
final main = _Main(
Expand Down Expand Up @@ -98,7 +98,7 @@ class WeaponPage extends StatelessWidget {
color: color,
refinements: state.refinements,
),
if (state.stats.isNotEmpty)
if (state.stats.isNotEmpty && !isPortrait)
StatsTable(
color: color,
stats: state.stats.map((e) => StatItem.weapon(e, state.secondaryStat, s)).toList(),
Expand Down
12 changes: 6 additions & 6 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ packages:
dependency: "direct main"
description:
name: fl_chart
sha256: fe6fec7d85975a99c73b9515a69a6e291364accfa0e4a5b3ce6de814d74b9a1c
sha256: b5e2b0f13d93f8c532b5a2786bfb44580de1f50b927bf95813fa1af617e9caf8
url: "https://pub.dev"
source: hosted
version: "0.66.0"
version: "0.66.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -447,10 +447,10 @@ packages:
dependency: "direct main"
description:
name: flutter_local_notifications
sha256: "66cc2fe16bf4bca71d795939763ad3f1830ad85772dc3b1561613c501859826d"
sha256: c18f1de98fe0bb9dd5ba91e1330d4febc8b6a7de6aae3ffe475ef423723e72f3
url: "https://pub.dev"
source: hosted
version: "16.3.1+1"
version: "16.3.2"
flutter_local_notifications_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -1373,10 +1373,10 @@ packages:
dependency: "direct main"
description:
name: url_launcher
sha256: d25bb0ca00432a5e1ee40e69c36c85863addf7cc45e433769d61bed3fe81fd96
sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c
url: "https://pub.dev"
source: hosted
version: "6.2.3"
version: "6.2.4"
url_launcher_android:
dependency: transitive
description:
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.8.0+158
version: 1.8.0+160

environment:
sdk: '>=3.1.4 <4.0.0'
Expand All @@ -27,13 +27,13 @@ dependencies:
envied: ^0.5.3
file_picker: ^6.1.1
fk_user_agent: ^2.1.0
fl_chart: ^0.66.0
fl_chart: ^0.66.1
flutter:
sdk: flutter
flutter_bloc: ^7.3.1
flutter_colorpicker: ^1.0.3
flutter_inappwebview: ^6.0.0
flutter_local_notifications: ^16.3.1+1
flutter_local_notifications: ^16.3.2
flutter_localizations:
sdk: flutter
flutter_markdown: ^0.6.18+3
Expand Down Expand Up @@ -69,7 +69,7 @@ dependencies:
store_checker: ^1.4.0
synchronized: ^3.1.0+1
transparent_image: ^2.0.1
url_launcher: ^6.2.3
url_launcher: ^6.2.4
version: ^3.0.0
version_tracker: ^2.3.0
wakelock_plus: ^1.1.4
Expand Down

0 comments on commit 396836f

Please sign in to comment.