mirror of
https://github.com/wger-project/flutter.git
synced 2026-12-01 02:02:35 +01:00
Fix getter for images in exerciseinfo endpoint
This was renamed recently
This commit is contained in:
@@ -28,8 +28,8 @@ class ExerciseImage {
|
||||
@JsonKey(required: true)
|
||||
final String uuid;
|
||||
|
||||
@JsonKey(required: true, name: 'exercise')
|
||||
final int exerciseId;
|
||||
@JsonKey(required: true, name: 'exercise_base')
|
||||
final int exerciseBaseId;
|
||||
|
||||
@JsonKey(required: true, name: 'image')
|
||||
final String url;
|
||||
@@ -40,7 +40,7 @@ class ExerciseImage {
|
||||
ExerciseImage({
|
||||
required this.id,
|
||||
required this.uuid,
|
||||
required this.exerciseId,
|
||||
required this.exerciseBaseId,
|
||||
required this.url,
|
||||
required this.isMain,
|
||||
});
|
||||
|
||||
@@ -7,11 +7,12 @@ part of 'image.dart';
|
||||
// **************************************************************************
|
||||
|
||||
ExerciseImage _$ExerciseImageFromJson(Map<String, dynamic> json) {
|
||||
$checkKeys(json, requiredKeys: const ['id', 'uuid', 'exercise', 'image']);
|
||||
$checkKeys(json,
|
||||
requiredKeys: const ['id', 'uuid', 'exercise_base', 'image']);
|
||||
return ExerciseImage(
|
||||
id: json['id'] as int,
|
||||
uuid: json['uuid'] as String,
|
||||
exerciseId: json['exercise'] as int,
|
||||
exerciseBaseId: json['exercise_base'] as int,
|
||||
url: json['image'] as String,
|
||||
isMain: json['is_main'] as bool? ?? false,
|
||||
);
|
||||
@@ -21,7 +22,7 @@ Map<String, dynamic> _$ExerciseImageToJson(ExerciseImage instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'uuid': instance.uuid,
|
||||
'exercise': instance.exerciseId,
|
||||
'exercise_base': instance.exerciseBaseId,
|
||||
'image': instance.url,
|
||||
'is_main': instance.isMain,
|
||||
};
|
||||
|
||||
@@ -432,7 +432,6 @@ class WorkoutPlans extends WgerBaseProvider with ChangeNotifier {
|
||||
/*
|
||||
* Gallery
|
||||
*/
|
||||
|
||||
Future<void> fetchAndSetGallery() async {
|
||||
final data = await fetch(makeUrl(_galleryUrlPath));
|
||||
|
||||
|
||||
@@ -59,8 +59,6 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
if (!Provider.of<Auth>(context, listen: false).dataInit) {
|
||||
Provider.of<Auth>(context, listen: false).setServerVersion();
|
||||
|
||||
await Provider.of<WorkoutPlans>(context, listen: false).fetchAndSetGallery();
|
||||
|
||||
// Base data
|
||||
await Future.wait([
|
||||
Provider.of<WorkoutPlans>(context, listen: false).fetchAndSetUnits(),
|
||||
@@ -68,8 +66,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
||||
Provider.of<Exercises>(context, listen: false).fetchAndSetExercises(),
|
||||
]);
|
||||
|
||||
// Plans and weight
|
||||
// Plans, weight and gallery
|
||||
await Future.wait([
|
||||
Provider.of<WorkoutPlans>(context, listen: false).fetchAndSetGallery(),
|
||||
Provider.of<Nutrition>(context, listen: false).fetchAndSetAllPlans(),
|
||||
Provider.of<WorkoutPlans>(context, listen: false).fetchAndSetAllPlans(),
|
||||
Provider.of<BodyWeight>(context, listen: false).fetchAndSetEntries(),
|
||||
|
||||
@@ -230,6 +230,16 @@ class MockWorkoutPlans extends _i1.Mock implements _i13.WorkoutPlans {
|
||||
returnValue: Future<void>.value(null),
|
||||
returnValueForMissingStub: Future.value()) as _i15.Future<void>);
|
||||
@override
|
||||
_i15.Future<void> editImage(_i14.Image? image, _i17.PickedFile? imageFile) =>
|
||||
(super.noSuchMethod(Invocation.method(#editImage, [image, imageFile]),
|
||||
returnValue: Future<void>.value(null),
|
||||
returnValueForMissingStub: Future.value()) as _i15.Future<void>);
|
||||
@override
|
||||
_i15.Future<void> deleteImage(_i14.Image? image) =>
|
||||
(super.noSuchMethod(Invocation.method(#deleteImage, [image]),
|
||||
returnValue: Future<void>.value(null),
|
||||
returnValueForMissingStub: Future.value()) as _i15.Future<void>);
|
||||
@override
|
||||
void addListener(_i18.VoidCallback? listener) =>
|
||||
super.noSuchMethod(Invocation.method(#addListener, [listener]),
|
||||
returnValueForMissingStub: null);
|
||||
|
||||
Reference in New Issue
Block a user