Activity media
This commit is contained in:
parent
8890346b59
commit
d7bd755c57
@ -1,14 +1,18 @@
|
|||||||
|
import 'package:sendtrain/classes/media.dart';
|
||||||
|
|
||||||
class ActivityAction {
|
class ActivityAction {
|
||||||
int id;
|
int id;
|
||||||
String title;
|
String title;
|
||||||
String description;
|
String description;
|
||||||
Set activityActionSet;
|
Set activityActionSet;
|
||||||
|
List<Media>? media;
|
||||||
|
|
||||||
ActivityAction({
|
ActivityAction({
|
||||||
required this.id,
|
required this.id,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.description,
|
required this.description,
|
||||||
required this.activityActionSet,
|
required this.activityActionSet,
|
||||||
|
this.media,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,40 +13,30 @@ class ActivityActionView extends StatefulWidget {
|
|||||||
class _ActivityActionViewState extends State<ActivityActionView> {
|
class _ActivityActionViewState extends State<ActivityActionView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Expanded(
|
||||||
children: [
|
child: ListView.builder(
|
||||||
Expanded(
|
// shrinkWrap: true,
|
||||||
child: ListView(
|
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||||
children: <Widget>[
|
itemCount: widget.action.activityActionSet.total,
|
||||||
Text(
|
itemBuilder: (BuildContext context, int index) {
|
||||||
textAlign: TextAlign.left,
|
return Text(
|
||||||
style: const TextStyle(fontSize: 15),
|
widget.action.description
|
||||||
widget.action.description)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
},
|
||||||
|
));
|
||||||
// return Column(
|
// return Column(
|
||||||
// children: [Expanded(
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
// children: [
|
||||||
|
// Expanded(
|
||||||
|
// child: ListView(
|
||||||
|
// children: <Widget>[
|
||||||
// Text(
|
// Text(
|
||||||
// textAlign: TextAlign.left,
|
// textAlign: TextAlign.left,
|
||||||
// style: const TextStyle(fontSize: 15),
|
// style: const TextStyle(fontSize: 15),
|
||||||
// widget.action.description),
|
// 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:flutter/material.dart';
|
||||||
import 'package:sendtrain/classes/activity_action.dart';
|
import 'package:sendtrain/classes/activity_action.dart';
|
||||||
|
import 'package:sendtrain/classes/media.dart';
|
||||||
import 'package:sendtrain/models/activity_model.dart';
|
import 'package:sendtrain/models/activity_model.dart';
|
||||||
import 'package:sendtrain/widgets/activity_action_view.dart';
|
import 'package:sendtrain/widgets/activity_action_view.dart';
|
||||||
|
import 'package:sendtrain/widgets/media_card.dart';
|
||||||
|
|
||||||
class ActivityView extends StatelessWidget {
|
class ActivityView extends StatelessWidget {
|
||||||
const ActivityView({super.key, required this.activity});
|
const ActivityView({super.key, required this.activity});
|
||||||
@ -32,6 +34,7 @@ class ActivityView extends StatelessWidget {
|
|||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: const TextStyle(fontSize: 15),
|
style: const TextStyle(fontSize: 15),
|
||||||
activity.description)),
|
activity.description)),
|
||||||
|
ActivityViewMedia(activity: activity),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(15, 30, 0, 10),
|
padding: EdgeInsets.fromLTRB(15, 30, 0, 10),
|
||||||
child: Text(
|
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))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -41,6 +41,19 @@ class SessionCard extends StatelessWidget {
|
|||||||
id: 1,
|
id: 1,
|
||||||
title: 'test action',
|
title: 'test action',
|
||||||
description: 'test description',
|
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(
|
activityActionSet: Set(
|
||||||
type: 'drop_set',
|
type: 'drop_set',
|
||||||
total: 3,
|
total: 3,
|
||||||
@ -50,10 +63,7 @@ class SessionCard extends StatelessWidget {
|
|||||||
tempo: [2, 3, 5],
|
tempo: [2, 3, 5],
|
||||||
amounts: [5, 3, 2],
|
amounts: [5, 3, 2],
|
||||||
weights: [50, 70, 80],
|
weights: [50, 70, 80],
|
||||||
rest: 200
|
rest: 200))),
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
|
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
|
||||||
ActivityModel(
|
ActivityModel(
|
||||||
@ -68,6 +78,19 @@ class SessionCard extends StatelessWidget {
|
|||||||
id: 1,
|
id: 1,
|
||||||
title: 'test action',
|
title: 'test action',
|
||||||
description: 'test description',
|
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(
|
activityActionSet: Set(
|
||||||
type: 'drop_set',
|
type: 'drop_set',
|
||||||
total: 3,
|
total: 3,
|
||||||
@ -77,10 +100,7 @@ class SessionCard extends StatelessWidget {
|
|||||||
tempo: [2, 3, 5],
|
tempo: [2, 3, 5],
|
||||||
amounts: [5, 3, 2],
|
amounts: [5, 3, 2],
|
||||||
weights: [50, 70, 80],
|
weights: [50, 70, 80],
|
||||||
rest: 200
|
rest: 200))),
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
||||||
ActivityModel(
|
ActivityModel(
|
||||||
@ -95,6 +115,19 @@ class SessionCard extends StatelessWidget {
|
|||||||
id: 1,
|
id: 1,
|
||||||
title: 'test action',
|
title: 'test action',
|
||||||
description: 'test description',
|
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(
|
activityActionSet: Set(
|
||||||
type: 'drop_set',
|
type: 'drop_set',
|
||||||
total: 3,
|
total: 3,
|
||||||
@ -104,10 +137,7 @@ class SessionCard extends StatelessWidget {
|
|||||||
tempo: [2, 3, 5],
|
tempo: [2, 3, 5],
|
||||||
amounts: [5, 3, 2],
|
amounts: [5, 3, 2],
|
||||||
weights: [50, 70, 80],
|
weights: [50, 70, 80],
|
||||||
rest: 200
|
rest: 200))),
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user