This commit is contained in:
Roland Geider
2025-05-23 18:44:29 +02:00
parent f5decaf6a5
commit cce0b94edc
9 changed files with 30 additions and 70 deletions

View File

@@ -1,13 +0,0 @@
import 'package:flutter/material.dart';
class PlateConfiguration extends ChangeNotifier {
//olympic standard weights
List<double> _plateWeights = [1.25, 2.5, 5, 10, 15, 20, 25];
List<double> get plateWeights => _plateWeights;
void setPlateWeights(List<double> weights) {
_plateWeights = weights;
notifyListeners();
}
}

View File

@@ -90,20 +90,20 @@ void main() async {
await PreferenceHelper.instance.migrationSupportFunctionForSharedPreferences();
// Catch errors from Flutter itself (widget build, layout, paint, etc.)
// FlutterError.onError = (FlutterErrorDetails details) {
// final stack = details.stack ?? StackTrace.empty;
// if (kDebugMode) {
// FlutterError.dumpErrorToConsole(details);
// }
//
// // Don't show the full error dialog for network image loading errors.
// if (details.exception is NetworkImageLoadException) {
// return;
// }
//
// // showGeneralErrorDialog(details.exception, stack);
// throw details.exception;
// };
FlutterError.onError = (FlutterErrorDetails details) {
final stack = details.stack ?? StackTrace.empty;
if (kDebugMode) {
FlutterError.dumpErrorToConsole(details);
}
// Don't show the full error dialog for network image loading errors.
if (details.exception is NetworkImageLoadException) {
return;
}
showGeneralErrorDialog(details.exception, stack);
// throw details.exception;
};
// Catch errors that happen outside of the Flutter framework (e.g., in async operations)
PlatformDispatcher.instance.onError = (error, stack) {
@@ -114,8 +114,8 @@ void main() async {
if (error is WgerHttpException) {
showHttpExceptionErrorDialog(error);
} else {
// showGeneralErrorDialog(error, stack);
throw error;
showGeneralErrorDialog(error, stack);
// throw error;
}
// Return true to indicate that the error has been handled.

View File

@@ -45,14 +45,14 @@ class UserProvider with ChangeNotifier {
profile = null;
}
// change the unit of plates
void changeUnit({changeTo = 'kg'}) {
if (changeTo == 'kg') {
profile?.weightUnitStr = 'lb';
} else {
profile?.weightUnitStr = 'kg';
}
}
// // change the unit of plates
// void changeUnit({changeTo = 'kg'}) {
// if (changeTo == 'kg') {
// profile?.weightUnitStr = 'lb';
// } else {
// profile?.weightUnitStr = 'kg';
// }
// }
// Load theme mode from SharedPreferences
Future<void> _loadThemeMode() async {