Skip to content

Commit

Permalink
Merge branch 'master' into 12people_maintenance
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/theme/theme.dart
#	lib/widgets/core/charts.dart
#	lib/widgets/dashboard/widgets.dart
#	lib/widgets/nutrition/charts.dart
#	lib/widgets/workouts/charts.dart
#	pubspec.lock
#	pubspec.yaml
#	test_driver/screenshot_driver.dart
  • Loading branch information
rolandgeider committed Nov 9, 2023
2 parents 02e8831 + 09f60fe commit 7659d06
Show file tree
Hide file tree
Showing 74 changed files with 2,454 additions and 1,107 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ on:
- '**.dart'
- 'pubspec.yaml'
pull_request:
branches: [ pull_request, master ]
branches: [ master, ]
paths:
- '**.dart'
- 'pubspec.yaml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
steps:
- uses: actions/checkout@v1

- name: Install Flutter
uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: '3.7.x'
- name: Install Flutter
uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: '3.13.x'

- run: dart --version
- run: flutter --version
- run: dart --version
- run: flutter --version

- name: Install app dependencies
run: flutter pub get
- name: Install app dependencies
run: flutter pub get

- name: Test app
run: flutter test --coverage
- name: Test app
run: flutter test --coverage

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: subosito/flutter-action@v1
with:
channel: 'stable'
flutter-version: '3.7.x'
flutter-version: '3.13.x'

- name: Get dependencies
run: flutter pub get
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ Alternatively, you can use the test server (the db is reset every day):
* password: `flutteruser`
* API key: `31e2ea0322c07b9df583a9b6d1e794f7139e78d4`


### 2

Install Flutter, and all its dependencies, and create a new virtual device:
<https://flutter.dev/docs/get-started/install>.

The app currently uses flutter 3.7
The app currently uses flutter 3.13

### 3

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
}
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ SPEC CHECKSUMS:
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
rive_common: 60ae7896ab40f9513974f36f015de33f70d2c5c5
rive_common: b5b1aa30c63b8f0f00f32cddc9ea394d3d3473b5
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
Expand Down
5 changes: 2 additions & 3 deletions lib/exceptions/http_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ class WgerHttpException implements Exception {
errors = {'unknown_error': 'An unknown error occurred, no further information available'};
} else {
try {
errors = json.decode(responseBody);
errors = {'unknown_error': json.decode(responseBody)};
} catch (e) {
errors = responseBody;
errors = {'unknown_error': responseBody};
}
}
errors = errors;
}

@override
Expand Down
5 changes: 5 additions & 0 deletions lib/helpers/charts.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
double chartGetInterval(DateTime first, DateTime last, {divider = 3}) {
final dayDiff = last.difference(first);

return dayDiff.inMilliseconds == 0 ? 1000 : dayDiff.inMilliseconds.abs() / divider;
}
43 changes: 43 additions & 0 deletions lib/helpers/colors.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'dart:math';
import 'dart:ui';

const LIST_OF_COLORS8 = [
Color(0xFF2A4C7D),
Color(0xFF5B5291),
Color(0xFF8E5298),
Color(0xFFBF5092),
Color(0xFFE7537E),
Color(0xFFFF6461),
Color(0xFFFF813D),
Color(0xFFFFA600),
];

const LIST_OF_COLORS5 = [
Color(0xFF2A4C7D),
Color(0xFF825298),
Color(0xFFD45089),
Color(0xFFFF6A59),
Color(0xFFFFA600),
];

const LIST_OF_COLORS3 = [
Color(0xFF2A4C7D),
Color(0xFFD45089),
Color(0xFFFFA600),
];

Iterable<Color> generateChartColors(int nrOfItems) sync* {
final List<Color> colors;

if (nrOfItems <= 3) {
colors = LIST_OF_COLORS3;
} else if (nrOfItems <= 5) {
colors = LIST_OF_COLORS5;
} else {
colors = LIST_OF_COLORS8;
}

for (final color in colors) {
yield color;
}
}
3 changes: 2 additions & 1 deletion lib/models/body_weight/weight_entry.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions lib/models/exercises/base.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/exercises/category.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/exercises/image.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions lib/models/exercises/translation.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion lib/models/measurements/measurement_category.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/measurements/measurement_entry.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/nutrition/image.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/nutrition/ingredient.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/models/nutrition/ingredient_weight_unit.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion lib/models/nutrition/log.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions lib/models/nutrition/nutritional_plan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,30 @@ class NutritionalPlan {
return out;
}

NutritionalValues get nutritionalValuesToday {
final now = DateTime.now();
final today = DateTime(now.year, now.month, now.day);

return logEntriesValues.containsKey(today) ? logEntriesValues[today]! : NutritionalValues();
}

NutritionalValues get nutritionalValues7DayAvg {
final currentDate = DateTime.now();
final sevenDaysAgo = currentDate.subtract(Duration(days: 7));

final entries = logs.where((obj) {
DateTime objDate = obj.datetime;
return objDate.isAfter(sevenDaysAgo) && objDate.isBefore(currentDate);
}).toList();

var out = NutritionalValues();
entries.forEach((log) {
out = out + log.nutritionalValues;
});

return out;
}

/// Calculates the percentage each macro nutrient adds to the total energy
BaseNutritionalValues energyPercentage(NutritionalValues values) {
return BaseNutritionalValues(
Expand Down
3 changes: 2 additions & 1 deletion lib/models/nutrition/nutritional_plan.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/nutrition/weight_unit.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/models/user/profile.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/models/workouts/repetition_unit.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7659d06

Please sign in to comment.