mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-17 16:07:51 +01:00
Cleanup
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"dart.lineLength": 100,
|
||||
"diffEditor.ignoreTrimWhitespace": true,
|
||||
"cmake.sourceDirectory": "/Users/ayush/flutter/linux",
|
||||
"diffEditor.ignoreTrimWhitespace": true
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1180,16 +1180,6 @@ class MockUserProvider extends _i1.Mock implements _i22.UserProvider {
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void changeUnit({dynamic changeTo = 'kg'}) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#changeUnit,
|
||||
[],
|
||||
{#changeTo: changeTo},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void setThemeMode(_i23.ThemeMode? mode) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
|
||||
@@ -592,16 +592,6 @@ class MockUserProvider extends _i1.Mock implements _i17.UserProvider {
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void changeUnit({dynamic changeTo = 'kg'}) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#changeUnit,
|
||||
[],
|
||||
{#changeTo: changeTo},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void setThemeMode(_i18.ThemeMode? mode) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in wger/test/providers/plate_weights_test.dart.
|
||||
// in wger/test/providers/plate_calculator_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
|
||||
@@ -22,6 +22,8 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart';
|
||||
import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart';
|
||||
import 'package:wger/helpers/json.dart';
|
||||
import 'package:wger/l10n/generated/app_localizations.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
@@ -52,6 +54,8 @@ void main() {
|
||||
final testExercises = getTestExercises();
|
||||
|
||||
Widget renderGymMode({locale = 'en'}) {
|
||||
SharedPreferencesAsyncPlatform.instance = InMemorySharedPreferencesAsync.empty();
|
||||
|
||||
return ChangeNotifierProvider<RoutinesProvider>(
|
||||
create: (context) => RoutinesProvider(
|
||||
mockBaseProvider,
|
||||
|
||||
@@ -339,16 +339,6 @@ class MockUserProvider extends _i1.Mock implements _i13.UserProvider {
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void changeUnit({dynamic changeTo = 'kg'}) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#changeUnit,
|
||||
[],
|
||||
{#changeTo: changeTo},
|
||||
),
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
|
||||
@override
|
||||
void setThemeMode(_i14.ThemeMode? mode) => super.noSuchMethod(
|
||||
Invocation.method(
|
||||
|
||||
Reference in New Issue
Block a user