diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 681dcad5c..5329f1abb 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -78,7 +78,7 @@ jobs: WGER_API_KEY: ${{ secrets.WGER_API_KEY }} - name: Upload build to Play Store - uses: maierj/fastlane-action@v2.1.0 + uses: maierj/fastlane-action@v2.2.1 with: lane: production diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8c30c335..d7c3a75af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,11 @@ name: Continous Integration on: push: - branches: [ master ] paths: - '**.dart' - 'pubspec.yaml' pull_request: - branches: [ master ] + branches: [ pull_request, master ] paths: - '**.dart' - 'pubspec.yaml' diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 4cba8fe11..6857e6d52 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -20,7 +20,7 @@ jobs: uses: subosito/flutter-action@v1 with: channel: 'stable' - flutter-version: '3.0.x' + flutter-version: '3.3.x' - name: Get dependencies run: flutter pub get diff --git a/.gitignore b/.gitignore index 08fb37091..d3e994df7 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. -#.vscode/ +.vscode/ # Flutter/Dart/Pub related **/doc/api/ @@ -31,6 +31,7 @@ .pub/ /build/ + # Web related lib/generated_plugin_registrant.dart @@ -47,3 +48,8 @@ app.*.map.json /fastlane/metadata/envfiles/wger.properties /fastlane/metadata/envfiles/keys.jks /fastlane/metadata/envfiles/key.properties + + +# Others +/vendor/bundle/ruby/ +/coverage/ diff --git a/.vscode/settings.json b/.vscode/settings.json index 074f5899e..a6032c702 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "dart.lineLength": 100 + "dart.lineLength": 100, + "diffEditor.ignoreTrimWhitespace": true, } \ No newline at end of file diff --git a/AUTHORS.md b/AUTHORS.md index ea77dc6e3..577861e81 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -13,6 +13,10 @@ - Marko Milosevic - - Karthik Reddy (Axel) - - Ogundoyin Toluwani - +- Nenza Nurfirmansyah - +- Florian Schmitz - +- Aman Negi - +- Sandi Milohanic - ## Translators @@ -51,3 +55,11 @@ - Japanese - Kosei TANAKA (97) + +- Bahasa Indonesia + + - Nenza Nurfirmansyah (73) + +- Croatian + + - Sandi Milohaic diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..2ccf2ecb1 --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gem "fastlane" +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..2125a0f6b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,221 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.5) + rexml + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + artifactory (3.0.15) + atomos (0.1.3) + aws-eventstream (1.2.0) + aws-partitions (1.644.0) + aws-sdk-core (3.159.0) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.525.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.58.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.114.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sigv4 (1.5.2) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.6.4) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.8.1) + emoji_regex (3.2.3) + excon (0.93.0) + faraday (1.10.2) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.2.6) + fastlane (2.210.1) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (~> 2.0.0) + naturally (~> 2.2) + optparse (~> 0.1.1) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + fastlane-plugin-versioning (0.5.1) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.29.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-core (0.9.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-iamcredentials_v1 (0.15.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-playcustomapp_v1 (0.11.0) + google-apis-core (>= 0.9.0, < 2.a) + google-apis-storage_v1 (0.19.0) + google-apis-core (>= 0.9.0, < 2.a) + google-cloud-core (1.6.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.3.0) + google-cloud-storage (1.43.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.19.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.2.0) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.6.1) + json (2.6.2) + jwt (2.5.0) + memoist (0.16.2) + mini_magick (4.11.0) + mini_mime (1.1.2) + multi_json (1.15.0) + multipart-post (2.0.0) + nanaimo (0.3.0) + naturally (2.2.1) + optparse (0.1.1) + os (1.1.4) + plist (3.6.0) + public_suffix (5.0.0) + rake (13.0.6) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.5) + rouge (2.0.7) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.3) + signet (0.17.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.8) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.1) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (1.8.0) + webrick (1.7.0) + word_wrap (1.0.0) + xcodeproj (1.22.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-21 + x86_64-linux + +DEPENDENCIES + fastlane + fastlane-plugin-versioning + +BUNDLED WITH + 2.2.32 diff --git a/android/app/build.gradle b/android/app/build.gradle index 547dcded8..7d5394c87 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -51,11 +51,11 @@ if (localMapsPropertiesFile.exists()) { def wgerApiKey = wgerProperties.getProperty('WGER_API_KEY') if(wgerApiKey == null){ wgerApiKey = "" - project.logger.error('Wger Api Key not configured. Set it in `app/wger.properties` or in the environment variable `WGER_API_KEY`') + project.logger.error('Wger Api Key not configured. Set it in `/fastlane/metadata/android/envfiles/wger.properties` or in the environment variable `WGER_API_KEY`') } android { - compileSdkVersion 31 + compileSdkVersion 32 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -69,7 +69,7 @@ android { // Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "de.wger.flutter" minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 32 versionCode flutterVersionCode.toInteger() versionName flutterVersionName manifestPlaceholders += [WGER_API_KEY: wgerApiKey] diff --git a/android/fastlane/envfiles/wger.properties b/android/fastlane/envfiles/wger.properties deleted file mode 100644 index c367445e3..000000000 --- a/android/fastlane/envfiles/wger.properties +++ /dev/null @@ -1,3 +0,0 @@ -```properties -WGER_API_KEY=77a270641bb5654c517e91f277bf06623c141318 -``` \ No newline at end of file diff --git a/assets/images/muscles/front.svg b/assets/images/muscles/front.svg index 5024d2825..a14eb9687 100644 --- a/assets/images/muscles/front.svg +++ b/assets/images/muscles/front.svg @@ -1,99 +1 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/fastlane/metadata/android/README.md b/fastlane/metadata/android/README.md index 4b4362657..4e894f9d0 100644 --- a/fastlane/metadata/android/README.md +++ b/fastlane/metadata/android/README.md @@ -10,8 +10,9 @@ If we use a new version, update the version used by ## 2. Dry-run release before uploading -* Increase build nr in pubspec.yaml +* Increase build nr in pubspec.yaml (revert after the dry-run was successful) * `flutter build appbundle --release` +* `bundle install` * `bundle exec fastlane android test_configuration` (needs the different keys available) It might be necessary to repeat these steps if upload_to_play_store returns any errors diff --git a/fastlane/metadata/android/ca/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/ca/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..a5499a347 Binary files /dev/null and b/fastlane/metadata/android/ca/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/ca/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/ca/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..13492691d Binary files /dev/null and b/fastlane/metadata/android/ca/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/ca/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/ca/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..aae07e9a0 Binary files /dev/null and b/fastlane/metadata/android/ca/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/de-DE/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/de-DE/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..5228d44c7 Binary files /dev/null and b/fastlane/metadata/android/de-DE/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/de-DE/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/de-DE/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..891275f55 Binary files /dev/null and b/fastlane/metadata/android/de-DE/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/de-DE/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/de-DE/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..6f840f7e4 Binary files /dev/null and b/fastlane/metadata/android/de-DE/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/03 - gym mode.png index 6d5e26dc7..36ec11c49 100644 Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/03 - gym mode.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/04 - nutritional plan.png index adbb9f6b6..d789fdae1 100644 Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/04 - nutritional plan.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/05 - weight.png index d60c5c8d8..8e416462a 100644 Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/05 - weight.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/es-ES/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/es-ES/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..86fff6225 Binary files /dev/null and b/fastlane/metadata/android/es-ES/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/es-ES/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/es-ES/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..74f6f2f59 Binary files /dev/null and b/fastlane/metadata/android/es-ES/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/es-ES/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/es-ES/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..5e643abe2 Binary files /dev/null and b/fastlane/metadata/android/es-ES/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/fr-FR/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..132dfc13b Binary files /dev/null and b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/fr-FR/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..448273eae Binary files /dev/null and b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/fr-FR/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..733e29451 Binary files /dev/null and b/fastlane/metadata/android/fr-FR/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/hi-IN/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/hi-IN/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..ee9bdbffb Binary files /dev/null and b/fastlane/metadata/android/hi-IN/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/hi-IN/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/hi-IN/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..82f915b2c Binary files /dev/null and b/fastlane/metadata/android/hi-IN/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/hi-IN/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/hi-IN/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..88dbab717 Binary files /dev/null and b/fastlane/metadata/android/hi-IN/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/hr/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/hr/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..a94a06354 Binary files /dev/null and b/fastlane/metadata/android/hr/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/hr/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/hr/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..950ded97e Binary files /dev/null and b/fastlane/metadata/android/hr/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/hr/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/hr/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..355bc81f9 Binary files /dev/null and b/fastlane/metadata/android/hr/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/it-IT/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/it-IT/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..9279928d5 Binary files /dev/null and b/fastlane/metadata/android/it-IT/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/it-IT/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/it-IT/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..3e96d569f Binary files /dev/null and b/fastlane/metadata/android/it-IT/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/it-IT/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/it-IT/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..1bf193f58 Binary files /dev/null and b/fastlane/metadata/android/it-IT/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/nb-NO/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/nb-NO/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..36ec11c49 Binary files /dev/null and b/fastlane/metadata/android/nb-NO/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/nb-NO/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/nb-NO/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..4c93fcf18 Binary files /dev/null and b/fastlane/metadata/android/nb-NO/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/nb-NO/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/nb-NO/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..552579db3 Binary files /dev/null and b/fastlane/metadata/android/nb-NO/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/pl/full_description.txt b/fastlane/metadata/android/pl-PL/full_description.txt similarity index 100% rename from fastlane/metadata/android/pl/full_description.txt rename to fastlane/metadata/android/pl-PL/full_description.txt diff --git a/fastlane/metadata/android/pl-PL/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/pl-PL/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..1d2c51e9f Binary files /dev/null and b/fastlane/metadata/android/pl-PL/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/pl-PL/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/pl-PL/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..4cbe600a3 Binary files /dev/null and b/fastlane/metadata/android/pl-PL/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/pl-PL/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/pl-PL/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..4068856b2 Binary files /dev/null and b/fastlane/metadata/android/pl-PL/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/pl/short_description.txt b/fastlane/metadata/android/pl-PL/short_description.txt similarity index 100% rename from fastlane/metadata/android/pl/short_description.txt rename to fastlane/metadata/android/pl-PL/short_description.txt diff --git a/fastlane/metadata/android/pl-PL/title.txt b/fastlane/metadata/android/pl-PL/title.txt new file mode 100644 index 000000000..d35e40870 --- /dev/null +++ b/fastlane/metadata/android/pl-PL/title.txt @@ -0,0 +1 @@ +wger Workout Manager diff --git a/fastlane/metadata/android/pt/full_description.txt b/fastlane/metadata/android/pt-BR/full_description.txt similarity index 100% rename from fastlane/metadata/android/pt/full_description.txt rename to fastlane/metadata/android/pt-BR/full_description.txt diff --git a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..d65d2acfc Binary files /dev/null and b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..48ba1fb1c Binary files /dev/null and b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..3f0dba602 Binary files /dev/null and b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/pt/short_description.txt b/fastlane/metadata/android/pt-BR/short_description.txt similarity index 100% rename from fastlane/metadata/android/pt/short_description.txt rename to fastlane/metadata/android/pt-BR/short_description.txt diff --git a/fastlane/metadata/android/pt-BR/title.txt b/fastlane/metadata/android/pt-BR/title.txt new file mode 100644 index 000000000..ea0df9560 --- /dev/null +++ b/fastlane/metadata/android/pt-BR/title.txt @@ -0,0 +1 @@ +wger Workout Manager \ No newline at end of file diff --git a/fastlane/metadata/android/ru-RU/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/ru-RU/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..4d67a221e Binary files /dev/null and b/fastlane/metadata/android/ru-RU/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/ru-RU/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/ru-RU/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..bf8e14b21 Binary files /dev/null and b/fastlane/metadata/android/ru-RU/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/ru-RU/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/ru-RU/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..085ed780b Binary files /dev/null and b/fastlane/metadata/android/ru-RU/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/tr-TR/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/tr-TR/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..c5a5c9dcd Binary files /dev/null and b/fastlane/metadata/android/tr-TR/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/tr-TR/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/tr-TR/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..3f38e08af Binary files /dev/null and b/fastlane/metadata/android/tr-TR/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/tr-TR/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/tr-TR/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..134189124 Binary files /dev/null and b/fastlane/metadata/android/tr-TR/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/uk/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/uk/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..c10ff6c7b Binary files /dev/null and b/fastlane/metadata/android/uk/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/uk/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/uk/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..0f3800807 Binary files /dev/null and b/fastlane/metadata/android/uk/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/uk/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/uk/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..e5c14e5ff Binary files /dev/null and b/fastlane/metadata/android/uk/images/phoneScreenshots/05 - weight.png differ diff --git a/fastlane/metadata/android/zh-CN/images/phoneScreenshots/03 - gym mode.png b/fastlane/metadata/android/zh-CN/images/phoneScreenshots/03 - gym mode.png new file mode 100644 index 000000000..6be138230 Binary files /dev/null and b/fastlane/metadata/android/zh-CN/images/phoneScreenshots/03 - gym mode.png differ diff --git a/fastlane/metadata/android/zh-CN/images/phoneScreenshots/04 - nutritional plan.png b/fastlane/metadata/android/zh-CN/images/phoneScreenshots/04 - nutritional plan.png new file mode 100644 index 000000000..34f8a419b Binary files /dev/null and b/fastlane/metadata/android/zh-CN/images/phoneScreenshots/04 - nutritional plan.png differ diff --git a/fastlane/metadata/android/zh-CN/images/phoneScreenshots/05 - weight.png b/fastlane/metadata/android/zh-CN/images/phoneScreenshots/05 - weight.png new file mode 100644 index 000000000..614cf50f7 Binary files /dev/null and b/fastlane/metadata/android/zh-CN/images/phoneScreenshots/05 - weight.png differ diff --git a/integration_test/README.md b/integration_test/README.md new file mode 100644 index 000000000..98bf8828b --- /dev/null +++ b/integration_test/README.md @@ -0,0 +1,10 @@ +Start emulator and run + +`flutter drive --driver=test_driver/screenshot_driver.dart --target=integration_test/app_test.dart` + +This will generate some screenshots and save them to the Play Store metadata folder + + +See +* +* diff --git a/integration_test/app_test.dart b/integration_test/app_test.dart new file mode 100644 index 000000000..5b7ecc964 --- /dev/null +++ b/integration_test/app_test.dart @@ -0,0 +1,67 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; + +import 'gym_mode.dart'; +import 'nutritional_plan.dart'; +import 'weight.dart'; + +Future takeScreenshot(tester, binding, String language, String name) async { + if (Platform.isAndroid) { + await binding.convertFlutterSurfaceToImage(); + await tester.pumpAndSettle(); + } + await binding + .takeScreenshot('fastlane/metadata/android/$language/images/phoneScreenshots/$name.png'); +} + +// Available languages in weblate for the android metadata +const languages = [ + 'ca', + 'de-DE', + 'en-US', + 'es-ES', + 'fr-FR', + 'hi-IN', + 'hr', + 'it-IT', + 'pt-BR', + 'nb-NO', + 'pl-PL', + 'ru-RU', + 'tr-TR', + 'uk', + 'zh-CN' +]; + +void main() { + final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + group('Generate screenshots', () { + for (final language in languages) { + final languageCode = language.split('-')[0]; + + testWidgets('gym mode screen - $language', (WidgetTester tester) async { + await tester.pumpWidget(createGymModeScreen(locale: languageCode)); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + await takeScreenshot(tester, binding, language, '03 - gym mode'); + }); + + testWidgets('nutritional plan detail - $language', (WidgetTester tester) async { + await tester.pumpWidget(createNutritionalPlanScreen(locale: languageCode)); + await tester.tap(find.byType(TextButton)); + await tester.pumpAndSettle(); + await takeScreenshot(tester, binding, language, '04 - nutritional plan'); + }); + + testWidgets('body weight screen - $language', (WidgetTester tester) async { + await tester.pumpWidget(createWeightScreen(locale: languageCode)); + await tester.pumpAndSettle(); + await takeScreenshot(tester, binding, language, '05 - weight'); + }); + } + }); +} diff --git a/integration_test/gym_mode.dart b/integration_test/gym_mode.dart new file mode 100644 index 000000000..192deb951 --- /dev/null +++ b/integration_test/gym_mode.dart @@ -0,0 +1,246 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/models/exercises/exercise.dart'; +import 'package:wger/models/workouts/day.dart'; +import 'package:wger/models/workouts/set.dart'; +import 'package:wger/models/workouts/setting.dart'; +import 'package:wger/models/workouts/workout_plan.dart'; +import 'package:wger/providers/exercises.dart'; +import 'package:wger/providers/workout_plans.dart'; +import 'package:wger/screens/gym_mode.dart'; +import 'package:wger/screens/workout_plan_screen.dart'; +import 'package:wger/theme/theme.dart'; + +import '../test/other/base_provider_test.mocks.dart'; +import '../test/utils.dart'; +import '../test/workout/gym_mode_screen_test.mocks.dart'; +import '../test_data/exercises.dart'; +import '../test_data/workouts.dart'; + +Widget createGymModeScreen({locale = 'en'}) { + final key = GlobalKey(); + final client = MockClient(); + final bases = getTestExerciseBases(); + + final squats = bases[0]; + final squatsEn = Exercise( + id: 1, + uuid: 'uuid', + creationDate: DateTime(2021, 1, 15), + name: 'Squats', + description: 'add clever text', + baseId: tBase1.id, + language: tLanguage1, + ); + squats.exercises = [squatsEn]; + + final benchPress = bases[1]; + final benchPressEn = Exercise( + id: 1, + uuid: 'uuid', + creationDate: DateTime(2021, 1, 15), + name: 'Bench press', + description: 'add clever text', + baseId: tBase1.id, + language: tLanguage1, + ); + benchPress.exercises = [benchPressEn]; + + final deadLift = bases[2]; + final deadLiftEn = Exercise( + id: 1, + uuid: 'uuid', + creationDate: DateTime(2021, 1, 15), + name: 'Dead Lift', + description: 'add clever text', + baseId: tBase1.id, + language: tLanguage1, + ); + deadLift.exercises = [deadLiftEn]; + + final crunches = bases[3]; + final crunchesEn = Exercise( + id: 1, + uuid: 'uuid', + creationDate: DateTime(2021, 1, 15), + name: 'Crunches', + description: 'add clever text', + baseId: tBase1.id, + language: tLanguage1, + ); + crunches.exercises = [crunchesEn]; + + final mockExerciseProvider = MockExercisesProvider(); + when(mockExerciseProvider.findExerciseBaseById(1)).thenReturn(squats); + when(mockExerciseProvider.findExerciseBaseById(2)).thenReturn(benchPress); + when(mockExerciseProvider.findExerciseBaseById(3)).thenReturn(crunches); + + final setting1 = Setting( + setId: 1, + order: 1, + exerciseBaseId: 1, + repetitionUnitId: 1, + reps: 5, + weightUnitId: 1, + comment: 'ddd', + rir: '2', + ); + setting1.repetitionUnit = repetitionUnit1; + setting1.weightUnit = weightUnit1; + setting1.exerciseBase = squats; + setting1.weight = 100; + + final setting2 = Setting( + setId: 1, + order: 1, + exerciseBaseId: 2, + repetitionUnitId: 1, + reps: 6, + weightUnitId: 1, + comment: 'ddd', + rir: '1.5', + ); + setting2.repetitionUnit = repetitionUnit1; + setting2.weightUnit = weightUnit1; + setting2.exerciseBase = benchPress; + setting2.weight = 80; + + final setting2b = Setting( + setId: 1, + order: 1, + exerciseBaseId: 2, + repetitionUnitId: 1, + reps: 8, + weightUnitId: 1, + comment: 'ddd', + rir: '2', + ); + setting2b.repetitionUnit = repetitionUnit1; + setting2b.weightUnit = weightUnit1; + setting2b.exerciseBase = benchPress; + setting2b.weight = 60; + + final setting3 = Setting( + setId: 1, + order: 1, + exerciseBaseId: 2, + repetitionUnitId: 1, + reps: 20, + weightUnitId: 1, + comment: '', + rir: null, + ); + setting3.repetitionUnit = repetitionUnit1; + setting3.weightUnit = weightUnit1; + setting3.exerciseBase = crunches; + + final setting4 = Setting( + setId: 1, + order: 1, + exerciseBaseId: 2, + repetitionUnitId: 1, + reps: 8, + weightUnitId: 1, + comment: '', + rir: null, + ); + setting4.repetitionUnit = repetitionUnit1; + setting4.weightUnit = weightUnit1; + setting4.exerciseBase = deadLift; + setting4.weight = 120; + + final set1 = Set.withData( + id: 1, + day: 1, + sets: 3, + order: 1, + ); + set1.addExerciseBase(squats); + set1.settings.add(setting1); + set1.settings.add(setting1); + set1.settings.add(setting1); + set1.settings.add(setting1); + + final set2 = Set.withData( + id: 2, + day: 1, + sets: 3, + order: 1, + ); + set2.addExerciseBase(benchPress); + set2.settings.add(setting2); + set2.settings.add(setting2); + set2.settings.add(setting2b); + set2.settings.add(setting2b); + + final set3 = Set.withData( + id: 3, + day: 1, + sets: 3, + order: 1, + ); + set3.addExerciseBase(crunches); + set3.settings.add(setting3); + + final set4 = Set.withData( + id: 4, + day: 1, + sets: 3, + order: 1, + ); + set4.addExerciseBase(deadLift); + set4.settings.add(setting4); + set4.settings.add(setting4); + set4.settings.add(setting4); + set4.settings.add(setting4); + + final day1 = Day() + ..id = 1 + ..workoutId = 1 + ..description = 'test day 1' + ..daysOfWeek = [1, 2]; + day1.sets.add(set1); + day1.sets.add(set2); + day1.sets.add(set4); + day1.sets.add(set3); + + final workout = WorkoutPlan( + id: 1, + creationDate: DateTime(2021, 01, 01), + name: 'test workout 1', + days: [day1], + ); + + return ChangeNotifierProvider( + create: (context) => WorkoutPlansProvider( + testAuthProvider, + mockExerciseProvider, + [workout], + client, + ), + child: ChangeNotifierProvider( + create: (context) => mockExerciseProvider, + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + navigatorKey: key, + theme: wgerTheme, + home: TextButton( + onPressed: () => key.currentState!.push( + MaterialPageRoute( + settings: RouteSettings(arguments: workout.days.first), + builder: (_) => GymModeScreen(), + ), + ), + child: const SizedBox(), + ), + routes: { + WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(), + }, + ), + ), + ); +} diff --git a/integration_test/nutritional_plan.dart b/integration_test/nutritional_plan.dart new file mode 100644 index 000000000..bfb79e5f1 --- /dev/null +++ b/integration_test/nutritional_plan.dart @@ -0,0 +1,122 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/models/nutrition/ingredient.dart'; +import 'package:wger/models/nutrition/log.dart'; +import 'package:wger/models/nutrition/meal.dart'; +import 'package:wger/models/nutrition/meal_item.dart'; +import 'package:wger/models/nutrition/nutritional_plan.dart'; +import 'package:wger/providers/body_weight.dart'; +import 'package:wger/providers/nutrition.dart'; +import 'package:wger/screens/nutritional_plan_screen.dart'; +import 'package:wger/theme/theme.dart'; + +import '../test/other/base_provider_test.mocks.dart'; +import '../test/utils.dart'; + +Widget createNutritionalPlanScreen({locale = 'en'}) { + final key = GlobalKey(); + final client = MockClient(); + + final muesli = Ingredient( + id: 1, + code: '123456787', + name: 'Müsli', + creationDate: DateTime(2021, 5, 1), + energy: 500, + carbohydrates: 10, + carbohydratesSugar: 2, + protein: 5, + fat: 20, + fatSaturated: 7, + fibres: 12, + sodium: 0.5, + ); + final milk = Ingredient( + id: 1, + code: '123456787', + name: 'Milk', + creationDate: DateTime(2021, 5, 1), + energy: 500, + carbohydrates: 10, + carbohydratesSugar: 2, + protein: 5, + fat: 20, + fatSaturated: 7, + fibres: 12, + sodium: 0.5, + ); + final apple = Ingredient( + id: 1, + code: '123456787', + name: 'Apple', + creationDate: DateTime(2021, 5, 1), + energy: 500, + carbohydrates: 10, + carbohydratesSugar: 2, + protein: 5, + fat: 20, + fatSaturated: 7, + fibres: 12, + sodium: 0.5, + ); + + final mealItem1 = MealItem(ingredientId: 1, amount: 100, ingredient: muesli); + final mealItem2 = MealItem(ingredientId: 2, amount: 75, ingredient: milk); + final mealItem3 = MealItem(ingredientId: 3, amount: 100, ingredient: apple); + + final meal1 = Meal( + id: 1, + plan: 1, + time: const TimeOfDay(hour: 8, minute: 30), + name: 'Breakfast', + mealItems: [mealItem1, mealItem2], + ); + + final meal2 = Meal( + id: 2, + plan: 1, + time: const TimeOfDay(hour: 11, minute: 0), + name: 'Snack 1', + mealItems: [mealItem3], + ); + + final NutritionalPlan plan = NutritionalPlan( + id: 1, + description: 'Mini diet', + creationDate: DateTime(2021, 5, 23), + meals: [meal1, meal2], + ); + + // Add logs + plan.logs.add(Log.fromMealItem(mealItem1, 1, 1, DateTime(2021, 6, 1))); + plan.logs.add(Log.fromMealItem(mealItem2, 1, 1, DateTime(2021, 6, 1))); + plan.logs.add(Log.fromMealItem(mealItem3, 1, 1, DateTime(2021, 6, 10))); + + return MultiProvider( + providers: [ + ChangeNotifierProvider( + create: (context) => NutritionPlansProvider(testAuthProvider, [], client), + ), + ChangeNotifierProvider( + create: (context) => BodyWeightProvider(testAuthProvider, [], client), + ), + ], + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: wgerTheme, + navigatorKey: key, + home: TextButton( + onPressed: () => key.currentState!.push( + MaterialPageRoute( + settings: RouteSettings(arguments: plan), + builder: (_) => NutritionalPlanScreen(), + ), + ), + child: const SizedBox(), + ), + ), + ); +} diff --git a/integration_test/weight.dart b/integration_test/weight.dart new file mode 100644 index 000000000..ae94b1dc5 --- /dev/null +++ b/integration_test/weight.dart @@ -0,0 +1,47 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:provider/provider.dart'; +import 'package:wger/models/body_weight/weight_entry.dart'; +import 'package:wger/providers/body_weight.dart'; +import 'package:wger/screens/form_screen.dart'; +import 'package:wger/screens/weight_screen.dart'; +import 'package:wger/theme/theme.dart'; + +import '../test/other/base_provider_test.mocks.dart'; +import '../test/utils.dart'; + +Widget createWeightScreen({locale = 'en'}) { + return ChangeNotifierProvider( + create: (context) => BodyWeightProvider( + testAuthProvider, + [ + WeightEntry(id: 1, weight: 86, date: DateTime(2021, 01, 01)), + WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10)), + WeightEntry(id: 3, weight: 82, date: DateTime(2021, 01, 20)), + WeightEntry(id: 4, weight: 83, date: DateTime(2021, 01, 30)), + WeightEntry(id: 5, weight: 86, date: DateTime(2021, 02, 20)), + WeightEntry(id: 6, weight: 90, date: DateTime(2021, 02, 28)), + WeightEntry(id: 7, weight: 91, date: DateTime(2021, 03, 20)), + WeightEntry(id: 8, weight: 91.1, date: DateTime(2021, 03, 30)), + WeightEntry(id: 9, weight: 90, date: DateTime(2021, 05, 1)), + WeightEntry(id: 10, weight: 91, date: DateTime(2021, 6, 5)), + WeightEntry(id: 11, weight: 89, date: DateTime(2021, 6, 20)), + WeightEntry(id: 12, weight: 88, date: DateTime(2021, 7, 15)), + WeightEntry(id: 13, weight: 86, date: DateTime(2021, 7, 20)), + WeightEntry(id: 14, weight: 83, date: DateTime(2021, 7, 30)), + WeightEntry(id: 15, weight: 80, date: DateTime(2021, 8, 10)) + ], + MockClient(), + ), + child: MaterialApp( + locale: Locale(locale), + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: wgerTheme, + home: WeightScreen(), + routes: { + FormScreen.routeName: (ctx) => FormScreen(), + }, + ), + ); +} diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index cbd6d940d..b8ebd6ecd 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -41,5 +41,7 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + diff --git a/lib/helpers/consts.dart b/lib/helpers/consts.dart index 1164b99b4..ffc725064 100644 --- a/lib/helpers/consts.dart +++ b/lib/helpers/consts.dart @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -import 'package:flutter/animation.dart'; +import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; /// Size for the "smaller" icons, e.g. when they belong to less important items @@ -45,9 +45,10 @@ const DAYS_TO_CACHE = 20; /// Name of the submit button in forms const SUBMIT_BUTTON_KEY_NAME = 'submit-button'; -/// Local Preferences key for exercises +/// Local Preferences keys const PREFS_EXERCISES = 'exerciseData'; const PREFS_EXERCISE_CACHE_VERSION = 'cacheVersion'; +const PREFS_INGREDIENTS = 'ingredientData'; const DEFAULT_ANIMATION_DURATION = Duration(milliseconds: 200); const DEFAULT_ANIMATION_CURVE = Curves.bounceIn; @@ -75,3 +76,22 @@ const ENERGY_CARBOHYDRATES = 4; /// kcal per gram of fat (approx) const ENERGY_FAT = 9; + +/// Language ID for English (fallback) +const LANGUAGE_SHORT_ENGLISH = 'en'; + +/// IDs of the different image art styles +/// +/// Values taken from exercises/models/image.py +enum EXERCISE_IMAGE_ART_STYLE { + _, // 0 is not used + LINE_ART, + THREE_D, + LOW_POLY, + PHOTO, + OTHER, +} + +/// Colors used for muscles +const COLOR_MAIN_MUSCLES = Colors.red; +const COLOR_SECONDARY_MUSCLES = Colors.orange; diff --git a/lib/helpers/exercises/forms.dart b/lib/helpers/exercises/forms.dart new file mode 100644 index 000000000..25d92bde4 --- /dev/null +++ b/lib/helpers/exercises/forms.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; + +/// The amount of characters an exercise description needs to have +const MIN_CHARS_DESCRIPTION = 40; + +/// The amount of characters an exercise name needs to have +const MIN_CHARS_NAME = 5; +const MAX_CHARS_NAME = 40; + +String? validateName(String? name, BuildContext context) { + if (name!.isEmpty) { + return AppLocalizations.of(context).enterValue; + } + + if (name.length < MIN_CHARS_NAME || name.length > MAX_CHARS_NAME) { + return AppLocalizations.of(context).enterCharacters(MIN_CHARS_NAME, MAX_CHARS_NAME); + } + + return null; +} + +String? validateDescription(String? name, BuildContext context) { + if (name!.isEmpty) { + return AppLocalizations.of(context).enterValue; + } + + if (name.length < MIN_CHARS_DESCRIPTION) { + return AppLocalizations.of(context).enterMinCharacters(MIN_CHARS_DESCRIPTION); + } + + return null; +} diff --git a/lib/helpers/i18n.dart b/lib/helpers/i18n.dart new file mode 100644 index 000000000..ad6fa7312 --- /dev/null +++ b/lib/helpers/i18n.dart @@ -0,0 +1,105 @@ +import 'package:flutter/widgets.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; + +/// This code is autogenerated in the backend repo in extract-i18n.py do not edit! + +/// Translate dynamic strings that are returned from the server +/// These strings such as categories or equipment are returned by the server +/// in English and need to be translated here in the application (there are +/// probably better ways to do this, but that's the way it is right now). + +String getTranslation(String value, BuildContext context) { + switch (value) { + case 'Lower back': + return AppLocalizations.of(context).lower_back; + + case 'Seconds': + return AppLocalizations.of(context).seconds; + + case 'Repetitions': + return AppLocalizations.of(context).repetitions; + + case 'Dumbbell': + return AppLocalizations.of(context).dumbbell; + + case 'Abs': + return AppLocalizations.of(context).abs; + + case 'SZ-Bar': + return AppLocalizations.of(context).sz_bar; + + case 'Miles': + return AppLocalizations.of(context).miles; + + case 'Kilometers': + return AppLocalizations.of(context).kilometers; + + case 'Shoulders': + return AppLocalizations.of(context).shoulders; + + case 'Triceps': + return AppLocalizations.of(context).triceps; + + case 'Quads': + return AppLocalizations.of(context).quads; + + case 'none (bodyweight exercise)': + return AppLocalizations.of(context).none__bodyweight_exercise_; + + case 'Barbell': + return AppLocalizations.of(context).barbell; + + case 'Lats': + return AppLocalizations.of(context).lats; + + case 'Until Failure': + return AppLocalizations.of(context).until_failure; + + case 'Gym mat': + return AppLocalizations.of(context).gym_mat; + + case 'Glutes': + return AppLocalizations.of(context).glutes; + + case 'Bench': + return AppLocalizations.of(context).bench; + + case 'Pull-up bar': + return AppLocalizations.of(context).pull_up_bar; + + case 'Calves': + return AppLocalizations.of(context).calves; + + case 'Arms': + return AppLocalizations.of(context).arms; + + case 'Biceps': + return AppLocalizations.of(context).biceps; + + case 'Kettlebell': + return AppLocalizations.of(context).kettlebell; + + case 'Back': + return AppLocalizations.of(context).back; + + case 'Chest': + return AppLocalizations.of(context).chest; + + case 'Swiss Ball': + return AppLocalizations.of(context).swiss_ball; + + case 'Minutes': + return AppLocalizations.of(context).minutes; + + case 'Incline bench': + return AppLocalizations.of(context).incline_bench; + + case 'Hamstrings': + return AppLocalizations.of(context).hamstrings; + + case 'Legs': + return AppLocalizations.of(context).legs; + default: + return 'NOT TRANSLATED'; + } +} diff --git a/lib/helpers/misc.dart b/lib/helpers/misc.dart index 05e5d6931..62272b069 100644 --- a/lib/helpers/misc.dart +++ b/lib/helpers/misc.dart @@ -93,8 +93,8 @@ extension TimeOfDayExtension on TimeOfDay { } void launchURL(String url, BuildContext context) async { - await canLaunch(url) - ? await launch(url) + await canLaunchUrl(Uri.parse(url)) + ? await launchUrl(Uri.parse(url)) : ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text('Could not open $url.')), ); diff --git a/lib/helpers/ui.dart b/lib/helpers/ui.dart index 5219c0002..be594ec8c 100644 --- a/lib/helpers/ui.dart +++ b/lib/helpers/ui.dart @@ -56,7 +56,15 @@ void showHttpExceptionErrorDialog(WgerHttpException exception, BuildContext cont final List errorList = []; for (final key in exception.errors!.keys) { // Error headers - errorList.add(Text(key, style: const TextStyle(fontWeight: FontWeight.bold))); + // Ensure that the error heading first letter is capitalized. + final String errorHeaderMsg = key[0].toUpperCase() + key.substring(1, key.length); + + errorList.add( + Text( + errorHeaderMsg, + style: const TextStyle(fontWeight: FontWeight.bold), + ), + ); // Error messages if (exception.errors![key] is String) { @@ -74,6 +82,7 @@ void showHttpExceptionErrorDialog(WgerHttpException exception, BuildContext cont builder: (ctx) => AlertDialog( title: Text(AppLocalizations.of(ctx).anErrorOccurred), content: Column( + crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [...errorList], ), @@ -94,7 +103,7 @@ void showHttpExceptionErrorDialog(WgerHttpException exception, BuildContext cont } dynamic showDeleteDialog(BuildContext context, String confirmDeleteName, Log log, Exercise exercise, - Map> _exerciseData) async { + Map> exerciseData) async { final res = await showDialog( context: context, builder: (BuildContext contextDialog) { @@ -113,7 +122,7 @@ dynamic showDeleteDialog(BuildContext context, String confirmDeleteName, Log log style: TextStyle(color: Theme.of(context).errorColor), ), onPressed: () { - _exerciseData[exercise]!.removeWhere((el) => el.id == log.id); + exerciseData[exercise]!.removeWhere((el) => el.id == log.id); Provider.of(context, listen: false).deleteLog( log, ); diff --git a/lib/l10n/app_ar.arb b/lib/l10n/app_ar.arb new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/lib/l10n/app_ar.arb @@ -0,0 +1 @@ +{} diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 9dd51a8f9..6574e9d7e 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -573,5 +573,13 @@ "scanBarcode": "Strichcode scannen", "@scanBarcode": { "description": "Label for scan barcode button" - } + }, + "abs": "Bauch", + "arms": "Arme", + "back": "Rücken", + "calves": "Waden", + "chest": "Brust", + "legs": "Beine", + "shoulders": "Schultern", + "barbell": "Langhantel" } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 0e569b541..acf06b35c 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1,5 +1,6 @@ { "@@last_modified": "2020-11-11T15:04:05.523531", + "userProfile": "Your profile", "login": "Log in", "@login": { "description": "Text for login button" @@ -56,7 +57,7 @@ "@customServerUrl": { "description": "Label in the form where the users can enter their own wger instance" }, - "customServerHint": "Enter the the address of your own server, otherwise the default one will be used", + "customServerHint": "Enter the address of your own server, otherwise the default one will be used", "@customServerHint": { "description": "Hint text for the form where the users can enter their own wger instance" }, @@ -100,10 +101,19 @@ "@successfullySaved": { "description": "Message when an item was successfully saved" }, + "exerciseList": "Exercise list", "exercise": "Exercise", "@exercise": { "description": "An exercise for a workout" }, + "exercises": "Exercises", + "@exercises": { + "description": "Multiple exercises for a workout" + }, + "exerciseName": "Exercise Name", + "@exerciseName": { + "description": "Label for the name of a workout exercise" + }, "searchExercise": "Search exercise to add", "@searchExercise": { "description": "Label on set form. Selected exercises are added to the set" @@ -136,10 +146,6 @@ "@noWorkoutPlans": { "description": "Message shown when the user has no workout plans" }, - "repetitions": "Repetitions", - "@repetitions": { - "description": "Repetitions for an exercise set" - }, "reps": "Reps", "@reps": { "description": "Shorthand for repetitions, used when space constraints are tighter" @@ -265,12 +271,15 @@ "description": "The weight of a workout log or body weight entry" }, "measurement": "Measurement", + "@measurement": {}, "measurements": "Measurements", "@measurements": { "description": "Categories for the measurements such as biceps size, body fat, etc." }, "measurementCategoriesHelpText": "Measurement category, such as 'biceps' or 'body fat'", + "@measurementCategoriesHelpText": {}, "measurementEntriesHelpText": "The unit used to measure the category such as 'cm' or '%'", + "@measurementEntriesHelpText": {}, "date": "Date", "@date": { "description": "The date of a workout log or body weight entry" @@ -296,6 +305,7 @@ "description": "The end time of a workout" }, "timeStartAhead": "Start time cannot be ahead of end time", + "@timeStartAhead": {}, "ingredient": "Ingredient", "@ingredient": {}, "energy": "Energy", @@ -311,6 +321,7 @@ "description": "Energy in a meal in kilocalories, kcal" }, "macronutrients": "Macronutrients", + "@macronutrients": {}, "planned": "Planned", "@planned": { "description": "Header for the column of 'planned' nutritional values, i.e. what should be eaten" @@ -324,7 +335,9 @@ "description": "Header for the column of '7 day average' nutritional values, i.e. what was logged last week" }, "difference": "Difference", + "@difference": {}, "percentEnergy": "Percent of energy", + "@percentEnergy": {}, "gPerBodyKg": "g per body kg", "@gPerBodyKg": { "description": "Label used for total sums of e.g. calories or similar in grams per Kg of body weight" @@ -345,13 +358,13 @@ "@protein": {}, "proteinShort": "P", "@proteinShort": { - "description" : "The first letter or short name of the word 'Protein', used in overviews" + "description": "The first letter or short name of the word 'Protein', used in overviews" }, "carbohydrates": "Carbohydrates", "@carbohydrates": {}, "carbohydratesShort": "C", "@carbohydratesShort": { - "description" : "The first letter or short name of the word 'Carbohydrates', used in overviews" + "description": "The first letter or short name of the word 'Carbohydrates', used in overviews" }, "sugars": "Sugars", "@sugars": {}, @@ -359,7 +372,7 @@ "@fat": {}, "fatShort": "F", "@fatShort": { - "description" : "The first letter or short name of the word 'Fat', used in overviews" + "description": "The first letter or short name of the word 'Fat', used in overviews" }, "saturatedFat": "Saturated fat", "@saturatedFat": {}, @@ -383,6 +396,14 @@ "@noWeightEntries": { "description": "Message shown when the user has no logged weight entries" }, + "noMeasurementEntries": "You have no measurement entries", + "@noMeasurementntries": { + "description": "Message shown when the user has no logged measurement entries" + }, + "moreMeasurementEntries": "Add new measurement", + "@moreMeasurementEntries": { + "description": "Message shown when the user wants to add new measurement" + }, "edit": "Edit", "@edit": {}, "loadingText": "Loading...", @@ -406,6 +427,7 @@ "description": "Switch to toggle detail / overview" }, "goToDetailPage": "Go to detail page", + "@goToDetailPage": {}, "aboutDescription": "Thank you for using wger! wger is a collaborative open source project, made by fitness enthusiasts from around the world.", "@aboutDescription": { "description": "Text in the about dialog" @@ -456,6 +478,7 @@ "@enterValue": { "description": "Error message when the user hasn't entered a value on a required field" }, + "selectEntry": "Please select an entry", "selectExercise": "Please select an exercise", "@selectExercise": { "description": "Error message when the user hasn't selected an exercise in the form" @@ -469,6 +492,15 @@ "max": {} } }, + "enterMinCharacters": "Please enter at least {min} characters", + "@enterMinCharacters": { + "description": "Error message when the user hasn't entered the minimum amount characters in a form", + "type": "text", + "placeholders": { + "min": {} + } + }, + "baseNameEnglish": "All exercises need a base name in English", "nrOfSets": "Sets per exercise: {nrOfSets}", "@nrOfSets": { "description": "Label shown on the slider where the user selects the nr of sets", @@ -503,21 +535,25 @@ "description": "Label for the popup with general app options" }, "takePicture": "Take a picture", + "@takePicture": {}, "chooseFromLibrary": "Choose from photo library", + "@chooseFromLibrary": {}, "gallery": "Gallery", + "@gallery": {}, "addImage": "Add image", + "@addImage": {}, "dataCopied": "Data copied to new entry", "@dataCopied": { "description": "Snackbar message to show on copying data to a new log entry" }, - "appUpdateTitle" : "Update needed", - "appUpdateContent" : "This version of the app is not compatible with the server, please update your application.", - + "appUpdateTitle": "Update needed", + "@appUpdateTitle": {}, + "appUpdateContent": "This version of the app is not compatible with the server, please update your application.", + "@appUpdateContent": {}, "productFound": "Product found", "@productFound": { "description": "Header label for dialog when product is found with barcode" }, - "productFoundDescription": "The barcode corresponds to this product: {productName}. Do you want to continue?", "@productFoundDescription": { "description": "Dialog info when product is found with barcode", @@ -545,5 +581,71 @@ "close": "Close", "@close": { "description": "Translation for close" - } + }, + "add_exercise_image_license": "Images must be compatible with the CC BY SA license. If in doubt, upload only photos you've taken yourself.", + "variations": "Variations", + "@variations": { + "description": "Variations of one exercise (e.g. benchpress and benchpress narrow)" + }, + "alsoKnownAs": "Also known as: {aliases}", + "@alsoKnownAs": { + "placeholders": { + "aliases": {} + }, + "description": "List of alternative names for an exercise" + }, + "verifiedEmail": "Verified email", + "unVerifiedEmail": "Unverified email", + "verifiedEmailReason": "You need to verify your email to contribute exercises", + "verifiedEmailInfo": "A verification email was sent to {email}", + "@verifiedEmailInfo": { + "placeholders": { + "email": {} + } + }, + "alternativeNames": "Alternative names", + "oneNamePerLine": "One name per line", + "whatVariationsExist": "What variations of this exercise exist, if any?", + "previous": "Previous", + "next": "Next", + "images": "Images", + "language": "Language", + "addExercise": "Add exercise", + "contributeExercise": "Contribute an exercise", + "translation": "Translation", + "translateExercise": "Translate this exercise now", + "baseData": "Basics in English", + "@baseData": { + "description": "The base data for an exercise such as category, trained muscles, etc." + }, + "repetitions": "Repetitions", + "minutes": "Minutes", + "glutes": "Glutes", + "kilometers": "Kilometers", + "until_failure": "Until Failure", + "seconds": "Seconds", + "bench": "Bench", + "barbell": "Barbell", + "triceps": "Triceps", + "swiss_ball": "Swiss Ball", + "none__bodyweight_exercise_": "none (bodyweight exercise)", + "lower_back": "Lower back", + "shoulders": "Shoulders", + "pull_up_bar": "Pull-up bar", + "hamstrings": "Hamstrings", + "calves": "Calves", + "chest": "Chest", + "kettlebell": "Kettlebell", + "biceps": "Biceps", + "dumbbell": "Dumbbell", + "gym_mat": "Gym mat", + "abs": "Abs", + "incline_bench": "Incline bench", + "miles": "Miles", + "lats": "Lats", + "legs": "Legs", + "back": "Back", + "quads": "Quads", + "arms": "Arms", + "sz_bar": "SZ-Bar" } diff --git a/lib/l10n/app_id.arb b/lib/l10n/app_id.arb new file mode 100644 index 000000000..49bff8dea --- /dev/null +++ b/lib/l10n/app_id.arb @@ -0,0 +1,549 @@ +{ + "@@last_modified": "2020-11-11T15:04:05.523531", + "login": "Masuk", + "@login": { + "description": "Text for login button" + }, + "logout": "Keluar", + "@logout": { + "description": "Text for logout button" + }, + "register": "Daftar", + "@register": { + "description": "Text for registration button" + }, + "useDefaultServer": "Gunakan server bawaan ", + "@useDefaultServer": { + "description": "Toggle button allowing users to switch between the default and a custom wger server" + }, + "useCustomServer": "Gunakan server lain", + "@useCustomServer": { + "description": "Toggle button allowing users to switch between the default and a custom wger server" + }, + "invalidUrl": "Mohon masukkan URL yang valid", + "@invalidUrl": { + "description": "Error message when the user enters an invalid URL, e.g. in the login form" + }, + "usernameValidChars": "Username hanya dapat diisi dengan hiruf, angka, dan karakter @, +, ., -, dan _", + "@usernameValidChars": { + "description": "Error message when the user tries to register a username with forbidden characters" + }, + "passwordsDontMatch": "Password tidak sesuai", + "@passwordsDontMatch": { + "description": "Error message when the user enters two different passwords during registration" + }, + "passwordTooShort": "Password terlalu pendek", + "@passwordTooShort": { + "description": "Error message when the user a password that is too short" + }, + "password": "Password", + "@password": {}, + "confirmPassword": "Konfirmasi Password", + "@confirmPassword": {}, + "invalidEmail": "Mohon masukkan E-mail yang valid", + "@invalidEmail": { + "description": "Error message when the user enters an invalid email" + }, + "email": "Alamat E-mail", + "@email": {}, + "username": "Username", + "@username": {}, + "invalidUsername": "Mohon masukkan username yang valid", + "@invalidUsername": { + "description": "Error message when the user enters an invalid username" + }, + "customServerUrl": "URL dari wger", + "@customServerUrl": { + "description": "Label in the form where the users can enter their own wger instance" + }, + "customServerHint": "Masukkan alamat servermu sendiri, jika tidak akan menggunakan server bawaan", + "@customServerHint": { + "description": "Hint text for the form where the users can enter their own wger instance" + }, + "reset": "Reset", + "@reset": { + "description": "Button text allowing the user to reset the entered values to the default" + }, + "registerInstead": "Mohon daftar terlebih dahulu", + "@registerInstead": {}, + "loginInstead": "Mohon masuk terlebih dahulu", + "@loginInstead": {}, + "labelWorkoutPlans": "Daftar rencana workout", + "@labelWorkoutPlans": { + "description": "Title for screen workout plans" + }, + "labelBottomNavWorkout": "Workout", + "@labelBottomNavWorkout": { + "description": "Label used in bottom navigation, use a short word" + }, + "labelBottomNavNutrition": "Nutrisi", + "@labelBottomNavNutrition": { + "description": "Label used in bottom navigation, use a short word" + }, + "labelWorkoutLogs": "Log latihan", + "@labelWorkoutLogs": { + "description": "(Workout) logs" + }, + "labelWorkoutPlan": "Rencana workout", + "@labelWorkoutPlan": { + "description": "Title for screen workout plan" + }, + "labelDashboard": "Dashboard", + "@labelDashboard": { + "description": "Title for screen dashboard" + }, + "successfullyDeleted": "Terhapus", + "@successfullyDeleted": { + "description": "Message when an item was successfully deleted" + }, + "successfullySaved": "Tersimpan", + "@successfullySaved": { + "description": "Message when an item was successfully saved" + }, + "exercise": "Latihan", + "@exercise": { + "description": "An exercise for a workout" + }, + "searchExercise": "Cari latihan untuk ditambahkan", + "@searchExercise": { + "description": "Label on set form. Selected exercises are added to the set" + }, + "supersetWith": "tambahkan dengan", + "@supersetWith": { + "description": "Text used between exercise cards when adding a new set. Translate as something like 'in a superset with'" + }, + "equipment": "Perlengkapan", + "@equipment": { + "description": "Equipment needed to perform an exercise" + }, + "muscles": "Otot", + "@muscles": { + "description": "(main) muscles trained by an exercise" + }, + "musclesSecondary": "Otot sekunder", + "@musclesSecondary": { + "description": "secondary muscles trained by an exercise" + }, + "category": "Kategori", + "@category": { + "description": "Category for an exercise, ingredient, etc." + }, + "newWorkout": "Rencana workout baru", + "@newWorkout": { + "description": "Header when adding a new workout" + }, + "noWorkoutPlans": "Kamu belum mempunyain rencana workout", + "@noWorkoutPlans": { + "description": "Message shown when the user has no workout plans" + }, + "repetitions": "Pengulangan", + "@repetitions": { + "description": "Repetitions for an exercise set" + }, + "reps": "Reps", + "@reps": { + "description": "Shorthand for repetitions, used when space constraints are tighter" + }, + "rir": "RiR", + "@rir": { + "description": "Shorthand for Repetitions In Reserve" + }, + "rirNotUsed": "RiR tidak digunakan", + "@rirNotUsed": { + "description": "Label used in RiR slider when the RiR value is not used/saved for the current setting or log" + }, + "weightUnit": "Satuan bobot", + "@weightUnit": {}, + "repetitionUnit": "Satuan pengulangan", + "@repetitionUnit": {}, + "set": "Set", + "@set": { + "description": "A set in a workout plan" + }, + "dayDescriptionHelp": "Deskripsi untuk yang sudah diselesaikan hari ini (contoh: 'pull day') atau bagian tubuh mana yang sudah dilatih (contoh: 'dada dan pundak')", + "@dayDescriptionHelp": {}, + "setNr": "Set {nr}", + "@setNr": { + "description": "Header in form indicating the number of the current set. Can also be translated as something like 'Set Nr. xy'.", + "type": "text", + "placeholders": { + "nr": {} + } + }, + "sameRepetitions": "Jika Anda melakukan pengulangan dan bobot yang sama untuk semua set, Anda cukup mengisi satu baris. Misalnya untuk 4 set cukup masukkan 10 untuk pengulangan, ini secara otomatis menjadi \"4 x 10\".", + "@sameRepetitions": {}, + "comment": "Komentar", + "@comment": { + "description": "Comment, additional information" + }, + "impression": "Kesan", + "@impression": { + "description": "General impression (e.g. for a workout session) such as good, bad, etc." + }, + "notes": "Catatan", + "@notes": { + "description": "Personal notes, e.g. for a workout session" + }, + "workoutSession": "Sesi workout", + "@workoutSession": { + "description": "A (logged) workout session" + }, + "newDay": "Hari baru", + "@newDay": {}, + "newSet": "Set baru", + "@newSet": { + "description": "Header when adding a new set to a workout day" + }, + "selectExercises": "Jika Anda ingin melakukan superset, Anda dapat mencari beberapa latihan, mereka akan dikelompokkan bersama", + "@selectExercises": {}, + "gymMode": "Mode gym", + "@gymMode": { + "description": "Label when starting the gym mode" + }, + "plateCalculator": "Plates", + "@plateCalculator": { + "description": "Label used for the plate calculator in the gym mode" + }, + "plateCalculatorNotDivisible": "Tidak memungkinkan untuk mencapai bobot dengan plate yang tersedia", + "@plateCalculatorNotDivisible": { + "description": "Error message when the current weight is not reachable with plates (e.g. 33.1 kg)" + }, + "pause": "Jeda", + "@pause": { + "description": "Noun, not an imperative! Label used for the pause when using the gym mode" + }, + "jumpTo": "Lompat ke", + "@jumpTo": { + "description": "Imperative. Label used in popup allowing the user to jump to a specific exercise while in the gym mode" + }, + "todaysWorkout": "Latihanmu hari ini", + "@todaysWorkout": {}, + "logHelpEntries": "If on a single day there is more than one entry with the same number of repetitions, but different weights, only the entry with the higher weight is shown in the diagram.", + "@logHelpEntries": {}, + "logHelpEntriesUnits": "Note that only entries with a weight unit (kg or lb) and repetitions are charted, other combinations such as time or until failure are ignored here.", + "@logHelpEntriesUnits": {}, + "description": "Description", + "@description": {}, + "name": "Nama", + "@name": { + "description": "Name for a workout or nutritional plan" + }, + "save": "Simpan", + "@save": {}, + "addSet": "Tambah set", + "@addSet": { + "description": "Label for the button that adds a set (to a workout day)" + }, + "addMeal": "Tambah makanan", + "@addMeal": {}, + "mealLogged": "Meal logged to diary", + "@mealLogged": {}, + "logMeal": "Catat makanan ini", + "@logMeal": {}, + "addIngredient": "Tambah komposisi", + "@addIngredient": {}, + "logIngredient": "Simpan di diari nutrisi", + "@logIngredient": {}, + "searchIngredient": "Cari komposisi", + "@searchIngredient": { + "description": "Label on ingredient search form" + }, + "nutritionalPlan": "Nutritional plan", + "@nutritionalPlan": {}, + "nutritionalDiary": "Nutritional diary", + "@nutritionalDiary": {}, + "nutritionalPlans": "Nutritional plans", + "@nutritionalPlans": {}, + "noNutritionalPlans": "You have no nutritional plans", + "@noNutritionalPlans": { + "description": "Message shown when the user has no nutritional plans" + }, + "anErrorOccurred": "An Error Occurred!", + "@anErrorOccurred": {}, + "weight": "Weight", + "@weight": { + "description": "The weight of a workout log or body weight entry" + }, + "measurement": "Ukuran", + "measurements": "Measurements", + "@measurements": { + "description": "Categories for the measurements such as biceps size, body fat, etc." + }, + "measurementCategoriesHelpText": "Measurement category, such as 'biceps' or 'body fat'", + "measurementEntriesHelpText": "The unit used to measure the category such as 'cm' or '%'", + "date": "Date", + "@date": { + "description": "The date of a workout log or body weight entry" + }, + "value": "Value", + "@value": { + "description": "The value of a measurement entry" + }, + "start": "Start", + "@start": { + "description": "Label on button to start the gym mode (i.e., an imperative)" + }, + "time": "Time", + "@time": { + "description": "The time of a meal or workout" + }, + "timeStart": "Start time", + "@timeStart": { + "description": "The starting time of a workout" + }, + "timeEnd": "End time", + "@timeEnd": { + "description": "The end time of a workout" + }, + "timeStartAhead": "Start time cannot be ahead of end time", + "ingredient": "Ingredient", + "@ingredient": {}, + "energy": "Energy", + "@energy": { + "description": "Energy in a meal, ingredient etc. e.g. in kJ" + }, + "energyShort": "E", + "@energyShort": { + "description": "The first letter or short name of the word 'Energy', used in overviews" + }, + "kcal": "kcal", + "@kcal": { + "description": "Energy in a meal in kilocalories, kcal" + }, + "macronutrients": "Macronutrients", + "planned": "Planned", + "@planned": { + "description": "Header for the column of 'planned' nutritional values, i.e. what should be eaten" + }, + "logged": "Logged", + "@logged": { + "description": "Header for the column of 'logged' nutritional values, i.e. what was eaten" + }, + "weekAverage": "7 day average", + "@weekAverage": { + "description": "Header for the column of '7 day average' nutritional values, i.e. what was logged last week" + }, + "difference": "Difference", + "percentEnergy": "Percent of energy", + "gPerBodyKg": "g per body kg", + "@gPerBodyKg": { + "description": "Label used for total sums of e.g. calories or similar in grams per Kg of body weight" + }, + "total": "Total", + "@total": { + "description": "Label used for total sums of e.g. calories or similar" + }, + "kJ": "kJ", + "@kJ": { + "description": "Energy in a meal in kilo joules, kJ" + }, + "g": "g", + "@g": { + "description": "Abbreviation for gram" + }, + "protein": "Protein", + "@protein": {}, + "proteinShort": "P", + "@proteinShort": { + "description" : "The first letter or short name of the word 'Protein', used in overviews" + }, + "carbohydrates": "Carbohydrates", + "@carbohydrates": {}, + "carbohydratesShort": "C", + "@carbohydratesShort": { + "description" : "The first letter or short name of the word 'Carbohydrates', used in overviews" + }, + "sugars": "Sugars", + "@sugars": {}, + "fat": "Fat", + "@fat": {}, + "fatShort": "F", + "@fatShort": { + "description" : "The first letter or short name of the word 'Fat', used in overviews" + }, + "saturatedFat": "Saturated fat", + "@saturatedFat": {}, + "fibres": "Fibre", + "@fibres": {}, + "sodium": "Sodium", + "@sodium": {}, + "amount": "Amount", + "@amount": { + "description": "The amount (e.g. in grams) of an ingredient in a meal" + }, + "unit": "Unit", + "@unit": { + "description": "The unit used for a repetition (kg, time, etc.)" + }, + "newEntry": "New entry", + "@newEntry": { + "description": "Title when adding a new entry such as a weight or log entry" + }, + "noWeightEntries": "You have no weight entries", + "@noWeightEntries": { + "description": "Message shown when the user has no logged weight entries" + }, + "edit": "Edit", + "@edit": {}, + "loadingText": "Loading...", + "@loadingText": { + "description": "Text to show when entries are being loaded in the background: Loading..." + }, + "delete": "Delete", + "@delete": {}, + "confirmDelete": "Are you sure you want to delete '{toDelete}'?", + "@confirmDelete": { + "description": "Confirmation text before the user deletes an object", + "type": "text", + "placeholders": { + "toDelete": {} + } + }, + "newNutritionalPlan": "New nutritional plan", + "@newNutritionalPlan": {}, + "toggleDetails": "Toggle details", + "@toggleDetails": { + "description": "Switch to toggle detail / overview" + }, + "goToDetailPage": "Go to detail page", + "aboutDescription": "Thank you for using wger! wger is a collaborative open source project, made by fitness enthusiasts from around the world.", + "@aboutDescription": { + "description": "Text in the about dialog" + }, + "aboutSourceTitle": "Source code", + "@aboutSourceTitle": { + "description": "Title for source code section in the about dialog" + }, + "aboutSourceText": "Get the source code of this application and its server on github", + "@aboutSourceText": { + "description": "Text for source code section in the about dialog" + }, + "aboutBugsTitle": "Have a problem or idea?", + "@aboutBugsTitle": { + "description": "Title for bugs section in the about dialog" + }, + "aboutBugsText": "Get in touch if something didn't behave as expected or if there is a feature that you feel is missing.", + "@aboutBugsText": { + "description": "Text for bugs section in the about dialog" + }, + "aboutContactUsTitle": "Say hi!", + "@aboutContactUsTitle": { + "description": "Title for contact us section in the about dialog" + }, + "aboutContactUsText": "If you want to chat with us, hop on the Discord server and get in touch", + "@aboutContactUsText": { + "description": "Text for contact us section in the about dialog" + }, + "aboutTranslationTitle": "Translation", + "@aboutTranslationTitle": { + "description": "Title for translation section in the about dialog" + }, + "aboutTranslationText": "This application is translated on weblate. If you also want to help, click the link and start translating", + "@aboutTranslationText": { + "description": "Text for translation section in the about dialog" + }, + "calendar": "Calendar", + "@calendar": {}, + "goToToday": "Go to today", + "@goToToday": { + "description": "Label on button to jump back to 'today' in the calendar widget" + }, + "enterRepetitionsOrWeight": "Please fill in either the repetitions or the weight for at least one of the sets", + "@enterRepetitionsOrWeight": { + "description": "Error message when the user hasn't filled in the forms for exercise sets" + }, + "enterValue": "Please enter a value", + "@enterValue": { + "description": "Error message when the user hasn't entered a value on a required field" + }, + "selectExercise": "Please select an exercise", + "@selectExercise": { + "description": "Error message when the user hasn't selected an exercise in the form" + }, + "enterCharacters": "Please enter between {min} and {max} characters", + "@enterCharacters": { + "description": "Error message when the user hasn't entered the correct number of characters in a form", + "type": "text", + "placeholders": { + "min": {}, + "max": {} + } + }, + "nrOfSets": "Sets per exercise: {nrOfSets}", + "@nrOfSets": { + "description": "Label shown on the slider where the user selects the nr of sets", + "type": "text", + "placeholders": { + "nrOfSets": {} + } + }, + "setUnitsAndRir": "Set units and RiR", + "@setUnitsAndRir": { + "description": "Label shown on the slider where the user can toggle showing units and RiR", + "type": "text" + }, + "enterValidNumber": "Please enter a valid number", + "@enterValidNumber": { + "description": "Error message when the user has submitted an invalid number (e.g. '3,.,.,.')" + }, + "selectIngredient": "Please select an ingredient", + "@selectIngredient": { + "description": "Error message when the user hasn't selected an ingredient from the autocompleter" + }, + "recentlyUsedIngredients": "Recently added ingredients", + "@recentlyUsedIngredients": { + "description": "A message when a user adds a new ingredient to a meal." + }, + "selectImage": "Please select an image", + "@selectImage": { + "description": "Label and error message when the user hasn't selected an image to save" + }, + "optionsLabel": "Options", + "@optionsLabel": { + "description": "Label for the popup with general app options" + }, + "takePicture": "Take a picture", + "chooseFromLibrary": "Choose from photo library", + "gallery": "Gallery", + "addImage": "Add image", + "dataCopied": "Data copied to new entry", + "@dataCopied": { + "description": "Snackbar message to show on copying data to a new log entry" + }, + "appUpdateTitle" : "Update needed", + "appUpdateContent" : "This version of the app is not compatible with the server, please update your application.", + + "productFound": "Product found", + "@productFound": { + "description": "Header label for dialog when product is found with barcode" + }, + + "productFoundDescription": "The barcode corresponds to this product: {productName}. Do you want to continue?", + "@productFoundDescription": { + "description": "Dialog info when product is found with barcode", + "type": "text", + "placeholders": { + "productName": {} + } + }, + "productNotFound": "Product not found", + "@productNotFound": { + "description": "Header label for dialog when product is not found with barcode" + }, + "productNotFoundDescription": "The product with the scanned barcode {barcode} was not found in the wger database", + "@productNotFoundDescription": { + "description": "Dialog info when product is not found with barcode", + "type": "text", + "placeholders": { + "barcode": {} + } + }, + "scanBarcode": "Scan barcode", + "@scanBarcode": { + "description": "Label for scan barcode button" + }, + "close": "Close", + "@close": { + "description": "Translation for close" + } +} diff --git a/lib/l10n/app_tr.arb b/lib/l10n/app_tr.arb index f7bbc05c0..8418ed292 100644 --- a/lib/l10n/app_tr.arb +++ b/lib/l10n/app_tr.arb @@ -556,5 +556,144 @@ "dataCopied": "Veriler yeni girişe kopyalandı", "@dataCopied": { "description": "Snackbar message to show on copying data to a new log entry" + }, + "alsoKnownAs": "{aliases} olarak da bilinir", + "@alsoKnownAs": { + "placeholders": { + "aliases": {} + }, + "description": "List of alternative names for an exercise" + }, + "exerciseList": "Egzersiz listesi", + "@exerciseList": {}, + "images": "Resimler", + "@images": {}, + "exerciseName": "Egzersiz Adı", + "@exerciseName": { + "description": "Label for the name of a workout exercise" + }, + "enterMinCharacters": "Lütfen en az {min} karakter girin", + "@enterMinCharacters": { + "description": "Error message when the user hasn't entered the minimum amount characters in a form", + "type": "text", + "placeholders": { + "min": {} + } + }, + "add_exercise_image_license": "Görseller CC BY SA lisansı ile uyumlu olmalıdır. Emin değilseniz, yalnızca kendi çektiğiniz fotoğrafları yükleyin.", + "@add_exercise_image_license": {}, + "verifiedEmailReason": "Egzersizlere katkıda bulunmak için e-postanızı doğrulamanız gerekiyor", + "@verifiedEmailReason": {}, + "alternativeNames": "Alternatif isimler", + "@alternativeNames": {}, + "minutes": "Dakika", + "@minutes": {}, + "seconds": "Saniye", + "@seconds": {}, + "verifiedEmailInfo": "{email} adresine bir doğrulama e-postası gönderildi", + "@verifiedEmailInfo": { + "placeholders": { + "email": {} + } + }, + "previous": "Önceki", + "@previous": {}, + "next": "Sonraki", + "@next": {}, + "translateExercise": "Bu egzersizi şimdi çevir", + "@translateExercise": {}, + "glutes": "Kalça kasları", + "@glutes": {}, + "kilometers": "Kilometre", + "@kilometers": {}, + "dumbbell": "Dambıl", + "@dumbbell": {}, + "bench": "Benç", + "@bench": {}, + "none__bodyweight_exercise_": "yok (vücut ağırlığı egzersizi)", + "@none__bodyweight_exercise_": {}, + "shoulders": "Omuzlar", + "@shoulders": {}, + "biceps": "Pazılar", + "@biceps": {}, + "arms": "Kollar", + "@arms": {}, + "incline_bench": "Eğim tezgahı", + "@incline_bench": {}, + "userProfile": "Profilin", + "@userProfile": {}, + "selectEntry": "Lütfen bir giriş seçin", + "@selectEntry": {}, + "baseNameEnglish": "Tüm egzersizlerin İngilizce bir ismi olmalıdır", + "@baseNameEnglish": {}, + "variations": "Varyasyonlar", + "@variations": { + "description": "Variations of one exercise (e.g. benchpress and benchpress narrow)" + }, + "verifiedEmail": "Doğrulanmış e-posta", + "@verifiedEmail": {}, + "unVerifiedEmail": "Doğrulanmamış e-posta", + "@unVerifiedEmail": {}, + "oneNamePerLine": "Satır başına bir ad", + "@oneNamePerLine": {}, + "whatVariationsExist": "Varsa, bu egzersizin hangi varyasyonları vardır?", + "@whatVariationsExist": {}, + "language": "Dil", + "@language": {}, + "addExercise": "Egzersiz ekle", + "@addExercise": {}, + "contributeExercise": "Egzersize katkıda bulunun", + "@contributeExercise": {}, + "until_failure": "Başarısız olana kadar", + "@until_failure": {}, + "barbell": "Halter", + "@barbell": {}, + "lower_back": "Alt sırt", + "@lower_back": {}, + "pull_up_bar": "Barfiks çubuğu", + "@pull_up_bar": {}, + "calves": "Baldırlar", + "@calves": {}, + "chest": "Göğüs", + "@chest": {}, + "triceps": "Triceps kasları", + "@triceps": {}, + "swiss_ball": "Egzersiz Topu", + "@swiss_ball": {}, + "hamstrings": "Hamstringler", + "@hamstrings": {}, + "gym_mat": "Spor matı", + "@gym_mat": {}, + "miles": "Mil", + "@miles": {}, + "kettlebell": "Kettlebell", + "@kettlebell": {}, + "abs": "Karın Kasları", + "@abs": {}, + "lats": "Lat kasları", + "@lats": {}, + "legs": "Bacaklar", + "@legs": {}, + "back": "Sırt", + "@back": {}, + "quads": "Quad kasları", + "@quads": {}, + "sz_bar": "Z-Bar", + "@sz_bar": {}, + "exercises": "Egzersizler", + "@exercises": { + "description": "Multiple exercises for a workout" + }, + "translation": "Çeviri", + "@translation": {}, + "baseData": "İngilizce'de temel bilgiler", + "@baseData": { + "description": "The base data for an exercise such as category, trained muscles, etc." + }, + "noMeasurementEntries": "Ölçüm girdiniz yok", + "@noMeasurementEntries": {}, + "moreMeasurementEntries": "Yeni ölçüm ekle", + "@moreMeasurementEntries": { + "description": "Message shown when the user wants to add new measurement" } } diff --git a/lib/main.dart b/lib/main.dart index 479f80987..9d259bfb0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,15 +19,20 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; +import 'package:wger/providers/add_exercise.dart'; import 'package:wger/providers/base_provider.dart'; import 'package:wger/providers/body_weight.dart'; import 'package:wger/providers/exercises.dart'; import 'package:wger/providers/gallery.dart'; import 'package:wger/providers/measurement.dart'; import 'package:wger/providers/nutrition.dart'; +import 'package:wger/providers/user.dart'; import 'package:wger/providers/workout_plans.dart'; +import 'package:wger/screens/add_exercise_screen.dart'; import 'package:wger/screens/auth_screen.dart'; import 'package:wger/screens/dashboard.dart'; +import 'package:wger/screens/exercise_screen.dart'; +import 'package:wger/screens/exercises_screen.dart'; import 'package:wger/screens/form_screen.dart'; import 'package:wger/screens/gallery_screen.dart'; import 'package:wger/screens/gym_mode.dart'; @@ -38,7 +43,6 @@ import 'package:wger/screens/nutritional_diary_screen.dart'; import 'package:wger/screens/nutritional_plan_screen.dart'; import 'package:wger/screens/nutritional_plans_screen.dart'; import 'package:wger/screens/splash_screen.dart'; -import 'package:wger/screens/update_app_screen.dart'; import 'package:wger/screens/weight_screen.dart'; import 'package:wger/screens/workout_plan_screen.dart'; import 'package:wger/screens/workout_plans_screen.dart'; @@ -64,9 +68,10 @@ class MyApp extends StatelessWidget { create: (ctx) => AuthProvider(), ), ChangeNotifierProxyProvider( - create: (context) => - ExercisesProvider(Provider.of(context, listen: false), []), - update: (context, auth, previous) => previous ?? ExercisesProvider(auth, []), + create: (context) => ExercisesProvider( + WgerBaseProvider(Provider.of(context, listen: false))), + update: (context, base, previous) => + previous ?? ExercisesProvider(WgerBaseProvider(base)), ), ChangeNotifierProxyProvider2( create: (context) => WorkoutPlansProvider( @@ -84,10 +89,17 @@ class MyApp extends StatelessWidget { ), ChangeNotifierProxyProvider( create: (context) => MeasurementProvider( - WgerBaseProvider(Provider.of(context, listen: false))), + WgerBaseProvider(Provider.of(context, listen: false)), + ), update: (context, base, previous) => previous ?? MeasurementProvider(WgerBaseProvider(base)), ), + ChangeNotifierProxyProvider( + create: (context) => UserProvider( + WgerBaseProvider(Provider.of(context, listen: false)), + ), + update: (context, base, previous) => previous ?? UserProvider(WgerBaseProvider(base)), + ), ChangeNotifierProxyProvider( create: (context) => BodyWeightProvider(Provider.of(context, listen: false), []), @@ -98,19 +110,20 @@ class MyApp extends StatelessWidget { GalleryProvider(Provider.of(context, listen: false), []), update: (context, auth, previous) => previous ?? GalleryProvider(auth, []), ), + ChangeNotifierProxyProvider( + create: (context) => AddExerciseProvider( + WgerBaseProvider(Provider.of(context, listen: false)), + ), + update: (context, base, previous) => + previous ?? AddExerciseProvider(WgerBaseProvider(base)), + ) ], child: Consumer( builder: (ctx, auth, _) => MaterialApp( title: 'wger', theme: wgerTheme, home: auth.isAuth - ? FutureBuilder( - future: auth.applicationUpdateRequired(), - builder: (ctx, snapshot) => - snapshot.connectionState == ConnectionState.done && snapshot.data == true - ? UpdateAppScreen() - : HomeTabsScreen(), - ) + ? HomeTabsScreen() : FutureBuilder( future: auth.tryAutoLogin(), builder: (ctx, authResultSnapshot) => @@ -132,6 +145,9 @@ class MyApp extends StatelessWidget { WeightScreen.routeName: (ctx) => WeightScreen(), WorkoutPlanScreen.routeName: (ctx) => WorkoutPlanScreen(), WorkoutPlansScreen.routeName: (ctx) => WorkoutPlansScreen(), + ExercisesScreen.routeName: (ctx) => const ExercisesScreen(), + ExerciseDetailScreen.routeName: (ctx) => const ExerciseDetailScreen(), + AddExerciseScreen.routeName: (ctx) => const AddExerciseScreen(), }, localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, diff --git a/lib/models/exercises/alias.dart b/lib/models/exercises/alias.dart new file mode 100644 index 000000000..842eb9f9a --- /dev/null +++ b/lib/models/exercises/alias.dart @@ -0,0 +1,43 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:json_annotation/json_annotation.dart'; + +part 'alias.g.dart'; + +@JsonSerializable() +class Alias { + @JsonKey(required: true) + final int? id; + + @JsonKey(required: true, name: 'exercise') + final int exerciseId; + + @JsonKey(required: true) + final String alias; + + Alias({ + this.id, + required this.exerciseId, + required this.alias, + }); + + // Boilerplate + factory Alias.fromJson(Map json) => _$AliasFromJson(json); + Map toJson() => _$AliasToJson(this); +} diff --git a/lib/models/exercises/alias.g.dart b/lib/models/exercises/alias.g.dart new file mode 100644 index 000000000..86eae28e2 --- /dev/null +++ b/lib/models/exercises/alias.g.dart @@ -0,0 +1,25 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'alias.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Alias _$AliasFromJson(Map json) { + $checkKeys( + json, + requiredKeys: const ['id', 'exercise', 'alias'], + ); + return Alias( + id: json['id'] as int?, + exerciseId: json['exercise'] as int, + alias: json['alias'] as String, + ); +} + +Map _$AliasToJson(Alias instance) => { + 'id': instance.id, + 'exercise': instance.exerciseId, + 'alias': instance.alias, + }; diff --git a/lib/models/exercises/base.dart b/lib/models/exercises/base.dart new file mode 100644 index 000000000..a91f1256d --- /dev/null +++ b/lib/models/exercises/base.dart @@ -0,0 +1,175 @@ +/* + * This file is part of wger Workout Manager . + * Copyright (C) 2020, 2021 wger Team + * + * wger Workout Manager is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; +import 'package:wger/helpers/consts.dart'; +import 'package:wger/models/exercises/category.dart'; +import 'package:wger/models/exercises/equipment.dart'; +import 'package:wger/models/exercises/exercise.dart'; +import 'package:wger/models/exercises/image.dart'; +import 'package:wger/models/exercises/muscle.dart'; +import 'package:wger/models/exercises/video.dart'; + +part 'base.g.dart'; + +@JsonSerializable(explicitToJson: true) +class ExerciseBase extends Equatable { + @JsonKey(required: true) + final int? id; + + @JsonKey(required: true) + final String? uuid; + + @JsonKey(required: true, name: 'variations') + final int? variationId; + + @JsonKey(required: true, name: 'creation_date') + final DateTime? creationDate; + + @JsonKey(required: true, name: 'update_date') + final DateTime? updateDate; + + @JsonKey(required: true, name: 'category') + late int categoryId; + + @JsonKey(ignore: true) + late final ExerciseCategory category; + + @JsonKey(required: true, name: 'muscles') + List musclesIds = []; + + @JsonKey(ignore: true) + List muscles = []; + + @JsonKey(required: true, name: 'muscles_secondary') + List musclesSecondaryIds = []; + + @JsonKey(ignore: true) + List musclesSecondary = []; + + @JsonKey(required: true, name: 'equipment') + List equipmentIds = []; + + @JsonKey(ignore: true) + List equipment = []; + + @JsonKey(ignore: true) + List images = []; + + @JsonKey(ignore: true) + List exercises = []; + + @JsonKey(ignore: true) + List