Merge remote-tracking branch 'origin/master' into feature/offline-mode

This commit is contained in:
Roland Geider
2026-05-07 22:05:41 +02:00
89 changed files with 438 additions and 158 deletions

View File

@@ -9,7 +9,7 @@ runs:
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.41.6
flutter-version: 3.41.9
cache: true
- name: Install Flutter dependencies

33
.github/workflows/analyze.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Analyze
on:
push:
paths:
- '**.dart'
- 'pubspec.yaml'
- 'analysis_options.yaml'
pull_request:
branches: [ master, ]
paths:
- '**/*.dart'
- 'pubspec.yaml'
- 'analysis_options.yaml'
- '.github/actions/flutter-common/action.yml'
- '.github/workflows/analyze.yml'
workflow_call:
workflow_dispatch:
jobs:
analyze:
name: Run analyzer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Common flutter setup
uses: ./.github/actions/flutter-common
- name: Install dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze --no-fatal-infos --no-fatal-warnings

View File

@@ -1,6 +1,10 @@
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- '**/*.g.dart'
- '**/*.freezed.dart'
- '**/*.mocks.dart'
strong-mode:
implicit-casts: true # to be changed
implicit-dynamic: true # to be changed
@@ -14,15 +18,17 @@ analyzer:
# Allow self-reference to deprecated members (we do this because otherwise we have
# to annotate every member in every test, assert, etc, when we deprecate something)
deprecated_member_use_from_same_package: ignore
plugins:
- riverpod_lint
formatter:
page_width: 100
trailing_commas: preserve
# Note: it seems that adding riverpod_lint here has the side effect that every
# standard lint is reported twice. We are leaving this for now since the
# riverpod-specific checks are worth it.
# Use `dart analyze | sort -u` in scripts if duplicates are a problem.
plugins:
riverpod_lint: 3.1.0
riverpod_lint: 3.1.3
linter:
rules:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/splash"/>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/splash"/>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/splash"/>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

View File

@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
<item>
<bitmap android:gravity="fill" android:src="@drawable/background"/>
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/splash"/>
</item>
</layer-list>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#2a4c7d</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#ffffff</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -5,6 +5,10 @@
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your

