File tree Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ class ExerciseBase extends Equatable {
90
90
List <ExerciseImage >? images,
91
91
List <Exercise >? exercises,
92
92
ExerciseCategory ? category,
93
+ List <Video >? videos,
93
94
}) {
94
95
this .images = images ?? [];
95
96
this .equipment = equipment ?? [];
@@ -116,6 +117,10 @@ class ExerciseBase extends Equatable {
116
117
if (exercises != null ) {
117
118
this .exercises = exercises;
118
119
}
120
+
121
+ if (videos != null ) {
122
+ this .videos = videos;
123
+ }
119
124
}
120
125
121
126
/// Returns exercises for the given language
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import 'package:wger/models/exercises/image.dart';
35
35
import 'package:wger/models/exercises/language.dart' ;
36
36
import 'package:wger/models/exercises/muscle.dart' ;
37
37
import 'package:wger/models/exercises/variation.dart' ;
38
+ import 'package:wger/models/exercises/video.dart' ;
38
39
import 'package:wger/providers/base_provider.dart' ;
39
40
40
41
class ExercisesProvider with ChangeNotifier {
@@ -315,6 +316,7 @@ class ExercisesProvider with ChangeNotifier {
315
316
final musclesSecondary = baseData['muscles_secondary' ].map ((e) => Muscle .fromJson (e)).toList ();
316
317
final equipment = baseData['equipment' ].map ((e) => Equipment .fromJson (e)).toList ();
317
318
final images = baseData['images' ].map ((e) => ExerciseImage .fromJson (e)).toList ();
319
+ final videos = baseData['videos' ].map ((e) => Video .fromJson (e)).toList ();
318
320
319
321
final List <Exercise > exercises = [];
320
322
for (final exerciseData in baseData['exercises' ]) {
@@ -341,6 +343,7 @@ class ExercisesProvider with ChangeNotifier {
341
343
category: category,
342
344
images: images.cast <ExerciseImage >(),
343
345
exercises: exercises,
346
+ videos: videos.cast <Video >(),
344
347
);
345
348
346
349
return exerciseBase;
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ void main() {
83
83
'd8aa5990-bb47-4111-9823-e2fbd98fe07f' ,
84
84
'49a159e1-1e00-409a-81c9-b4d4489fbd67'
85
85
]);
86
+ expect (base .videos.map ((v) => v.uuid), ['63e996e9-a772-4ca5-9d09-8b4be03f6be4' ]);
86
87
87
88
final exercise1 = base .exercises[0 ];
88
89
expect (exercise1.name, '2 Handed Kettlebell Swing' );
Original file line number Diff line number Diff line change 100
100
"style" : " 4"
101
101
}
102
102
],
103
+ "videos" : [
104
+ {
105
+ "id" : 2 ,
106
+ "uuid" : " 63e996e9-a772-4ca5-9d09-8b4be03f6be4" ,
107
+ "exercise_base" : 258 ,
108
+ "exercise_base_uuid" : " 6260e3aa-e46b-4b4b-8ada-58bfd0922d3a" ,
109
+ "video" : " http://localhost:8000/media/exercise-video/258/63e996e9-a772-4ca5-9d09-8b4be03f6be4.MOV" ,
110
+ "is_main" : false ,
111
+ "size" : 0 ,
112
+ "duration" : " 0.00" ,
113
+ "width" : 0 ,
114
+ "height" : 0 ,
115
+ "codec" : " " ,
116
+ "codec_long" : " " ,
117
+ "license" : 2 ,
118
+ "license_author" : null
119
+ }
120
+ ],
103
121
"exercises" : [
104
122
{
105
123
"id" : 345 ,
You can’t perform that action at this time.
0 commit comments