Skip to content

Commit

Permalink
merge dev to main
Browse files Browse the repository at this point in the history
  • Loading branch information
gennadyterekhov committed May 19, 2024
2 parents b382254 + bf8ba30 commit 8ceacfe
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 26 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Supported games:
1. Skyrim
2. Oblivion
3. Morrowind
4. The Elder Scrolls Online


[web version](https://the-elder-scrolls-alchemy.website.yandexcloud.net/#/)
Expand All @@ -19,7 +20,7 @@ Supported games:

## How to run

the most basic way to lauch the app:
the most basic way to launch the app:
`flutter run -d chrome`
this command opens chrome window with the app in debug mode

Expand All @@ -29,7 +30,6 @@ for more commands, see [flutter documentation](https://docs.flutter.dev/get-star

when building for a new release (substitute correct build number):
`flutter build apk --build-number=4 --build-name=4.0.0`


Install release app on device:
`flutter run --release`
Expand All @@ -41,10 +41,10 @@ Install release app on device:
this command runs specific integration test
`flutter drive --driver integration_test/driver.dart --target integration_test/full_test.dart --no-dds`

this command runs cpecific widget/unit test
`flutter test test/layers/data/data_source_test.dart`
this command runs specific widget/unit test
`flutter test test/layers/data/data_source_test.dart --platform chrome`

if there's an error because of dart:html, use this
this commands runs all unit tests
`flutter test --platform chrome`


Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'package:flutter/material.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/business_logic/models/effect.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/business_logic/models/ingredient.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/custom_localization.dart';

import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/effect_resource.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/ingredient_resource.dart';
import 'package:the_elder_scrolls_alchemy_client/main.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/business_logic/models/effect.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/business_logic/models/ingredient.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/presentation/widgets/components/cards/ingredient/ingredient_micro.dart';

class CommonIngredientsByColumn extends StatefulWidget {
Expand All @@ -18,27 +16,40 @@ class CommonIngredientsByColumn extends StatefulWidget {
}

class _CommonIngredientsByColumnState extends State<CommonIngredientsByColumn> {
List<Ingredient> _getIngredientsByIndex(Effect effect, int index) {
List<dynamic> _getIngredientsNamesByIndex(Effect effect, int index) {
if (index < effect.ingredientsNamesByPosition.length) {
final List names = effect.ingredientsNamesByPosition[index];

final List<Ingredient> ingredients = names
.where((ingredientName) => ingredientName != widget.ingredient.name)
.map((name) => IngredientResource(gameName: widget.gameName).getIngredientByName(name))
.toList();

return ingredients;
return effect.ingredientsNamesByPosition[index];
}

return [];
}

List<Ingredient> _getIngredientsByNames(List<String> names) {
final List<Ingredient> ingredients = names
.where((ingredientName) => ingredientName != widget.ingredient.name)
.map((name) => IngredientResource(gameName: widget.gameName).getIngredientByName(name))
.toList();

return ingredients;
}

List<Widget> _getIngredientsCardsByEffect(Effect effect, Ingredient currentIngredient) {
List<Widget> ingredients = [];
List<String> names = [];
List<dynamic> tempDynamicNames = [];

for (var i = 0; i < effect.ingredientsNamesByPosition.length; i += 1) {
ingredients.addAll(_getCards(_getIngredientsByIndex(effect, i)));
tempDynamicNames = _getIngredientsNamesByIndex(effect, i);
for (var j = 0; j < tempDynamicNames.length; j += 1) {
if (tempDynamicNames[j] is String && !names.contains(tempDynamicNames[j])) {
names.add(tempDynamicNames[j]);
}
}
}

names.sort((dynamic a, dynamic b) => a.compareTo(b));

List<Widget> ingredients = [];
ingredients.addAll(_getCards(_getIngredientsByNames(names)));

return ingredients;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/ingredient_resource.dart';
import 'package:the_elder_scrolls_alchemy_client/main.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/business_logic/models/effect.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/business_logic/models/ingredient.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/ingredient_resource.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/presentation/widgets/components/cards/ingredient/ingredient_micro.dart';

class IngredientsByEffect extends StatefulWidget {
const IngredientsByEffect({Key? key, required this.gameName, required this.effect}) : super(key: key);
final Effect effect;
final bool showLabel = false;
final String gameName;

@override
State<IngredientsByEffect> createState() => _IngredientsByEffectState();
}
Expand All @@ -24,6 +23,8 @@ class _IngredientsByEffectState extends State<IngredientsByEffect> {
final List<Ingredient> ingredients =
names.map((name) => IngredientResource(gameName: widget.gameName).getIngredientByName(name)).toList();

ingredients.sort((Ingredient a, Ingredient b) => a.name.compareTo(b.name));

return ingredients;
}
return [];
Expand Down
2 changes: 1 addition & 1 deletion lib/layers/state_management/app_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:the_elder_scrolls_alchemy_client/layers/data/resources/constant.dart';
import 'dart:html' as html;
import 'package:universal_html/html.dart' as html;

import 'package:the_elder_scrolls_alchemy_client/router.dart';

Expand Down
40 changes: 40 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
charcode:
dependency: transitive
description:
name: charcode
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
url: "https://pub.dev"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
Expand Down Expand Up @@ -105,6 +113,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.3"
csslib:
dependency: transitive
description:
name: csslib
sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -239,6 +255,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
html:
dependency: transitive
description:
name: html
sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a"
url: "https://pub.dev"
source: hosted
version: "0.15.4"
http_multi_server:
dependency: transitive
description:
Expand Down Expand Up @@ -697,6 +721,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
universal_html:
dependency: "direct main"
description:
name: universal_html
sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971"
url: "https://pub.dev"
source: hosted
version: "2.2.4"
universal_io:
dependency: transitive
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
url_launcher:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ environment:
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
universal_html: 2.2.4
flutter:
sdk: flutter

Expand Down

0 comments on commit 8ceacfe

Please sign in to comment.