Activity media
This commit is contained in:
parent
8890346b59
commit
d7bd755c57
@ -1,14 +1,18 @@
|
||||
import 'package:sendtrain/classes/media.dart';
|
||||
|
||||
class ActivityAction {
|
||||
int id;
|
||||
String title;
|
||||
String description;
|
||||
Set activityActionSet;
|
||||
List<Media>? media;
|
||||
|
||||
ActivityAction({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.activityActionSet,
|
||||
this.media,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -13,40 +13,30 @@ class ActivityActionView extends StatefulWidget {
|
||||
class _ActivityActionViewState extends State<ActivityActionView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
textAlign: TextAlign.left,
|
||||
style: const TextStyle(fontSize: 15),
|
||||
widget.action.description)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
return Expanded(
|
||||
child: ListView.builder(
|
||||
// shrinkWrap: true,
|
||||
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
itemCount: widget.action.activityActionSet.total,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Text(
|
||||
widget.action.description
|
||||
);
|
||||
},
|
||||
));
|
||||
// return Column(
|
||||
// children: [Expanded(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// textAlign: TextAlign.left,
|
||||
// style: const TextStyle(fontSize: 15),
|
||||
// widget.action.description),
|
||||
// ]
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// textAlign: TextAlign.left,
|
||||
// style: const TextStyle(fontSize: 15),
|
||||
// widget.action.description)
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// // this will be you container
|
||||
// const Column(children: [
|
||||
// Text(
|
||||
// textAlign: TextAlign.left,
|
||||
// style: TextStyle(fontSize: 15),
|
||||
// 'bottom')
|
||||
// ],)
|
||||
// ],
|
||||
// );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sendtrain/classes/activity_action.dart';
|
||||
import 'package:sendtrain/classes/media.dart';
|
||||
import 'package:sendtrain/models/activity_model.dart';
|
||||
import 'package:sendtrain/widgets/activity_action_view.dart';
|
||||
import 'package:sendtrain/widgets/media_card.dart';
|
||||
|
||||
class ActivityView extends StatelessWidget {
|
||||
const ActivityView({super.key, required this.activity});
|
||||
@ -32,6 +34,7 @@ class ActivityView extends StatelessWidget {
|
||||
textAlign: TextAlign.left,
|
||||
style: const TextStyle(fontSize: 15),
|
||||
activity.description)),
|
||||
ActivityViewMedia(activity: activity),
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(15, 30, 0, 10),
|
||||
child: Text(
|
||||
@ -84,3 +87,38 @@ class ActivityViewCategories extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ActivityViewMedia extends StatelessWidget {
|
||||
const ActivityViewMedia({super.key, this.activity});
|
||||
|
||||
final ActivityModel? activity;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Media> media = [];
|
||||
|
||||
for (ActivityAction action in activity!.actions) {
|
||||
if (action.media!.isNotEmpty) {
|
||||
media.addAll(action.media as Iterable<Media>);
|
||||
}
|
||||
}
|
||||
|
||||
List<Widget> mediaCards = List.generate(media.length,
|
||||
(i) => MediaCard(media: media[i]));
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
child: GridView.count(
|
||||
padding: const EdgeInsets.fromLTRB(15, 0, 0, 0),
|
||||
scrollDirection: Axis.horizontal,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 5,
|
||||
crossAxisCount: 1,
|
||||
children: mediaCards))
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -38,22 +38,32 @@ class SessionCard extends StatelessWidget {
|
||||
"Campus board session, focusing on explosiveness and contact strength.",
|
||||
actions: [
|
||||
ActivityAction(
|
||||
id: 1,
|
||||
title: 'test action',
|
||||
description:'test description',
|
||||
activityActionSet: Set(
|
||||
type: 'drop_set',
|
||||
total: 3,
|
||||
rest: 3000,
|
||||
reps: Reps(
|
||||
type: 'count',
|
||||
tempo: [2,3,5],
|
||||
amounts: [5,3,2],
|
||||
weights: [50,70,80],
|
||||
rest: 200
|
||||
)
|
||||
)
|
||||
),
|
||||
id: 1,
|
||||
title: 'test action',
|
||||
description: 'test description',
|
||||
media: [
|
||||
Media(
|
||||
id: 1,
|
||||
reference:
|
||||
'https://www.climbing.com/wp-content/uploads/2022/06/campus-board-e1655470701154.jpeg',
|
||||
type: 'image',
|
||||
description: 'Campus board movement'),
|
||||
Media(
|
||||
id: 1,
|
||||
reference: '7ACyeOP-Hxo',
|
||||
type: 'youtube',
|
||||
description: 'How to campus board')
|
||||
],
|
||||
activityActionSet: Set(
|
||||
type: 'drop_set',
|
||||
total: 3,
|
||||
rest: 3000,
|
||||
reps: Reps(
|
||||
type: 'count',
|
||||
tempo: [2, 3, 5],
|
||||
amounts: [5, 3, 2],
|
||||
weights: [50, 70, 80],
|
||||
rest: 200))),
|
||||
],
|
||||
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
|
||||
ActivityModel(
|
||||
@ -65,22 +75,32 @@ class SessionCard extends StatelessWidget {
|
||||
"Session focussed on attempting a climb at or beyond your perceived limit.",
|
||||
actions: [
|
||||
ActivityAction(
|
||||
id: 1,
|
||||
title: 'test action',
|
||||
description:'test description',
|
||||
activityActionSet: Set(
|
||||
type: 'drop_set',
|
||||
total: 3,
|
||||
rest: 3000,
|
||||
reps: Reps(
|
||||
type: 'count',
|
||||
tempo: [2,3,5],
|
||||
amounts: [5,3,2],
|
||||
weights: [50,70,80],
|
||||
rest: 200
|
||||
)
|
||||
)
|
||||
),
|
||||
id: 1,
|
||||
title: 'test action',
|
||||
description: 'test description',
|
||||
media: [
|
||||
Media(
|
||||
id: 1,
|
||||
reference:
|
||||
'https://www.climbing.com/wp-content/uploads/2022/07/Fixed-44.jpg',
|
||||
type: 'image',
|
||||
description: 'Projecting a climb'),
|
||||
Media(
|
||||
id: 1,
|
||||
reference: 'BgheYcxhrsw',
|
||||
type: 'youtube',
|
||||
description: 'How to project climbs')
|
||||
],
|
||||
activityActionSet: Set(
|
||||
type: 'drop_set',
|
||||
total: 3,
|
||||
rest: 3000,
|
||||
reps: Reps(
|
||||
type: 'count',
|
||||
tempo: [2, 3, 5],
|
||||
amounts: [5, 3, 2],
|
||||
weights: [50, 70, 80],
|
||||
rest: 200))),
|
||||
],
|
||||
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
||||
ActivityModel(
|
||||
@ -92,22 +112,32 @@ class SessionCard extends StatelessWidget {
|
||||
"Weight pullups to increase strength and maximal pulling force.",
|
||||
actions: [
|
||||
ActivityAction(
|
||||
id: 1,
|
||||
title: 'test action',
|
||||
description:'test description',
|
||||
activityActionSet: Set(
|
||||
type: 'drop_set',
|
||||
total: 3,
|
||||
rest: 3000,
|
||||
reps: Reps(
|
||||
type: 'count',
|
||||
tempo: [2,3,5],
|
||||
amounts: [5,3,2],
|
||||
weights: [50,70,80],
|
||||
rest: 200
|
||||
)
|
||||
)
|
||||
),
|
||||
id: 1,
|
||||
title: 'test action',
|
||||
description: 'test description',
|
||||
media: [
|
||||
Media(
|
||||
id: 1,
|
||||
reference:
|
||||
'https://trainingforclimbing.com/wp-content/uploads/2016/03/hypergravity_pull-up-compress3-966x1024.jpg',
|
||||
type: 'image',
|
||||
description: 'Weighted Pullups'),
|
||||
Media(
|
||||
id: 1,
|
||||
reference: '7TLG1mHQHgw',
|
||||
type: 'youtube',
|
||||
description: 'How to do weighted pullups')
|
||||
],
|
||||
activityActionSet: Set(
|
||||
type: 'drop_set',
|
||||
total: 3,
|
||||
rest: 3000,
|
||||
reps: Reps(
|
||||
type: 'count',
|
||||
tempo: [2, 3, 5],
|
||||
amounts: [5, 3, 2],
|
||||
weights: [50, 70, 80],
|
||||
rest: 200))),
|
||||
],
|
||||
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user