BIN
assets/images/logo-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// ignore_for_file: avoid_print
import 'dart:io';
import 'package:drift/drift.dart';
@@ -23,12 +25,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import '1_dashboard.dart';
import '2_workout.dart';
import '3_gym_mode.dart';
import '4_measurements.dart';
import '5_nutritional_plan.dart';
import '6_weight.dart';
import 'screenshots_01_dashboard.dart';
import 'screenshots_02_workout.dart';
import 'screenshots_03_gym_mode.dart';
import 'screenshots_04_measurements.dart';
import 'screenshots_05_nutritional_plan.dart';
import 'screenshots_06_weight.dart';
/// Type of device
///
@@ -61,7 +63,7 @@ const _deviceArg = String.fromEnvironment('DEVICE_TYPE', defaultValue: 'androidP
// Determine the destination device type based on the provided argument
final DeviceType destination = DeviceType.values.firstWhere(
(d) => d.toString().split('.').last == _deviceArg || ((d.name ?? '') == _deviceArg),
(d) => d.name == _deviceArg,
orElse: () {
print('***** Unknown DEVICE_TYPE="$_deviceArg", defaulting to androidPhone *****');
return DeviceType.androidPhone;

View File

@@ -106,7 +106,7 @@ Widget createGymModeResultsScreen({String locale = 'en'}) {
gymStateProvider.overrideWithValue(
GymModeState(
routine: routine,
dayId: routine.days.first.id!,
dayId: routine.days.first.id,
iteration: 1,
showExercisePages: true,
showTimerPages: true,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "background.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "darkbackground.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

View File

@@ -1,23 +1,56 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "LaunchImageDark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LaunchImage@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "LaunchImageDark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "LaunchImage@3x.png",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "LaunchImageDark@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 B

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -16,13 +16,19 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" image="LaunchBackground" translatesAutoresizingMaskIntoConstraints="NO" id="tWc-Dq-wcI"/>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4"></imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="3T2-ad-Qdv"/>
<constraint firstItem="tWc-Dq-wcI" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="RPx-PI-7Xg"/>
<constraint firstItem="tWc-Dq-wcI" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="SdS-ul-q2q"/>
<constraint firstAttribute="trailing" secondItem="tWc-Dq-wcI" secondAttribute="trailing" id="Swv-Gf-Rwn"/>
<constraint firstAttribute="trailing" secondItem="YRO-k0-Ey4" secondAttribute="trailing" id="TQA-XW-tRk"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="duK-uY-Gun"/>
<constraint firstItem="tWc-Dq-wcI" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="kV7-tw-vXt"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="xPn-NY-SIU"/>
</constraints>
</view>
</viewController>
@@ -32,6 +38,7 @@
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
<image name="LaunchImage" width="512" height="512"/>
<image name="LaunchBackground" width="1" height="1"/>
</resources>
</document>

View File

@@ -1,72 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>wger</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Workout photos</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>wger</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Workout photos</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>FlutterSceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>FlutterSceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIStatusBarHidden</key>
<false/>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

View File

@@ -407,6 +407,7 @@ String _formatHeader(String key) {
/// Processes the error messages from the server and returns a list of widgets
List<Widget> formatApiErrors(List<ApiError> errors, {Color? color}) {
final logger = Logger('formatApiErrors');
final textColor = color ?? Colors.black;
final List<Widget> errorList = [];
@@ -419,7 +420,7 @@ List<Widget> formatApiErrors(List<ApiError> errors, {Color? color}) {
),
);
print(error.errorMessages);
logger.warning(error.errorMessages);
for (final message in error.errorMessages) {
errorList.add(Text(message, style: TextStyle(color: textColor)));
}

View File

@@ -1,9 +1,9 @@
/// This code is autogenerated in the backend repo in extract-i18n.py do not edit!
// 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).
// 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).
import 'package:flutter/widgets.dart';
import 'package:logging/logging.dart';

View File

@@ -39,7 +39,9 @@ String _bytesToUuid(Uint8List bytes) {
final sb = StringBuffer();
for (var i = 0; i < bytes.length; i++) {
sb.write(bytes[i].toRadixString(16).padLeft(2, '0'));
if (i == 3 || i == 5 || i == 7 || i == 9) sb.write('-');
if (i == 3 || i == 5 || i == 7 || i == 9) {
sb.write('-');
}
}
return sb.toString();
}

View File

@@ -1,3 +1,5 @@
// ignore_for_file: avoid_print
import 'dart:convert';
import 'dart:io';

View File

@@ -122,7 +122,7 @@ class Exercise extends Equatable {
(e) => e.languageObj.shortName == LANGUAGE_SHORT_ENGLISH,
orElse: () {
_logger.info(
'Could not find fallback english translation for exercise-ID ${id}, returning '
'Could not find fallback english translation for exercise-ID $id, returning '
'first language (${translations.first.languageObj.shortName}) instead.',
);
return translations.first;

View File

@@ -55,7 +55,7 @@ class BaseConfig {
required this.value,
this.operation = 'r',
this.step = 'abs',
this.requirements = null,
this.requirements,
});
BaseConfig.firstIteration(this.value, this.slotEntryId) {

View File

@@ -28,7 +28,7 @@ BaseConfig _$BaseConfigFromJson(Map<String, dynamic> json) {
value: stringOrIntToNum(json['value']),
operation: json['operation'] as String? ?? 'r',
step: json['step'] as String? ?? 'abs',
requirements: json['requirements'] as Map<String, dynamic>? ?? null,
requirements: json['requirements'] as Map<String, dynamic>?,
);
}

View File

@@ -170,8 +170,6 @@ class SlotPageEntry {
}
class GymModeState {
final _logger = Logger('GymModeState');
// Navigation data
final bool isInitialized;

View File

@@ -21,8 +21,6 @@ final plateCalculatorProvider = NotifierProvider<PlateCalculatorNotifier, PlateC
);
class PlateCalculatorState {
final _logger = Logger('PlateWeightsState');
// https://en.wikipedia.org/wiki/Barbell#Bumper_plates
final Map<double, Color> plateColorMapKg = {
25: Colors.red,

View File

@@ -271,7 +271,9 @@ class _AddExerciseStepperState extends ConsumerState<AddExerciseStepper> {
language.shortName,
);
if (!mounted) return;
if (!mounted) {
return;
}
if (error != null) {
setState(() {

View File

@@ -37,7 +37,7 @@ class _AddExerciseDropdownButtonState extends State<AddExerciseDropdownButton> {
});
widget.onChange(value);
},
value: _selectedItem,
initialValue: _selectedItem,
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
border: const OutlineInputBorder(

View File

@@ -119,7 +119,9 @@ class _MarkdownEditorState extends State<MarkdownEditor> {
// Notify parent and rebuild preview on every controller change.
_controller.addListener(() {
widget.onChanged(_controller.text);
if (mounted) setState(() {});
if (mounted) {
setState(() {});
}
});
}
@@ -164,7 +166,9 @@ class _MarkdownEditorState extends State<MarkdownEditor> {
Widget _buildToolbar() {
final i18n = AppLocalizations.of(context);
if (!widget.showToolbar || widget.readOnly) return const SizedBox.shrink();
if (!widget.showToolbar || widget.readOnly) {
return const SizedBox.shrink();
}
return Row(
children: [
IconButton(

View File

@@ -11,7 +11,7 @@ import 'package:wger/l10n/generated/app_localizations.dart';
/// Being a separate widget allows Flutter to optimize rendering since
/// this content never changes.
class LicenseInfoWidget extends StatelessWidget {
const LicenseInfoWidget({Key? key}) : super(key: key);
const LicenseInfoWidget({super.key});
@override
Widget build(BuildContext context) {

View File

@@ -68,7 +68,7 @@ class PreviewExerciseImages extends ConsumerWidget {
color: Colors.white,
iconSize: 20,
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.6),
backgroundColor: Colors.black.withValues(alpha: 0.6),
padding: const EdgeInsets.all(4),
),
onPressed: () {
@@ -89,7 +89,7 @@ class PreviewExerciseImages extends ConsumerWidget {
height: 120,
margin: const EdgeInsets.only(right: 8),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceVariant,
color: Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Theme.of(context).colorScheme.outline,

View File

@@ -50,7 +50,7 @@ class Pill extends StatelessWidget {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 7),
decoration: BoxDecoration(
color: Theme.of(context).primaryColorLight.withOpacity(0.15),
color: Theme.of(context).primaryColorLight.withValues(alpha: 0.15),
border: Border.all(color: Colors.grey[300]!),
borderRadius: BorderRadius.circular(5),
),

View File

@@ -117,8 +117,8 @@ class _DashboardMeasurementWidgetState extends ConsumerState<DashboardMeasuremen
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).textTheme.headlineSmall!.color!
.withOpacity(
_current == entry.key ? 0.9 : 0.4,
.withValues(
alpha: _current == entry.key ? 0.9 : 0.4,
),
),
),

View File

@@ -27,17 +27,15 @@ class ExerciseCategoryInputWidget<T> extends StatefulWidget {
late final List<T> _entries;
late final Function _getDisplayName;
late final Function? _validator;
late final Key? _key;
ExerciseCategoryInputWidget({
Key? key,
super.key,
required String title,
required List<T> entries,
required Function callback,
required Function displayName,
Function? validator,
}) {
_key = key;
_entries = entries;
_title = title;
_callback = callback;
@@ -58,7 +56,7 @@ class _ExerciseCategoryInputWidgetState<T> extends State<ExerciseCategoryInputWi
padding: const EdgeInsets.all(8.0),
child: DropdownButtonFormField(
key: widget.key,
value: selectedEntry,
initialValue: selectedEntry,
decoration: InputDecoration(
labelText: widget._title,
contentPadding: const EdgeInsets.all(8.0),

View File

@@ -40,10 +40,9 @@ class MeasurementOverallChangeWidget extends StatelessWidget {
prefix = '-';
}
// ignore: prefer_interpolation_to_compose_strings
return Text(
AppLocalizations.of(context).overallChangeWeight +
' $prefix${delta.abs().toStringAsFixed(1)} $_unit',
'${AppLocalizations.of(context).overallChangeWeight} '
'$prefix${delta.abs().toStringAsFixed(1)} $_unit',
);
}
}

View File

@@ -397,7 +397,7 @@ class NutritionalDiaryChartWidgetFlState extends State<NutritionalDiaryChartWidg
child: BarChart(
BarChartData(
alignment: BarChartAlignment.center,
barTouchData: BarTouchData(enabled: false),
barTouchData: const BarTouchData(enabled: false),
titlesData: FlTitlesData(
show: true,
bottomTitles: AxisTitles(
@@ -532,7 +532,7 @@ class MealDiaryBarChartWidgetState extends State<MealDiaryBarChartWidget> {
return BarChart(
BarChartData(
alignment: BarChartAlignment.center,
barTouchData: BarTouchData(enabled: false),
barTouchData: const BarTouchData(enabled: false),
titlesData: FlTitlesData(
show: true,
bottomTitles: AxisTitles(

View File

@@ -83,7 +83,7 @@ class NutriScoreBadge extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: isActive ? dim.activePx : dim.px),
margin: EdgeInsets.symmetric(horizontal: isActive ? dim.activePx : 0),
decoration: BoxDecoration(
color: (_nutriScoreColors[s] ?? Colors.grey).withOpacity(isActive ? 1.0 : 0.4),
color: (_nutriScoreColors[s] ?? Colors.grey).withValues(alpha: isActive ? 1.0 : 0.4),
borderRadius: BorderRadius.horizontal(
left: isFirst ? Radius.circular(h / 2) : Radius.zero,
right: isLast ? Radius.circular(h / 2) : Radius.zero,

View File

@@ -32,8 +32,8 @@ class NutritionTile extends StatelessWidget {
Expanded(
child: Column(
children: [
if (title != null) title!,
if (subtitle != null) subtitle!,
?title,
?subtitle,
],
),
),

View File

@@ -27,9 +27,8 @@ import 'package:wger/models/workouts/log.dart';
class LogChartWidgetFl extends StatefulWidget {
final Map<num, List<Log>> _data;
final DateTime _currentDate;
const LogChartWidgetFl(this._data, this._currentDate);
const LogChartWidgetFl(this._data);
@override
State<LogChartWidgetFl> createState() => _LogChartWidgetFlState();

View File

@@ -47,7 +47,9 @@ class _TimerWidgetState extends State<TimerWidget> {
_uiTimer = Timer.periodic(const Duration(seconds: 1), (_) {
// ignore: no-empty-block, avoid-empty-setstate
if (mounted) setState(() {});
if (mounted) {
setState(() {});
}
});
}
@@ -109,7 +111,9 @@ class _TimerCountdownWidgetState extends ConsumerState<TimerCountdownWidget> {
_uiTimer = Timer.periodic(const Duration(seconds: 1), (_) {
// ignore: no-empty-block, avoid-empty-setstate
if (mounted) setState(() {});
if (mounted) {
setState(() {});
}
});
}

View File

@@ -415,7 +415,7 @@ class WorkoutMenuDialog extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final gymState = ref.watch(gymStateProvider);
final endWorkoutButton = true
final endWorkoutButton = showEndWorkoutButton
? TextButton(
child: Text(AppLocalizations.of(context).endWorkout),
onPressed: () {

View File

@@ -127,7 +127,6 @@ class DayLogWidget extends ConsumerWidget {
filterNullReps: true,
filterNullWeights: true,
),
_date,
),
),
],

View File

@@ -25,9 +25,8 @@ import 'package:wger/widgets/routines/charts.dart';
class ExerciseLogChart extends StatelessWidget {
final Map<num, List<Log>> _logs;
final DateTime _selectedDate;
const ExerciseLogChart(this._logs, this._selectedDate);
const ExerciseLogChart(this._logs);
@override
Widget build(BuildContext context) {
@@ -36,7 +35,7 @@ class ExerciseLogChart extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.max,
children: [
LogChartWidgetFl(_logs, _selectedDate),
LogChartWidgetFl(_logs),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(

View File

@@ -1,5 +1,5 @@
# Project-level configuration.
cmake_minimum_required(VERSION 3.10)
cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
@@ -60,25 +60,8 @@ add_subdirectory(${FLUTTER_MANAGED_DIR})
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Define the application target. To change its name, change BINARY_NAME above,
# not the value here, or `flutter run` will no longer work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Add dependency libraries. Add any application-specific dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
# Application build; see runner/CMakeLists.txt.
add_subdirectory("runner")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)

View File

@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# Define the application target. To change its name, change BINARY_NAME in the
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Add preprocessor definitions for the application ID.
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Add dependency libraries. Add any application-specific dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")

View File

@@ -81,6 +81,24 @@ static gboolean my_application_local_command_line(GApplication* application, gch
return TRUE;
}
// Implements GApplication::startup.
static void my_application_startup(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application startup.
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
}
// Implements GApplication::shutdown.
static void my_application_shutdown(GApplication* application) {
//MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application shutdown.
G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
}
// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MyApplication* self = MY_APPLICATION(object);
@@ -91,12 +109,20 @@ static void my_application_dispose(GObject* object) {
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
// Set the program name to the application ID, which helps various systems
// like GTK and desktop environments map this running application to its
// corresponding .desktop file. This ensures better integration by allowing
// the application to be recognized beyond its binary name.
g_set_prgname(APPLICATION_ID);
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID,
"flags", G_APPLICATION_NON_UNIQUE,

View File

@@ -25,6 +25,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.0"
ansicolor:
dependency: transitive
description:
name: ansicolor
sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f"
url: "https://pub.dev"
source: hosted
version: "2.0.3"
archive:
dependency: transitive
description:
@@ -504,6 +512,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_native_splash:
dependency: "direct dev"
description:
name: flutter_native_splash
sha256: "4fb9f4113350d3a80841ce05ebf1976a36de622af7d19aca0ca9a9911c7ff002"
url: "https://pub.dev"
source: hosted
version: "2.4.7"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
@@ -1473,6 +1489,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.4.0"
universal_io:
dependency: transitive
description:
name: universal_io
sha256: f63cbc48103236abf48e345e07a03ce5757ea86285ed313a6a032596ed9301e2
url: "https://pub.dev"
source: hosted
version: "2.3.1"
url_launcher:
dependency: "direct main"
description:

View File

@@ -85,6 +85,7 @@ dev_dependencies:
connectivity_plus_platform_interface: ^2.1.0
drift_dev: ^2.31.0
flutter_lints: ^6.0.0
flutter_native_splash: ^2.4.7
freezed: ^3.2.0
json_serializable: ^6.13.0
mockito: ^5.6.4
@@ -135,3 +136,19 @@ flutter:
# see https://flutter.dev/custom-fonts/#from-packages
generate: true
# Native splash screen configuration. Regenerate with:
# dart run flutter_native_splash:create
flutter_native_splash:
color: "#ffffff"
image: assets/images/logo-512.png
color_dark: "#2a4c7d"
image_dark: assets/images/logo-white.png
android_12:
color: "#ffffff"
image: assets/images/logo-512.png
color_dark: "#2a4c7d"
image_dark: assets/images/logo-white.png
android: true
ios: true
web: false

View File

@@ -1,3 +1,5 @@
// ignore_for_file: avoid_print
import 'dart:io';
import 'package:integration_test/integration_test_driver_extended.dart';