mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-30 01:41:05 +01:00
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"@@last_modified": "2020-11-11T15:04:05.523531",
|
||||
"userProfile": "User profile",
|
||||
"login": "Log in",
|
||||
"@login": {
|
||||
"description": "Text for login button"
|
||||
@@ -577,6 +578,14 @@
|
||||
},
|
||||
"description": "List of alternative names for an exercise"
|
||||
},
|
||||
"verifiedEmail": "Verified 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?",
|
||||
|
||||
@@ -26,6 +26,7 @@ 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';
|
||||
@@ -94,6 +95,12 @@ class MyApp extends StatelessWidget {
|
||||
update: (context, base, previous) =>
|
||||
previous ?? MeasurementProvider(WgerBaseProvider(base)),
|
||||
),
|
||||
ChangeNotifierProxyProvider<AuthProvider, UserProvider>(
|
||||
create: (context) => UserProvider(
|
||||
WgerBaseProvider(Provider.of<AuthProvider>(context, listen: false)),
|
||||
),
|
||||
update: (context, base, previous) => previous ?? UserProvider(WgerBaseProvider(base)),
|
||||
),
|
||||
ChangeNotifierProxyProvider<AuthProvider, BodyWeightProvider>(
|
||||
create: (context) =>
|
||||
BodyWeightProvider(Provider.of<AuthProvider>(context, listen: false), []),
|
||||
|
||||
43
lib/models/user/profile.dart
Normal file
43
lib/models/user/profile.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* 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.
|
||||
*
|
||||
* wger Workout Manager 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'profile.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Profile {
|
||||
@JsonKey(required: true)
|
||||
int id;
|
||||
|
||||
@JsonKey(required: true, name: 'email_verified')
|
||||
bool emailVerified;
|
||||
|
||||
@JsonKey(required: true)
|
||||
String email;
|
||||
|
||||
Profile({
|
||||
required this.id,
|
||||
required this.emailVerified,
|
||||
required this.email,
|
||||
});
|
||||
|
||||
// Boilerplate
|
||||
factory Profile.fromJson(Map<String, dynamic> json) => _$ProfileFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$ProfileToJson(this);
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
ExercisesProvider(this.baseProvider);
|
||||
|
||||
static const EXERCISE_CACHE_DAYS = 7;
|
||||
static const CACHE_VERSION = 3;
|
||||
static const CACHE_VERSION = 4;
|
||||
static const daysToCache = 7;
|
||||
|
||||
static const _exerciseBaseInfoUrlPath = 'exercisebaseinfo';
|
||||
|
||||
64
lib/providers/user.dart
Normal file
64
lib/providers/user.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
|
||||
class UserProvider with ChangeNotifier {
|
||||
final WgerBaseProvider baseProvider;
|
||||
UserProvider(this.baseProvider);
|
||||
|
||||
static const _profileUrlPath = 'userprofile';
|
||||
static const _verifyEmail = 'verify-email';
|
||||
|
||||
Profile? _profile;
|
||||
|
||||
Profile? get profile => _profile;
|
||||
set profile(Profile? profile) {
|
||||
_profile = profile;
|
||||
}
|
||||
|
||||
int get userId => _profile!.id;
|
||||
|
||||
/// Clear the current profile
|
||||
void clear() {
|
||||
_profile = null;
|
||||
}
|
||||
|
||||
/// Fetch the current user's profile
|
||||
Future<void> fetchAndSetProfile() async {
|
||||
final userData = await baseProvider.fetch(baseProvider.makeUrl(_profileUrlPath));
|
||||
try {
|
||||
_profile = Profile.fromJson(userData['results'][0]);
|
||||
} catch (error) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
/// Verify the user's email
|
||||
Future<void> verifyEmail() async {
|
||||
final userData = await baseProvider.fetch(baseProvider.makeUrl(
|
||||
_profileUrlPath,
|
||||
id: userId,
|
||||
objectMethod: _verifyEmail,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ 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/dashboard.dart';
|
||||
import 'package:wger/screens/gallery_screen.dart';
|
||||
@@ -72,18 +73,20 @@ class _HomeTabsScreenState extends State<HomeTabsScreen> with SingleTickerProvid
|
||||
/// Load initial data from the server
|
||||
Future<void> _loadEntries() async {
|
||||
if (!Provider.of<AuthProvider>(context, listen: false).dataInit) {
|
||||
Provider.of<AuthProvider>(context, listen: false).setServerVersion();
|
||||
|
||||
final workoutPlansProvider = Provider.of<WorkoutPlansProvider>(context, listen: false);
|
||||
final nutritionPlansProvider = Provider.of<NutritionPlansProvider>(context, listen: false);
|
||||
final exercisesProvider = Provider.of<ExercisesProvider>(context, listen: false);
|
||||
final galleryProvider = Provider.of<GalleryProvider>(context, listen: false);
|
||||
final weightProvider = Provider.of<BodyWeightProvider>(context, listen: false);
|
||||
final measurementProvider = Provider.of<MeasurementProvider>(context, listen: false);
|
||||
final authProvider = context.read<AuthProvider>();
|
||||
final workoutPlansProvider = context.read<WorkoutPlansProvider>();
|
||||
final nutritionPlansProvider = context.read<NutritionPlansProvider>();
|
||||
final exercisesProvider = context.read<ExercisesProvider>();
|
||||
final galleryProvider = context.read<GalleryProvider>();
|
||||
final weightProvider = context.read<BodyWeightProvider>();
|
||||
final measurementProvider = context.read<MeasurementProvider>();
|
||||
final userProvider = context.read<UserProvider>();
|
||||
|
||||
// Base data
|
||||
log('Loading base data');
|
||||
await Future.wait([
|
||||
authProvider.setServerVersion(),
|
||||
userProvider.fetchAndSetProfile(),
|
||||
workoutPlansProvider.fetchAndSetUnits(),
|
||||
nutritionPlansProvider.fetchIngredientsFromCache(),
|
||||
exercisesProvider.fetchAndSetExercises(),
|
||||
@@ -115,7 +118,7 @@ class _HomeTabsScreenState extends State<HomeTabsScreen> with SingleTickerProvid
|
||||
}
|
||||
}
|
||||
|
||||
Provider.of<AuthProvider>(context, listen: false).dataInit = true;
|
||||
context.read<AuthProvider>().dataInit = true;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -24,8 +24,11 @@ import 'package:wger/providers/auth.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
import 'package:wger/providers/gallery.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
import 'package:wger/providers/user.dart';
|
||||
import 'package:wger/providers/workout_plans.dart';
|
||||
import 'package:wger/screens/form_screen.dart';
|
||||
import 'package:wger/widgets/core/about.dart';
|
||||
import 'package:wger/widgets/user/forms.dart';
|
||||
|
||||
class MainAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
final String _title;
|
||||
@@ -57,22 +60,40 @@ class MainAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
//dense: true,
|
||||
leading: const Icon(Icons.person),
|
||||
title: Text(AppLocalizations.of(context).userProfile),
|
||||
onTap: () async {
|
||||
await context.read<UserProvider>().fetchAndSetProfile();
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
FormScreen.routeName,
|
||||
arguments: FormScreenArguments(
|
||||
AppLocalizations.of(context).userProfile,
|
||||
UserProfileForm(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
WgerAboutListTile(),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
//dense: true,
|
||||
leading: const Icon(Icons.exit_to_app),
|
||||
title: Text(AppLocalizations.of(context).logout),
|
||||
onTap: () {
|
||||
Provider.of<AuthProvider>(context, listen: false).logout();
|
||||
Provider.of<WorkoutPlansProvider>(context, listen: false).clear();
|
||||
Provider.of<NutritionPlansProvider>(context, listen: false).clear();
|
||||
Provider.of<BodyWeightProvider>(context, listen: false).clear();
|
||||
Provider.of<GalleryProvider>(context, listen: false).clear();
|
||||
context.read<AuthProvider>().logout();
|
||||
context.read<WorkoutPlansProvider>().clear();
|
||||
context.read<NutritionPlansProvider>().clear();
|
||||
context.read<BodyWeightProvider>().clear();
|
||||
context.read<GalleryProvider>().clear();
|
||||
context.read<UserProvider>().clear();
|
||||
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushReplacementNamed('/');
|
||||
},
|
||||
),
|
||||
WgerAboutListTile()
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
96
lib/widgets/user/forms.dart
Normal file
96
lib/widgets/user/forms.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* 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.
|
||||
*
|
||||
* wger Workout Manager 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/models/user/profile.dart';
|
||||
import 'package:wger/providers/user.dart';
|
||||
|
||||
class UserProfileForm extends StatefulWidget {
|
||||
late Profile _profile;
|
||||
|
||||
UserProfileForm() {
|
||||
//_weightEntry = weightEntry ?? WeightEntry(date: DateTime.now());
|
||||
//weightController.text = _weightEntry.id == null ? '' : _weightEntry.weight.toString();
|
||||
//dateController.text = toDate(_weightEntry.date)!;
|
||||
}
|
||||
|
||||
@override
|
||||
State<UserProfileForm> createState() => _UserProfileFormState();
|
||||
}
|
||||
|
||||
class _UserProfileFormState extends State<UserProfileForm> {
|
||||
final _form = GlobalKey<FormState>();
|
||||
|
||||
final dateController = TextEditingController();
|
||||
|
||||
final weightController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
widget._profile = context.read<UserProvider>().profile!;
|
||||
|
||||
return Form(
|
||||
key: _form,
|
||||
child: Column(
|
||||
children: [
|
||||
// Weight date
|
||||
SwitchListTile(
|
||||
title: Text(AppLocalizations.of(context).verifiedEmail),
|
||||
subtitle: Text(AppLocalizations.of(context).verifiedEmailReason),
|
||||
value: widget._profile.emailVerified,
|
||||
onChanged: (bool value) async {
|
||||
// Email is already verified
|
||||
if (widget._profile.emailVerified) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify
|
||||
await context.read<UserProvider>().verifyEmail();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context).verifiedEmailInfo(widget._profile.email),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ElevatedButton(
|
||||
child: Text(AppLocalizations.of(context).save),
|
||||
onPressed: () async {
|
||||
// Validate and save the current values to the weightEntry
|
||||
final isValid = _form.currentState!.validate();
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
_form.currentState!.save();
|
||||
|
||||
// Update profile
|
||||
//context.read<UserProvider>().updateProfile();
|
||||
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
36
test/fixtures/user/userprofile_response.json
vendored
Normal file
36
test/fixtures/user/userprofile_response.json
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"count": 1,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"id": 42,
|
||||
"email": "me@example.com",
|
||||
"email_verified": false,
|
||||
"gym": 1,
|
||||
"is_temporary": false,
|
||||
"show_comments": false,
|
||||
"show_english_ingredients": false,
|
||||
"workout_reminder_active": false,
|
||||
"workout_reminder": 14,
|
||||
"workout_duration": 12,
|
||||
"last_workout_notification": null,
|
||||
"notification_language": 2,
|
||||
"age": null,
|
||||
"birthdate": null,
|
||||
"height": null,
|
||||
"gender": "1",
|
||||
"sleep_hours": 7,
|
||||
"work_hours": 8,
|
||||
"work_intensity": "1",
|
||||
"sport_hours": 3,
|
||||
"sport_intensity": "2",
|
||||
"freetime_hours": 8,
|
||||
"freetime_intensity": "1",
|
||||
"calories": 2500,
|
||||
"weight_unit": "kg",
|
||||
"ro_access": false,
|
||||
"num_days_weight_reminder": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
94
test/user/provider_test.dart
Normal file
94
test/user/provider_test.dart
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* 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.
|
||||
*
|
||||
* wger Workout Manager 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:wger/providers/user.dart';
|
||||
|
||||
import '../fixtures/fixture_reader.dart';
|
||||
import '../measurements/measurement_provider_test.mocks.dart';
|
||||
|
||||
void main() {
|
||||
late UserProvider userProvider;
|
||||
late MockWgerBaseProvider mockWgerBaseProvider;
|
||||
|
||||
const String profileUrl = 'userprofile';
|
||||
final Map<String, dynamic> tUserProfileMap =
|
||||
jsonDecode(fixture('user/userprofile_response.json'));
|
||||
final Uri tProfileUri = Uri(
|
||||
scheme: 'http',
|
||||
host: 'localhost',
|
||||
path: 'api/v2/$profileUrl/',
|
||||
);
|
||||
final Uri tEmailVerifyUri = Uri(
|
||||
scheme: 'http',
|
||||
host: 'localhost',
|
||||
path: 'api/v2/$profileUrl/verify-email',
|
||||
);
|
||||
|
||||
setUp(() {
|
||||
mockWgerBaseProvider = MockWgerBaseProvider();
|
||||
userProvider = UserProvider(mockWgerBaseProvider);
|
||||
|
||||
when(mockWgerBaseProvider.makeUrl(any)).thenReturn(tProfileUri);
|
||||
when(mockWgerBaseProvider.makeUrl(any, id: 42, objectMethod: 'verify-email'))
|
||||
.thenReturn(tEmailVerifyUri);
|
||||
when(mockWgerBaseProvider.fetch(any))
|
||||
.thenAnswer((realInvocation) => Future.value(tUserProfileMap));
|
||||
});
|
||||
|
||||
group('house keeping', () {
|
||||
test('should clear the profile list with clear()', () async {
|
||||
// arrange
|
||||
await userProvider.fetchAndSetProfile();
|
||||
|
||||
// assert
|
||||
expect(userProvider.profile, isNot(null));
|
||||
expect(userProvider.profile!.id, 42);
|
||||
|
||||
// act
|
||||
userProvider.clear();
|
||||
|
||||
// assert
|
||||
expect(userProvider.profile, null);
|
||||
});
|
||||
});
|
||||
|
||||
group('profile', () {
|
||||
test('Loading the profile from the server works', () async {
|
||||
// arrange
|
||||
await userProvider.fetchAndSetProfile();
|
||||
|
||||
// assert
|
||||
expect(userProvider.profile!.id, 42);
|
||||
expect(userProvider.profile!.emailVerified, false);
|
||||
expect(userProvider.profile!.email, 'me@example.com');
|
||||
});
|
||||
|
||||
test('Sending the verify email works', () async {
|
||||
// arrange
|
||||
await userProvider.fetchAndSetProfile();
|
||||
await userProvider.verifyEmail();
|
||||
|
||||
// assert
|
||||
verify(userProvider.baseProvider.fetch(tEmailVerifyUri));
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -24,11 +24,13 @@ import 'package:wger/providers/exercises.dart' as _i8;
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider {}
|
||||
class _FakeWgerBaseProvider_0 extends _i1.Fake implements _i2.WgerBaseProvider {
|
||||
}
|
||||
|
||||
class _FakeExerciseBase_1 extends _i1.Fake implements _i3.ExerciseBase {}
|
||||
|
||||
class _FakeExerciseCategory_2 extends _i1.Fake implements _i4.ExerciseCategory {}
|
||||
class _FakeExerciseCategory_2 extends _i1.Fake implements _i4.ExerciseCategory {
|
||||
}
|
||||
|
||||
class _FakeEquipment_3 extends _i1.Fake implements _i5.Equipment {}
|
||||
|
||||
@@ -46,8 +48,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
|
||||
@override
|
||||
_i2.WgerBaseProvider get baseProvider =>
|
||||
(super.noSuchMethod(Invocation.getter(#baseProvider), returnValue: _FakeWgerBaseProvider_0())
|
||||
as _i2.WgerBaseProvider);
|
||||
(super.noSuchMethod(Invocation.getter(#baseProvider),
|
||||
returnValue: _FakeWgerBaseProvider_0()) as _i2.WgerBaseProvider);
|
||||
@override
|
||||
set exerciseBases(List<_i3.ExerciseBase>? exercisesBases) =>
|
||||
super.noSuchMethod(Invocation.setter(#exerciseBases, exercisesBases),
|
||||
@@ -58,57 +60,65 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValue: <_i3.ExerciseBase>[]) as List<_i3.ExerciseBase>);
|
||||
@override
|
||||
set filteredExerciseBases(List<_i3.ExerciseBase>? newFilteredExercises) =>
|
||||
super.noSuchMethod(Invocation.setter(#filteredExerciseBases, newFilteredExercises),
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(#filteredExerciseBases, newFilteredExercises),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
Map<int, List<_i3.ExerciseBase>> get exerciseBasesByVariation =>
|
||||
(super.noSuchMethod(Invocation.getter(#exerciseBasesByVariation),
|
||||
returnValue: <int, List<_i3.ExerciseBase>>{}) as Map<int, List<_i3.ExerciseBase>>);
|
||||
returnValue: <int, List<_i3.ExerciseBase>>{})
|
||||
as Map<int, List<_i3.ExerciseBase>>);
|
||||
@override
|
||||
List<_i3.ExerciseBase> get bases =>
|
||||
(super.noSuchMethod(Invocation.getter(#bases), returnValue: <_i3.ExerciseBase>[])
|
||||
as List<_i3.ExerciseBase>);
|
||||
(super.noSuchMethod(Invocation.getter(#bases),
|
||||
returnValue: <_i3.ExerciseBase>[]) as List<_i3.ExerciseBase>);
|
||||
@override
|
||||
List<_i4.ExerciseCategory> get categories =>
|
||||
(super.noSuchMethod(Invocation.getter(#categories), returnValue: <_i4.ExerciseCategory>[])
|
||||
as List<_i4.ExerciseCategory>);
|
||||
(super.noSuchMethod(Invocation.getter(#categories),
|
||||
returnValue: <_i4.ExerciseCategory>[]) as List<_i4.ExerciseCategory>);
|
||||
@override
|
||||
List<_i6.Muscle> get muscles =>
|
||||
(super.noSuchMethod(Invocation.getter(#muscles), returnValue: <_i6.Muscle>[])
|
||||
as List<_i6.Muscle>);
|
||||
(super.noSuchMethod(Invocation.getter(#muscles),
|
||||
returnValue: <_i6.Muscle>[]) as List<_i6.Muscle>);
|
||||
@override
|
||||
List<_i5.Equipment> get equipment =>
|
||||
(super.noSuchMethod(Invocation.getter(#equipment), returnValue: <_i5.Equipment>[])
|
||||
as List<_i5.Equipment>);
|
||||
(super.noSuchMethod(Invocation.getter(#equipment),
|
||||
returnValue: <_i5.Equipment>[]) as List<_i5.Equipment>);
|
||||
@override
|
||||
List<_i7.Language> get languages =>
|
||||
(super.noSuchMethod(Invocation.getter(#languages), returnValue: <_i7.Language>[])
|
||||
as List<_i7.Language>);
|
||||
(super.noSuchMethod(Invocation.getter(#languages),
|
||||
returnValue: <_i7.Language>[]) as List<_i7.Language>);
|
||||
@override
|
||||
set languages(List<_i7.Language>? languages) =>
|
||||
super.noSuchMethod(Invocation.setter(#languages, languages),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
bool get hasListeners =>
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool);
|
||||
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false)
|
||||
as bool);
|
||||
@override
|
||||
_i9.Future<void> setFilters(_i8.Filters? newFilters) =>
|
||||
(super.noSuchMethod(Invocation.method(#setFilters, [newFilters]),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<void> findByFilters() => (super.noSuchMethod(Invocation.method(#findByFilters, []),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i9.Future<void>);
|
||||
_i9.Future<void> findByFilters() =>
|
||||
(super.noSuchMethod(Invocation.method(#findByFilters, []),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i9.Future<void>);
|
||||
@override
|
||||
void clear() =>
|
||||
super.noSuchMethod(Invocation.method(#clear, []), returnValueForMissingStub: null);
|
||||
void clear() => super.noSuchMethod(Invocation.method(#clear, []),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
_i3.ExerciseBase findExerciseBaseById(int? id) =>
|
||||
(super.noSuchMethod(Invocation.method(#findExerciseBaseById, [id]),
|
||||
returnValue: _FakeExerciseBase_1()) as _i3.ExerciseBase);
|
||||
@override
|
||||
List<_i3.ExerciseBase> findExerciseBasesByVariationId(int? id,
|
||||
{int? exerciseBaseIdToExclude, int? languageId}) =>
|
||||
{int? exerciseBaseIdToExclude}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#findExerciseBasesByVariationId, [id],
|
||||
{#exerciseIdToExclude: exerciseBaseIdToExclude, #languageId: languageId}),
|
||||
{#exerciseBaseIdToExclude: exerciseBaseIdToExclude}),
|
||||
returnValue: <_i3.ExerciseBase>[]) as List<_i3.ExerciseBase>);
|
||||
@override
|
||||
_i4.ExerciseCategory findCategoryById(int? id) =>
|
||||
@@ -120,12 +130,12 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValue: _FakeEquipment_3()) as _i5.Equipment);
|
||||
@override
|
||||
_i6.Muscle findMuscleById(int? id) =>
|
||||
(super.noSuchMethod(Invocation.method(#findMuscleById, [id]), returnValue: _FakeMuscle_4())
|
||||
as _i6.Muscle);
|
||||
(super.noSuchMethod(Invocation.method(#findMuscleById, [id]),
|
||||
returnValue: _FakeMuscle_4()) as _i6.Muscle);
|
||||
@override
|
||||
_i7.Language findLanguageById(int? id) => (super
|
||||
.noSuchMethod(Invocation.method(#findLanguageById, [id]), returnValue: _FakeLanguage_5())
|
||||
as _i7.Language);
|
||||
_i7.Language findLanguageById(int? id) =>
|
||||
(super.noSuchMethod(Invocation.method(#findLanguageById, [id]),
|
||||
returnValue: _FakeLanguage_5()) as _i7.Language);
|
||||
@override
|
||||
_i9.Future<void> fetchAndSetCategories() =>
|
||||
(super.noSuchMethod(Invocation.method(#fetchAndSetCategories, []),
|
||||
@@ -153,12 +163,15 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValueForMissingStub: Future<void>.value()) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<_i3.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) =>
|
||||
(super.noSuchMethod(Invocation.method(#fetchAndSetExerciseBase, [exerciseBaseId]),
|
||||
returnValue: Future<_i3.ExerciseBase>.value(_FakeExerciseBase_1()))
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchAndSetExerciseBase, [exerciseBaseId]),
|
||||
returnValue:
|
||||
Future<_i3.ExerciseBase>.value(_FakeExerciseBase_1()))
|
||||
as _i9.Future<_i3.ExerciseBase>);
|
||||
@override
|
||||
_i3.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) =>
|
||||
(super.noSuchMethod(Invocation.method(#readExerciseBaseFromBaseInfo, [baseData]),
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#readExerciseBaseFromBaseInfo, [baseData]),
|
||||
returnValue: _FakeExerciseBase_1()) as _i3.ExerciseBase);
|
||||
@override
|
||||
_i9.Future<void> checkExerciseCacheVersion() =>
|
||||
@@ -171,21 +184,26 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<List<_i3.ExerciseBase>> searchExercise(String? name, [String? languageCode = r'en']) =>
|
||||
(super.noSuchMethod(Invocation.method(#searchExercise, [name, languageCode]),
|
||||
returnValue: Future<List<_i3.ExerciseBase>>.value(<_i3.ExerciseBase>[]))
|
||||
_i9.Future<List<_i3.ExerciseBase>> searchExercise(String? name,
|
||||
[String? languageCode = r'en']) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#searchExercise, [name, languageCode]),
|
||||
returnValue:
|
||||
Future<List<_i3.ExerciseBase>>.value(<_i3.ExerciseBase>[]))
|
||||
as _i9.Future<List<_i3.ExerciseBase>>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) => super
|
||||
.noSuchMethod(Invocation.method(#addListener, [listener]), returnValueForMissingStub: null);
|
||||
void addListener(_i10.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
void removeListener(_i10.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#removeListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
void dispose() =>
|
||||
super.noSuchMethod(Invocation.method(#dispose, []), returnValueForMissingStub: null);
|
||||
void dispose() => super.noSuchMethod(Invocation.method(#dispose, []),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
void notifyListeners() =>
|
||||
super.noSuchMethod(Invocation.method(#notifyListeners, []), returnValueForMissingStub: null);
|
||||
super.noSuchMethod(Invocation.method(#notifyListeners, []),
|
||||
returnValueForMissingStub: null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user