mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-03 02:24:30 +01:00
Rename exercise object to translation
This is what they are now anyway and makes it more clear
This commit is contained in:
@@ -23,7 +23,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:wger/exceptions/http_exception.dart';
|
||||
import 'package:wger/models/exercises/base.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
import 'package:wger/providers/workout_plans.dart';
|
||||
|
||||
@@ -107,7 +107,7 @@ dynamic showDeleteDialog(
|
||||
BuildContext context,
|
||||
String confirmDeleteName,
|
||||
Log log,
|
||||
Exercise exercise,
|
||||
Translation exercise,
|
||||
Map<ExerciseBase, List<Log>> exerciseData,
|
||||
) async {
|
||||
final res = await showDialog(
|
||||
|
||||
@@ -18,7 +18,8 @@ WeightEntry _$WeightEntryFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$WeightEntryToJson(WeightEntry instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$WeightEntryToJson(WeightEntry instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'weight': numToString(instance.weight),
|
||||
'date': toDate(instance.date),
|
||||
|
||||
@@ -21,9 +21,9 @@ 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/translation.dart';
|
||||
import 'package:wger/models/exercises/video.dart';
|
||||
|
||||
part 'base.g.dart';
|
||||
@@ -73,7 +73,7 @@ class ExerciseBase extends Equatable {
|
||||
List<ExerciseImage> images = [];
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
List<Exercise> exercises = [];
|
||||
List<Translation> translations = [];
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
List<Video> videos = [];
|
||||
@@ -88,7 +88,7 @@ class ExerciseBase extends Equatable {
|
||||
List<Muscle>? musclesSecondary,
|
||||
List<Equipment>? equipment,
|
||||
List<ExerciseImage>? images,
|
||||
List<Exercise>? exercises,
|
||||
List<Translation>? exercises,
|
||||
ExerciseCategory? category,
|
||||
List<Video>? videos,
|
||||
}) {
|
||||
@@ -115,7 +115,7 @@ class ExerciseBase extends Equatable {
|
||||
}
|
||||
|
||||
if (exercises != null) {
|
||||
this.exercises = exercises;
|
||||
this.translations = exercises;
|
||||
}
|
||||
|
||||
if (videos != null) {
|
||||
@@ -131,15 +131,15 @@ class ExerciseBase extends Equatable {
|
||||
/// translation in English. This is something that should never happen,
|
||||
/// but we can't make sure that no local installation hasn't deleted
|
||||
/// the entry in English.
|
||||
Exercise getExercise(String language) {
|
||||
Translation getExercise(String language) {
|
||||
// If the language is in the form en-US, take the language code only
|
||||
final languageCode = language.split('-')[0];
|
||||
|
||||
return exercises.firstWhere(
|
||||
return translations.firstWhere(
|
||||
(e) => e.languageObj.shortName == languageCode,
|
||||
orElse: () => exercises.firstWhere(
|
||||
orElse: () => translations.firstWhere(
|
||||
(e) => e.languageObj.shortName == LANGUAGE_SHORT_ENGLISH,
|
||||
orElse: () => exercises.first,
|
||||
orElse: () => translations.first,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -159,6 +159,7 @@ class ExerciseBase extends Equatable {
|
||||
|
||||
// Boilerplate
|
||||
factory ExerciseBase.fromJson(Map<String, dynamic> json) => _$ExerciseBaseFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ExerciseBaseToJson(this);
|
||||
|
||||
@override
|
||||
|
||||
@@ -24,19 +24,26 @@ ExerciseBase _$ExerciseBaseFromJson(Map<String, dynamic> json) {
|
||||
return ExerciseBase(
|
||||
id: json['id'] as int?,
|
||||
uuid: json['uuid'] as String?,
|
||||
creationDate:
|
||||
json['creation_date'] == null ? null : DateTime.parse(json['creation_date'] as String),
|
||||
updateDate: json['update_date'] == null ? null : DateTime.parse(json['update_date'] as String),
|
||||
creationDate: json['creation_date'] == null
|
||||
? null
|
||||
: DateTime.parse(json['creation_date'] as String),
|
||||
updateDate: json['update_date'] == null
|
||||
? null
|
||||
: DateTime.parse(json['update_date'] as String),
|
||||
variationId: json['variations'] as int?,
|
||||
)
|
||||
..categoryId = json['category'] as int
|
||||
..musclesIds = (json['muscles'] as List<dynamic>).map((e) => e as int).toList()
|
||||
..musclesSecondaryIds =
|
||||
(json['muscles_secondary'] as List<dynamic>).map((e) => e as int).toList()
|
||||
..equipmentIds = (json['equipment'] as List<dynamic>).map((e) => e as int).toList();
|
||||
..musclesIds =
|
||||
(json['muscles'] as List<dynamic>).map((e) => e as int).toList()
|
||||
..musclesSecondaryIds = (json['muscles_secondary'] as List<dynamic>)
|
||||
.map((e) => e as int)
|
||||
.toList()
|
||||
..equipmentIds =
|
||||
(json['equipment'] as List<dynamic>).map((e) => e as int).toList();
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$ExerciseBaseToJson(ExerciseBase instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$ExerciseBaseToJson(ExerciseBase instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'uuid': instance.uuid,
|
||||
'variations': instance.variationId,
|
||||
|
||||
@@ -17,7 +17,8 @@ ExerciseCategory _$ExerciseCategoryFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$ExerciseCategoryToJson(ExerciseCategory instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$ExerciseCategoryToJson(ExerciseCategory instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
};
|
||||
|
||||
@@ -20,7 +20,8 @@ ExerciseImage _$ExerciseImageFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$ExerciseImageToJson(ExerciseImage instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$ExerciseImageToJson(ExerciseImage instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'uuid': instance.uuid,
|
||||
'exercise_base': instance.exerciseBaseId,
|
||||
|
||||
@@ -23,10 +23,10 @@ import 'package:wger/models/exercises/base.dart';
|
||||
import 'package:wger/models/exercises/comment.dart';
|
||||
import 'package:wger/models/exercises/language.dart';
|
||||
|
||||
part 'exercise.g.dart';
|
||||
part 'translation.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Exercise extends Equatable {
|
||||
class Translation extends Equatable {
|
||||
@JsonKey(required: true)
|
||||
final int? id;
|
||||
|
||||
@@ -57,7 +57,7 @@ class Exercise extends Equatable {
|
||||
@JsonKey(ignore: true)
|
||||
List<Alias> alias = [];
|
||||
|
||||
Exercise({
|
||||
Translation({
|
||||
this.id,
|
||||
this.uuid,
|
||||
this.creationDate,
|
||||
@@ -86,8 +86,9 @@ class Exercise extends Equatable {
|
||||
}
|
||||
|
||||
// Boilerplate
|
||||
factory Exercise.fromJson(Map<String, dynamic> json) => _$ExerciseFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$ExerciseToJson(this);
|
||||
factory Translation.fromJson(Map<String, dynamic> json) => _$TranslationFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$TranslationToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
@@ -1,12 +1,12 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'exercise.dart';
|
||||
part of 'translation.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
Exercise _$ExerciseFromJson(Map<String, dynamic> json) {
|
||||
Translation _$TranslationFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const [
|
||||
@@ -19,18 +19,20 @@ Exercise _$ExerciseFromJson(Map<String, dynamic> json) {
|
||||
'description'
|
||||
],
|
||||
);
|
||||
return Exercise(
|
||||
return Translation(
|
||||
id: json['id'] as int?,
|
||||
uuid: json['uuid'] as String?,
|
||||
creationDate:
|
||||
json['creation_date'] == null ? null : DateTime.parse(json['creation_date'] as String),
|
||||
creationDate: json['creation_date'] == null
|
||||
? null
|
||||
: DateTime.parse(json['creation_date'] as String),
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String,
|
||||
baseId: json['exercise_base'] as int?,
|
||||
)..languageId = json['language'] as int;
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$ExerciseToJson(Exercise instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$TranslationToJson(Translation instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'uuid': instance.uuid,
|
||||
'language': instance.languageId,
|
||||
@@ -22,7 +22,9 @@ MeasurementCategory _$MeasurementCategoryFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$MeasurementCategoryToJson(MeasurementCategory instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$MeasurementCategoryToJson(
|
||||
MeasurementCategory instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'unit': instance.unit,
|
||||
|
||||
@@ -20,7 +20,8 @@ MeasurementEntry _$MeasurementEntryFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$MeasurementEntryToJson(MeasurementEntry instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'category': instance.category,
|
||||
'date': toDate(instance.date),
|
||||
|
||||
@@ -40,7 +40,8 @@ Ingredient _$IngredientFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$IngredientToJson(Ingredient instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$IngredientToJson(Ingredient instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'code': instance.code,
|
||||
'name': instance.name,
|
||||
|
||||
@@ -13,14 +13,16 @@ IngredientWeightUnit _$IngredientWeightUnitFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
return IngredientWeightUnit(
|
||||
id: json['id'] as int,
|
||||
weightUnit: WeightUnit.fromJson(json['weight_unit'] as Map<String, dynamic>),
|
||||
weightUnit:
|
||||
WeightUnit.fromJson(json['weight_unit'] as Map<String, dynamic>),
|
||||
ingredient: Ingredient.fromJson(json['ingredient'] as Map<String, dynamic>),
|
||||
grams: json['grams'] as int,
|
||||
amount: (json['amount'] as num).toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$IngredientWeightUnitToJson(IngredientWeightUnit instance) =>
|
||||
Map<String, dynamic> _$IngredientWeightUnitToJson(
|
||||
IngredientWeightUnit instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'weight_unit': instance.weightUnit,
|
||||
|
||||
@@ -9,7 +9,14 @@ part of 'log.dart';
|
||||
Log _$LogFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const ['id', 'plan', 'datetime', 'ingredient', 'weight_unit', 'amount'],
|
||||
requiredKeys: const [
|
||||
'id',
|
||||
'plan',
|
||||
'datetime',
|
||||
'ingredient',
|
||||
'weight_unit',
|
||||
'amount'
|
||||
],
|
||||
);
|
||||
return Log(
|
||||
id: json['id'] as int?,
|
||||
|
||||
@@ -18,7 +18,8 @@ NutritionalPlan _$NutritionalPlanFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$NutritionalPlanToJson(NutritionalPlan instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$NutritionalPlanToJson(NutritionalPlan instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'description': instance.description,
|
||||
'creation_date': toDate(instance.creationDate),
|
||||
|
||||
@@ -17,7 +17,8 @@ WeightUnit _$WeightUnitFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
};
|
||||
|
||||
@@ -17,7 +17,8 @@ RepetitionUnit _$RepetitionUnitFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$RepetitionUnitToJson(RepetitionUnit instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$RepetitionUnitToJson(RepetitionUnit instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
};
|
||||
|
||||
@@ -9,7 +9,14 @@ part of 'session.dart';
|
||||
WorkoutSession _$WorkoutSessionFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(
|
||||
json,
|
||||
requiredKeys: const ['id', 'workout', 'date', 'impression', 'time_start', 'time_end'],
|
||||
requiredKeys: const [
|
||||
'id',
|
||||
'workout',
|
||||
'date',
|
||||
'impression',
|
||||
'time_start',
|
||||
'time_end'
|
||||
],
|
||||
);
|
||||
return WorkoutSession()
|
||||
..id = json['id'] as int?
|
||||
@@ -21,7 +28,8 @@ WorkoutSession _$WorkoutSessionFromJson(Map<String, dynamic> json) {
|
||||
..timeEnd = stringToTime(json['time_end'] as String?);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$WorkoutSessionToJson(WorkoutSession instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$WorkoutSessionToJson(WorkoutSession instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'workout': instance.workoutId,
|
||||
'date': toDate(instance.date),
|
||||
|
||||
@@ -17,7 +17,8 @@ WeightUnit _$WeightUnitFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$WeightUnitToJson(WeightUnit instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
};
|
||||
|
||||
@@ -19,7 +19,8 @@ WorkoutPlan _$WorkoutPlanFromJson(Map<String, dynamic> json) {
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$WorkoutPlanToJson(WorkoutPlan instance) => <String, dynamic>{
|
||||
Map<String, dynamic> _$WorkoutPlanToJson(WorkoutPlan instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'creation_date': instance.creationDate.toIso8601String(),
|
||||
'name': instance.name,
|
||||
|
||||
@@ -8,15 +8,16 @@ import 'package:wger/models/exercises/alias.dart';
|
||||
import 'package:wger/models/exercises/base.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/language.dart';
|
||||
import 'package:wger/models/exercises/muscle.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
import 'package:wger/models/exercises/variation.dart';
|
||||
|
||||
import 'base_provider.dart';
|
||||
|
||||
class AddExerciseProvider with ChangeNotifier {
|
||||
final WgerBaseProvider baseProvider;
|
||||
|
||||
AddExerciseProvider(this.baseProvider);
|
||||
|
||||
List<File> get exerciseImages => [..._exerciseImages];
|
||||
@@ -59,18 +60,25 @@ class AddExerciseProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
set exerciseNameEn(String name) => _nameEn = name;
|
||||
|
||||
set exerciseNameTrans(String name) => _nameTranslation = name;
|
||||
|
||||
set descriptionEn(String description) => _descriptionEn = description;
|
||||
|
||||
set descriptionTrans(String description) => _descriptionTranslation = description;
|
||||
|
||||
set alternateNamesEn(List<String> names) => _alternativeNamesEn = names;
|
||||
|
||||
set alternateNamesTrans(List<String> names) => _alternativeNamesTranslation = names;
|
||||
|
||||
set equipment(List<Equipment> equipment) => _equipment = equipment;
|
||||
|
||||
List<Equipment> get equipment => [..._equipment];
|
||||
|
||||
bool get newVariation => _newVariationForExercise != null;
|
||||
|
||||
int? get newVariationForExercise => _newVariationForExercise;
|
||||
|
||||
set newVariationForExercise(int? value) {
|
||||
_newVariationForExercise = value;
|
||||
_variationId = null;
|
||||
@@ -78,6 +86,7 @@ class AddExerciseProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
int? get variationId => _variationId;
|
||||
|
||||
set variationId(int? variation) {
|
||||
_variationId = variation;
|
||||
_newVariationForExercise = null;
|
||||
@@ -94,16 +103,16 @@ class AddExerciseProvider with ChangeNotifier {
|
||||
);
|
||||
}
|
||||
|
||||
Exercise get exerciseEn {
|
||||
return Exercise(
|
||||
Translation get exerciseEn {
|
||||
return Translation(
|
||||
name: _nameEn!,
|
||||
description: _descriptionEn!,
|
||||
language: const Language(id: 2, fullName: 'English', shortName: 'en'),
|
||||
);
|
||||
}
|
||||
|
||||
Exercise get exerciseTranslation {
|
||||
return Exercise(
|
||||
Translation get exerciseTranslation {
|
||||
return Translation(
|
||||
name: _nameTranslation!,
|
||||
description: _descriptionTranslation!,
|
||||
language: language,
|
||||
@@ -115,12 +124,14 @@ class AddExerciseProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
List<Muscle> get primaryMuscles => [..._primaryMuscles];
|
||||
|
||||
set primaryMuscles(List<Muscle> muscles) {
|
||||
_primaryMuscles = muscles;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
List<Muscle> get secondaryMuscles => [..._secondaryMuscles];
|
||||
|
||||
set secondaryMuscles(List<Muscle> muscles) {
|
||||
_secondaryMuscles = muscles;
|
||||
notifyListeners();
|
||||
@@ -169,7 +180,7 @@ class AddExerciseProvider with ChangeNotifier {
|
||||
final base = await addExerciseBase();
|
||||
|
||||
// Create the base description in English
|
||||
Exercise exerciseTranslationEn = exerciseEn;
|
||||
Translation exerciseTranslationEn = exerciseEn;
|
||||
exerciseTranslationEn.base = base;
|
||||
exerciseTranslationEn = await addExerciseTranslation(exerciseTranslationEn);
|
||||
for (final alias in _alternativeNamesEn) {
|
||||
@@ -180,7 +191,7 @@ class AddExerciseProvider with ChangeNotifier {
|
||||
|
||||
// Create the translations
|
||||
if (language != null) {
|
||||
Exercise exerciseTranslationLang = exerciseTranslation;
|
||||
Translation exerciseTranslationLang = exerciseTranslation;
|
||||
exerciseTranslationLang.base = base;
|
||||
exerciseTranslationLang = await addExerciseTranslation(exerciseTranslationLang);
|
||||
for (final alias in _alternativeNamesTranslation) {
|
||||
@@ -239,11 +250,11 @@ class AddExerciseProvider with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<Exercise> addExerciseTranslation(Exercise exercise) async {
|
||||
Future<Translation> addExerciseTranslation(Translation exercise) async {
|
||||
final Uri postUri = baseProvider.makeUrl(_exerciseTranslationUrlPath);
|
||||
|
||||
final Map<String, dynamic> newTranslation = await baseProvider.post(exercise.toJson(), postUri);
|
||||
final Exercise newExercise = Exercise.fromJson(newTranslation);
|
||||
final Translation newExercise = Translation.fromJson(newTranslation);
|
||||
notifyListeners();
|
||||
|
||||
return newExercise;
|
||||
|
||||
@@ -30,16 +30,17 @@ import 'package:wger/models/exercises/base.dart';
|
||||
import 'package:wger/models/exercises/category.dart';
|
||||
import 'package:wger/models/exercises/comment.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/language.dart';
|
||||
import 'package:wger/models/exercises/muscle.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
import 'package:wger/models/exercises/variation.dart';
|
||||
import 'package:wger/models/exercises/video.dart';
|
||||
import 'package:wger/providers/base_provider.dart';
|
||||
|
||||
class ExercisesProvider with ChangeNotifier {
|
||||
final WgerBaseProvider baseProvider;
|
||||
|
||||
ExercisesProvider(this.baseProvider);
|
||||
|
||||
static const EXERCISE_CACHE_DAYS = 7;
|
||||
@@ -56,6 +57,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
static const _languageUrlPath = 'language';
|
||||
|
||||
List<ExerciseBase> _exerciseBases = [];
|
||||
|
||||
set exerciseBases(List<ExerciseBase> exercisesBases) {
|
||||
_exerciseBases = exercisesBases;
|
||||
}
|
||||
@@ -67,14 +69,18 @@ class ExercisesProvider with ChangeNotifier {
|
||||
List<Variation> _variations = [];
|
||||
|
||||
Filters? _filters;
|
||||
|
||||
Filters? get filters => _filters;
|
||||
|
||||
Future<void> setFilters(Filters? newFilters) async {
|
||||
_filters = newFilters;
|
||||
await findByFilters();
|
||||
}
|
||||
|
||||
List<ExerciseBase> _filteredExerciseBases = [];
|
||||
|
||||
List<ExerciseBase> get filteredExerciseBases => _filteredExerciseBases;
|
||||
|
||||
set filteredExerciseBases(List<ExerciseBase> newFilteredExercises) {
|
||||
_filteredExerciseBases = newFilteredExercises;
|
||||
notifyListeners();
|
||||
@@ -95,10 +101,15 @@ class ExercisesProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
List<ExerciseBase> get bases => [..._exerciseBases];
|
||||
|
||||
List<ExerciseCategory> get categories => [..._categories];
|
||||
|
||||
List<Muscle> get muscles => [..._muscles];
|
||||
|
||||
List<Equipment> get equipment => [..._equipment];
|
||||
|
||||
List<Language> get languages => [..._languages];
|
||||
|
||||
set languages(List<Language> languages) {
|
||||
_languages = languages;
|
||||
}
|
||||
@@ -314,9 +325,9 @@ class ExercisesProvider with ChangeNotifier {
|
||||
final images = baseData['images'].map((e) => ExerciseImage.fromJson(e)).toList();
|
||||
final videos = baseData['videos'].map((e) => Video.fromJson(e)).toList();
|
||||
|
||||
final List<Exercise> exercises = [];
|
||||
final List<Translation> exercises = [];
|
||||
for (final exerciseData in baseData['exercises']) {
|
||||
final exercise = Exercise.fromJson(exerciseData);
|
||||
final exercise = Translation.fromJson(exerciseData);
|
||||
exercise.alias = exerciseData['aliases']
|
||||
.map((e) => Alias(exerciseId: exercise.id!, alias: e['alias']))
|
||||
.toList()
|
||||
@@ -501,6 +512,7 @@ class Filters {
|
||||
}
|
||||
|
||||
bool _doesNeedUpdate = false;
|
||||
|
||||
bool get doesNeedUpdate => _doesNeedUpdate;
|
||||
|
||||
void markNeedsUpdate() {
|
||||
|
||||
@@ -26,7 +26,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:wger/exceptions/http_exception.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/models/exercises/base.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
import 'package:wger/models/workouts/day.dart';
|
||||
import 'package:wger/models/workouts/log.dart';
|
||||
import 'package:wger/models/workouts/repetition_unit.dart';
|
||||
@@ -446,7 +446,7 @@ class WorkoutPlansProvider extends WgerBaseProvider with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<String> fetchSmartText(Set workoutSet, Exercise exercise) async {
|
||||
Future<String> fetchSmartText(Set workoutSet, Translation exercise) async {
|
||||
final data = await fetch(
|
||||
makeUrl(
|
||||
_setsUrlPath,
|
||||
|
||||
@@ -24,8 +24,8 @@ import 'package:provider/provider.dart';
|
||||
import 'package:wger/helpers/consts.dart';
|
||||
import 'package:wger/helpers/i18n.dart';
|
||||
import 'package:wger/models/exercises/base.dart';
|
||||
import 'package:wger/models/exercises/exercise.dart';
|
||||
import 'package:wger/models/exercises/muscle.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
import 'package:wger/providers/exercises.dart';
|
||||
import 'package:wger/widgets/core/core.dart';
|
||||
import 'package:wger/widgets/exercises/images.dart';
|
||||
@@ -34,7 +34,7 @@ import 'package:wger/widgets/exercises/videos.dart';
|
||||
|
||||
class ExerciseDetail extends StatelessWidget {
|
||||
final ExerciseBase _exerciseBase;
|
||||
late Exercise _exercise;
|
||||
late Translation _exercise;
|
||||
static const PADDING = 9.0;
|
||||
|
||||
ExerciseDetail(this._exerciseBase);
|
||||
|
||||
@@ -85,7 +85,7 @@ void main() {
|
||||
]);
|
||||
expect(base.videos.map((v) => v.uuid), ['63e996e9-a772-4ca5-9d09-8b4be03f6be4']);
|
||||
|
||||
final exercise1 = base.exercises[0];
|
||||
final exercise1 = base.translations[0];
|
||||
expect(exercise1.name, '2 Handed Kettlebell Swing');
|
||||
expect(exercise1.languageObj.shortName, 'en');
|
||||
expect(exercise1.notes[0].comment, "it's important to do the exercise correctly");
|
||||
@@ -93,8 +93,8 @@ void main() {
|
||||
expect(exercise1.notes[2].comment, 'have fun');
|
||||
expect(exercise1.alias[0].alias, 'double handed kettlebell');
|
||||
expect(exercise1.alias[1].alias, 'Kettlebell russian style');
|
||||
expect(base.exercises[1].name, 'Kettlebell Con Dos Manos');
|
||||
expect(base.exercises[2].name, 'Zweihändiges Kettlebell');
|
||||
expect(base.translations[1].name, 'Kettlebell Con Dos Manos');
|
||||
expect(base.translations[2].name, 'Zweihändiges Kettlebell');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -181,7 +181,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
returnValueForMissingStub: _i6.Future<void>.value(),
|
||||
) as _i6.Future<void>);
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -225,7 +226,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> post(
|
||||
@@ -240,7 +242,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> patch(
|
||||
@@ -255,7 +258,8 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<_i3.Response> deleteRequest(
|
||||
|
||||
@@ -23,7 +23,8 @@ import 'package:wger/providers/measurement.dart' as _i4;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -33,7 +34,8 @@ class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvi
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.MeasurementCategory {
|
||||
class _FakeMeasurementCategory_1 extends _i1.SmartFake
|
||||
implements _i3.MeasurementCategory {
|
||||
_FakeMeasurementCategory_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -46,7 +48,8 @@ class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.Measuremen
|
||||
/// A class which mocks [MeasurementProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvider {
|
||||
class MockMeasurementProvider extends _i1.Mock
|
||||
implements _i4.MeasurementProvider {
|
||||
MockMeasurementProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -119,7 +122,8 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide
|
||||
returnValueForMissingStub: _i5.Future<void>.value(),
|
||||
) as _i5.Future<void>);
|
||||
@override
|
||||
_i5.Future<void> addCategory(_i3.MeasurementCategory? category) => (super.noSuchMethod(
|
||||
_i5.Future<void> addCategory(_i3.MeasurementCategory? category) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addCategory,
|
||||
[category],
|
||||
|
||||
@@ -102,7 +102,8 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -146,7 +147,8 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> post(
|
||||
@@ -161,7 +163,8 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i5.Future<Map<String, dynamic>> patch(
|
||||
@@ -176,7 +179,8 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i5.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i5.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i5.Future<_i3.Response> deleteRequest(
|
||||
|
||||
@@ -46,7 +46,8 @@ class _FakeClient_1 extends _i1.SmartFake implements _i3.Client {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan {
|
||||
class _FakeNutritionalPlan_2 extends _i1.SmartFake
|
||||
implements _i4.NutritionalPlan {
|
||||
_FakeNutritionalPlan_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -109,7 +110,8 @@ class _FakeResponse_7 extends _i1.SmartFake implements _i3.Response {
|
||||
/// A class which mocks [NutritionPlansProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansProvider {
|
||||
class MockNutritionPlansProvider extends _i1.Mock
|
||||
implements _i8.NutritionPlansProvider {
|
||||
MockNutritionPlansProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -202,12 +204,14 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||
) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
),
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
@@ -216,12 +220,14 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
)),
|
||||
) as _i9.Future<_i4.NutritionalPlan>);
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanFull,
|
||||
[planId],
|
||||
),
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanFull,
|
||||
@@ -230,12 +236,14 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
)),
|
||||
) as _i9.Future<_i4.NutritionalPlan>);
|
||||
@override
|
||||
_i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod(
|
||||
_i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addPlan,
|
||||
[planData],
|
||||
),
|
||||
returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
returnValue:
|
||||
_i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addPlan,
|
||||
@@ -333,7 +341,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
)),
|
||||
) as _i9.Future<_i6.MealItem>);
|
||||
@override
|
||||
_i9.Future<void> deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod(
|
||||
_i9.Future<void> deleteMealItem(_i6.MealItem? mealItem) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#deleteMealItem,
|
||||
[mealItem],
|
||||
@@ -342,7 +351,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||
) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<_i7.Ingredient> fetchIngredient(int? ingredientId) => (super.noSuchMethod(
|
||||
_i9.Future<_i7.Ingredient> fetchIngredient(int? ingredientId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchIngredient,
|
||||
[ingredientId],
|
||||
@@ -380,7 +390,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
returnValue: _i9.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
) as _i9.Future<List<dynamic>>);
|
||||
@override
|
||||
_i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod(
|
||||
_i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#searchIngredientWithCode,
|
||||
[code],
|
||||
@@ -431,7 +442,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||
) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<void> fetchAndSetLogs(_i4.NutritionalPlan? plan) => (super.noSuchMethod(
|
||||
_i9.Future<void> fetchAndSetLogs(_i4.NutritionalPlan? plan) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetLogs,
|
||||
[plan],
|
||||
@@ -440,7 +452,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||
) as _i9.Future<void>);
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -484,7 +497,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i9.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i9.Future<Map<String, dynamic>> post(
|
||||
@@ -499,7 +513,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i9.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i9.Future<Map<String, dynamic>> patch(
|
||||
@@ -514,7 +529,8 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i9.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i9.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i9.Future<_i3.Response> deleteRequest(
|
||||
|
||||
@@ -31,7 +31,8 @@ class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse {
|
||||
class _FakeStreamedResponse_1 extends _i1.SmartFake
|
||||
implements _i2.StreamedResponse {
|
||||
_FakeStreamedResponse_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -236,12 +237,14 @@ class MockClient extends _i1.Mock implements _i2.Client {
|
||||
returnValue: _i3.Future<_i5.Uint8List>.value(_i5.Uint8List(0)),
|
||||
) as _i3.Future<_i5.Uint8List>);
|
||||
@override
|
||||
_i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod(
|
||||
_i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#send,
|
||||
[request],
|
||||
),
|
||||
returnValue: _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1(
|
||||
returnValue:
|
||||
_i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1(
|
||||
this,
|
||||
Invocation.method(
|
||||
#send,
|
||||
|
||||
@@ -26,7 +26,8 @@ import 'package:wger/providers/exercises.dart' as _i8;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -46,7 +47,8 @@ class _FakeExerciseBase_1 extends _i1.SmartFake implements _i3.ExerciseBase {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeExerciseCategory_2 extends _i1.SmartFake implements _i4.ExerciseCategory {
|
||||
class _FakeExerciseCategory_2 extends _i1.SmartFake
|
||||
implements _i4.ExerciseCategory {
|
||||
_FakeExerciseCategory_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -103,7 +105,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
),
|
||||
) as _i2.WgerBaseProvider);
|
||||
@override
|
||||
set exerciseBases(List<_i3.ExerciseBase>? exercisesBases) => super.noSuchMethod(
|
||||
set exerciseBases(List<_i3.ExerciseBase>? exercisesBases) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#exerciseBases,
|
||||
exercisesBases,
|
||||
@@ -116,7 +119,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValue: <_i3.ExerciseBase>[],
|
||||
) as List<_i3.ExerciseBase>);
|
||||
@override
|
||||
set filteredExerciseBases(List<_i3.ExerciseBase>? newFilteredExercises) => super.noSuchMethod(
|
||||
set filteredExerciseBases(List<_i3.ExerciseBase>? newFilteredExercises) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#filteredExerciseBases,
|
||||
newFilteredExercises,
|
||||
@@ -124,7 +128,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
Map<int, List<_i3.ExerciseBase>> get exerciseBasesByVariation => (super.noSuchMethod(
|
||||
Map<int, List<_i3.ExerciseBase>> get exerciseBasesByVariation =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseBasesByVariation),
|
||||
returnValue: <int, List<_i3.ExerciseBase>>{},
|
||||
) as Map<int, List<_i3.ExerciseBase>>);
|
||||
@@ -321,7 +326,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||
) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<_i3.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) => (super.noSuchMethod(
|
||||
_i9.Future<_i3.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetExerciseBase,
|
||||
[exerciseBaseId],
|
||||
@@ -335,7 +341,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
)),
|
||||
) as _i9.Future<_i3.ExerciseBase>);
|
||||
@override
|
||||
_i3.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) => (super.noSuchMethod(
|
||||
_i3.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#readExerciseBaseFromBaseInfo,
|
||||
[baseData],
|
||||
@@ -379,7 +386,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
languageCode,
|
||||
],
|
||||
),
|
||||
returnValue: _i9.Future<List<_i3.ExerciseBase>>.value(<_i3.ExerciseBase>[]),
|
||||
returnValue:
|
||||
_i9.Future<List<_i3.ExerciseBase>>.value(<_i3.ExerciseBase>[]),
|
||||
) as _i9.Future<List<_i3.ExerciseBase>>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) => super.noSuchMethod(
|
||||
|
||||
@@ -76,7 +76,8 @@ class _FakeResponse_4 extends _i1.SmartFake implements _i3.Response {
|
||||
/// A class which mocks [BodyWeightProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockBodyWeightProvider extends _i1.Mock implements _i5.BodyWeightProvider {
|
||||
class MockBodyWeightProvider extends _i1.Mock
|
||||
implements _i5.BodyWeightProvider {
|
||||
MockBodyWeightProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -146,7 +147,8 @@ class MockBodyWeightProvider extends _i1.Mock implements _i5.BodyWeightProvider
|
||||
),
|
||||
) as _i4.WeightEntry);
|
||||
@override
|
||||
_i4.WeightEntry? findByDate(DateTime? date) => (super.noSuchMethod(Invocation.method(
|
||||
_i4.WeightEntry? findByDate(DateTime? date) =>
|
||||
(super.noSuchMethod(Invocation.method(
|
||||
#findByDate,
|
||||
[date],
|
||||
)) as _i4.WeightEntry?);
|
||||
@@ -156,10 +158,12 @@ class MockBodyWeightProvider extends _i1.Mock implements _i5.BodyWeightProvider
|
||||
#fetchAndSetEntries,
|
||||
[],
|
||||
),
|
||||
returnValue: _i6.Future<List<_i4.WeightEntry>>.value(<_i4.WeightEntry>[]),
|
||||
returnValue:
|
||||
_i6.Future<List<_i4.WeightEntry>>.value(<_i4.WeightEntry>[]),
|
||||
) as _i6.Future<List<_i4.WeightEntry>>);
|
||||
@override
|
||||
_i6.Future<_i4.WeightEntry> addEntry(_i4.WeightEntry? entry) => (super.noSuchMethod(
|
||||
_i6.Future<_i4.WeightEntry> addEntry(_i4.WeightEntry? entry) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addEntry,
|
||||
[entry],
|
||||
@@ -191,7 +195,8 @@ class MockBodyWeightProvider extends _i1.Mock implements _i5.BodyWeightProvider
|
||||
returnValueForMissingStub: _i6.Future<void>.value(),
|
||||
) as _i6.Future<void>);
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -235,7 +240,8 @@ class MockBodyWeightProvider extends _i1.Mock implements _i5.BodyWeightProvider
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> post(
|
||||
@@ -250,7 +256,8 @@ class MockBodyWeightProvider extends _i1.Mock implements _i5.BodyWeightProvider
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> patch(
|
||||
@@ -265,7 +272,8 @@ class MockBodyWeightProvider extends _i1.Mock implements _i5.BodyWeightProvider
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i6.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<_i3.Response> deleteRequest(
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'dart:ui' as _i16;
|
||||
import 'package:http/http.dart' as _i5;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:wger/models/exercises/base.dart' as _i14;
|
||||
import 'package:wger/models/exercises/exercise.dart' as _i15;
|
||||
import 'package:wger/models/exercises/translation.dart' as _i15;
|
||||
import 'package:wger/models/workouts/day.dart' as _i7;
|
||||
import 'package:wger/models/workouts/log.dart' as _i11;
|
||||
import 'package:wger/models/workouts/repetition_unit.dart' as _i3;
|
||||
@@ -42,7 +42,8 @@ class _FakeWeightUnit_0 extends _i1.SmartFake implements _i2.WeightUnit {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeRepetitionUnit_1 extends _i1.SmartFake implements _i3.RepetitionUnit {
|
||||
class _FakeRepetitionUnit_1 extends _i1.SmartFake
|
||||
implements _i3.RepetitionUnit {
|
||||
_FakeRepetitionUnit_1(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -112,7 +113,8 @@ class _FakeSetting_7 extends _i1.SmartFake implements _i9.Setting {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession {
|
||||
class _FakeWorkoutSession_8 extends _i1.SmartFake
|
||||
implements _i10.WorkoutSession {
|
||||
_FakeWorkoutSession_8(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -155,7 +157,8 @@ class _FakeResponse_11 extends _i1.SmartFake implements _i5.Response {
|
||||
/// A class which mocks [WorkoutPlansProvider].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProvider {
|
||||
class MockWorkoutPlansProvider extends _i1.Mock
|
||||
implements _i12.WorkoutPlansProvider {
|
||||
MockWorkoutPlansProvider() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
@@ -237,6 +240,14 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
List<_i6.WorkoutPlan> getPlans() => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getPlans,
|
||||
[],
|
||||
),
|
||||
returnValue: <_i6.WorkoutPlan>[],
|
||||
) as List<_i6.WorkoutPlan>);
|
||||
@override
|
||||
_i6.WorkoutPlan findById(int? id) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#findById,
|
||||
@@ -293,7 +304,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
@override
|
||||
_i13.Future<_i6.WorkoutPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod(
|
||||
_i13.Future<_i6.WorkoutPlan> fetchAndSetPlanSparse(int? planId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetPlanSparse,
|
||||
[planId],
|
||||
@@ -307,7 +319,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
)),
|
||||
) as _i13.Future<_i6.WorkoutPlan>);
|
||||
@override
|
||||
_i13.Future<_i6.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) => (super.noSuchMethod(
|
||||
_i13.Future<_i6.WorkoutPlan> fetchAndSetWorkoutPlanFull(int? workoutId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetWorkoutPlanFull,
|
||||
[workoutId],
|
||||
@@ -321,7 +334,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
)),
|
||||
) as _i13.Future<_i6.WorkoutPlan>);
|
||||
@override
|
||||
_i13.Future<_i6.WorkoutPlan> addWorkout(_i6.WorkoutPlan? workout) => (super.noSuchMethod(
|
||||
_i13.Future<_i6.WorkoutPlan> addWorkout(_i6.WorkoutPlan? workout) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addWorkout,
|
||||
[workout],
|
||||
@@ -335,7 +349,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
)),
|
||||
) as _i13.Future<_i6.WorkoutPlan>);
|
||||
@override
|
||||
_i13.Future<void> editWorkout(_i6.WorkoutPlan? workout) => (super.noSuchMethod(
|
||||
_i13.Future<void> editWorkout(_i6.WorkoutPlan? workout) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#editWorkout,
|
||||
[workout],
|
||||
@@ -365,7 +380,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
base,
|
||||
],
|
||||
),
|
||||
returnValue: _i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i13.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i13.Future<void> fetchAndSetRepetitionUnits() => (super.noSuchMethod(
|
||||
@@ -475,7 +491,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
returnValue: _i13.Future<List<_i8.Set>>.value(<_i8.Set>[]),
|
||||
) as _i13.Future<List<_i8.Set>>);
|
||||
@override
|
||||
_i13.Future<void> fetchComputedSettings(_i8.Set? workoutSet) => (super.noSuchMethod(
|
||||
_i13.Future<void> fetchComputedSettings(_i8.Set? workoutSet) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchComputedSettings,
|
||||
[workoutSet],
|
||||
@@ -486,7 +503,7 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
@override
|
||||
_i13.Future<String> fetchSmartText(
|
||||
_i8.Set? workoutSet,
|
||||
_i15.Exercise? exercise,
|
||||
_i15.Translation? exercise,
|
||||
) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
@@ -508,7 +525,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
@override
|
||||
_i13.Future<_i9.Setting> addSetting(_i9.Setting? workoutSetting) => (super.noSuchMethod(
|
||||
_i13.Future<_i9.Setting> addSetting(_i9.Setting? workoutSetting) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSetting,
|
||||
[workoutSetting],
|
||||
@@ -530,12 +548,14 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
returnValue: _i13.Future<dynamic>.value(),
|
||||
) as _i13.Future<dynamic>);
|
||||
@override
|
||||
_i13.Future<_i10.WorkoutSession> addSession(_i10.WorkoutSession? session) => (super.noSuchMethod(
|
||||
_i13.Future<_i10.WorkoutSession> addSession(_i10.WorkoutSession? session) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
[session],
|
||||
),
|
||||
returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8(
|
||||
returnValue:
|
||||
_i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8(
|
||||
this,
|
||||
Invocation.method(
|
||||
#addSession,
|
||||
@@ -567,7 +587,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
returnValueForMissingStub: _i13.Future<void>.value(),
|
||||
) as _i13.Future<void>);
|
||||
@override
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) => (super.noSuchMethod(
|
||||
Map<String, String> getDefaultHeaders({dynamic includeAuth = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getDefaultHeaders,
|
||||
[],
|
||||
@@ -611,7 +632,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
#fetch,
|
||||
[uri],
|
||||
),
|
||||
returnValue: _i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i13.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i13.Future<Map<String, dynamic>> post(
|
||||
@@ -626,7 +648,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i13.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i13.Future<Map<String, dynamic>> patch(
|
||||
@@ -641,7 +664,8 @@ class MockWorkoutPlansProvider extends _i1.Mock implements _i12.WorkoutPlansProv
|
||||
uri,
|
||||
],
|
||||
),
|
||||
returnValue: _i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
returnValue:
|
||||
_i13.Future<Map<String, dynamic>>.value(<String, dynamic>{}),
|
||||
) as _i13.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i13.Future<_i5.Response> deleteRequest(
|
||||
|
||||
@@ -26,7 +26,8 @@ import 'package:wger/providers/exercises.dart' as _i8;
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: subtype_of_sealed_class
|
||||
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider {
|
||||
class _FakeWgerBaseProvider_0 extends _i1.SmartFake
|
||||
implements _i2.WgerBaseProvider {
|
||||
_FakeWgerBaseProvider_0(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -46,7 +47,8 @@ class _FakeExerciseBase_1 extends _i1.SmartFake implements _i3.ExerciseBase {
|
||||
);
|
||||
}
|
||||
|
||||
class _FakeExerciseCategory_2 extends _i1.SmartFake implements _i4.ExerciseCategory {
|
||||
class _FakeExerciseCategory_2 extends _i1.SmartFake
|
||||
implements _i4.ExerciseCategory {
|
||||
_FakeExerciseCategory_2(
|
||||
Object parent,
|
||||
Invocation parentInvocation,
|
||||
@@ -103,7 +105,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
),
|
||||
) as _i2.WgerBaseProvider);
|
||||
@override
|
||||
set exerciseBases(List<_i3.ExerciseBase>? exercisesBases) => super.noSuchMethod(
|
||||
set exerciseBases(List<_i3.ExerciseBase>? exercisesBases) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#exerciseBases,
|
||||
exercisesBases,
|
||||
@@ -116,7 +119,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValue: <_i3.ExerciseBase>[],
|
||||
) as List<_i3.ExerciseBase>);
|
||||
@override
|
||||
set filteredExerciseBases(List<_i3.ExerciseBase>? newFilteredExercises) => super.noSuchMethod(
|
||||
set filteredExerciseBases(List<_i3.ExerciseBase>? newFilteredExercises) =>
|
||||
super.noSuchMethod(
|
||||
Invocation.setter(
|
||||
#filteredExerciseBases,
|
||||
newFilteredExercises,
|
||||
@@ -124,7 +128,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
Map<int, List<_i3.ExerciseBase>> get exerciseBasesByVariation => (super.noSuchMethod(
|
||||
Map<int, List<_i3.ExerciseBase>> get exerciseBasesByVariation =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#exerciseBasesByVariation),
|
||||
returnValue: <int, List<_i3.ExerciseBase>>{},
|
||||
) as Map<int, List<_i3.ExerciseBase>>);
|
||||
@@ -321,7 +326,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
returnValueForMissingStub: _i9.Future<void>.value(),
|
||||
) as _i9.Future<void>);
|
||||
@override
|
||||
_i9.Future<_i3.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) => (super.noSuchMethod(
|
||||
_i9.Future<_i3.ExerciseBase> fetchAndSetExerciseBase(int? exerciseBaseId) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#fetchAndSetExerciseBase,
|
||||
[exerciseBaseId],
|
||||
@@ -335,7 +341,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
)),
|
||||
) as _i9.Future<_i3.ExerciseBase>);
|
||||
@override
|
||||
_i3.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) => (super.noSuchMethod(
|
||||
_i3.ExerciseBase readExerciseBaseFromBaseInfo(dynamic baseData) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#readExerciseBaseFromBaseInfo,
|
||||
[baseData],
|
||||
@@ -379,7 +386,8 @@ class MockExercisesProvider extends _i1.Mock implements _i8.ExercisesProvider {
|
||||
languageCode,
|
||||
],
|
||||
),
|
||||
returnValue: _i9.Future<List<_i3.ExerciseBase>>.value(<_i3.ExerciseBase>[]),
|
||||
returnValue:
|
||||
_i9.Future<List<_i3.ExerciseBase>>.value(<_i3.ExerciseBase>[]),
|
||||
) as _i9.Future<List<_i3.ExerciseBase>>);
|
||||
@override
|
||||
void addListener(_i10.VoidCallback? listener) => super.noSuchMethod(
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
import 'package:wger/models/exercises/base.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/language.dart';
|
||||
import 'package:wger/models/exercises/muscle.dart';
|
||||
import 'package:wger/models/exercises/translation.dart';
|
||||
|
||||
const tLanguage1 = Language(id: 1, shortName: 'de', fullName: 'Deutsch');
|
||||
const tLanguage2 = Language(id: 2, shortName: 'en', fullName: 'English');
|
||||
@@ -105,7 +105,7 @@ final sideRaises = ExerciseBase(
|
||||
musclesSecondary: const [tMuscle2],
|
||||
);
|
||||
|
||||
final benchPressDe = Exercise(
|
||||
final benchPressDe = Translation(
|
||||
id: 1,
|
||||
uuid: 'f4cc326b-e497-4bd7-a71d-0eb1db522743',
|
||||
creationDate: DateTime(2021, 1, 15),
|
||||
@@ -114,7 +114,7 @@ final benchPressDe = Exercise(
|
||||
baseId: benchPress.id,
|
||||
language: tLanguage1,
|
||||
);
|
||||
final benchPressEn = Exercise(
|
||||
final benchPressEn = Translation(
|
||||
id: 7,
|
||||
uuid: 'f4cc326b-e497-4bd7-a71d-0eb1db522743',
|
||||
creationDate: DateTime(2021, 1, 15),
|
||||
@@ -124,7 +124,7 @@ final benchPressEn = Exercise(
|
||||
language: tLanguage1,
|
||||
);
|
||||
|
||||
final deadLiftEn = Exercise(
|
||||
final deadLiftEn = Translation(
|
||||
id: 2,
|
||||
uuid: 'b7f51a1a-0368-4dfc-a03c-d629a4089b4a',
|
||||
creationDate: DateTime(2021, 1, 15),
|
||||
@@ -134,7 +134,7 @@ final deadLiftEn = Exercise(
|
||||
language: tLanguage2,
|
||||
);
|
||||
|
||||
final crunchesFr = Exercise(
|
||||
final crunchesFr = Translation(
|
||||
id: 3,
|
||||
uuid: 'd83f572d-add5-48dc-89cf-75f6770284f1',
|
||||
creationDate: DateTime(2021, 4, 1),
|
||||
@@ -144,7 +144,7 @@ final crunchesFr = Exercise(
|
||||
language: tLanguage3,
|
||||
);
|
||||
|
||||
final crunchesDe = Exercise(
|
||||
final crunchesDe = Translation(
|
||||
id: 4,
|
||||
uuid: 'a3e96c1d-b35f-4b0e-9cf4-ca37666cf521',
|
||||
creationDate: DateTime(2021, 4, 1),
|
||||
@@ -154,7 +154,7 @@ final crunchesDe = Exercise(
|
||||
language: tLanguage1,
|
||||
);
|
||||
|
||||
final crunchesEn = Exercise(
|
||||
final crunchesEn = Translation(
|
||||
id: 5,
|
||||
uuid: '8c49a816-2247-4116-94bb-b5c0ce09c609',
|
||||
creationDate: DateTime(2021, 4, 1),
|
||||
@@ -164,7 +164,7 @@ final crunchesEn = Exercise(
|
||||
language: tLanguage2,
|
||||
);
|
||||
|
||||
final curlsEn = Exercise(
|
||||
final curlsEn = Translation(
|
||||
id: 6,
|
||||
uuid: '259a637e-957f-4fe1-b61b-f56e3793ebcd',
|
||||
creationDate: DateTime(2021, 4, 1),
|
||||
@@ -174,7 +174,7 @@ final curlsEn = Exercise(
|
||||
language: tLanguage2,
|
||||
);
|
||||
|
||||
final squatsEn = Exercise(
|
||||
final squatsEn = Translation(
|
||||
id: 8,
|
||||
uuid: '259a637e-957f-4fe1-b61b-f56e3793ebcd',
|
||||
creationDate: DateTime(2021, 4, 1),
|
||||
@@ -184,7 +184,7 @@ final squatsEn = Exercise(
|
||||
language: tLanguage2,
|
||||
);
|
||||
|
||||
final sideRaisesEn = Exercise(
|
||||
final sideRaisesEn = Translation(
|
||||
id: 9,
|
||||
uuid: '6bf89ad0-5a43-4e98-91d3-a8c6886c9712',
|
||||
creationDate: DateTime(2022, 11, 1),
|
||||
@@ -194,17 +194,17 @@ final sideRaisesEn = Exercise(
|
||||
language: tLanguage2,
|
||||
);
|
||||
|
||||
List<Exercise> getTestExercises() {
|
||||
List<Translation> getTestExercises() {
|
||||
return [benchPressDe, deadLiftEn, crunchesFr];
|
||||
}
|
||||
|
||||
List<ExerciseBase> getTestExerciseBases() {
|
||||
benchPress.exercises = [benchPressEn, benchPressDe];
|
||||
crunches.exercises = [crunchesEn, crunchesDe, crunchesFr];
|
||||
deadLift.exercises = [deadLiftEn];
|
||||
curls.exercises = [curlsEn];
|
||||
squats.exercises = [squatsEn];
|
||||
sideRaises.exercises = [sideRaisesEn];
|
||||
benchPress.translations = [benchPressEn, benchPressDe];
|
||||
crunches.translations = [crunchesEn, crunchesDe, crunchesFr];
|
||||
deadLift.translations = [deadLiftEn];
|
||||
curls.translations = [curlsEn];
|
||||
squats.translations = [squatsEn];
|
||||
sideRaises.translations = [sideRaisesEn];
|
||||
|
||||
return [benchPress, crunches, deadLift, curls, squats, sideRaises];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user