258 lines
10 KiB
Dart
258 lines
10 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:intl/date_symbol_data_local.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/session_model.dart';
|
|
import 'package:sendtrain/widgets/session_view.dart';
|
|
|
|
class SessionCard extends StatelessWidget {
|
|
final int state;
|
|
final int type;
|
|
const SessionCard({super.key, this.state = 0, this.type = 0});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
initializeDateFormatting('en');
|
|
final DateFormat dateFormat = DateFormat('yyyy-MM-dd');
|
|
|
|
Color color = (state == 0)
|
|
? const Color(0xff3A5FB6)
|
|
: ThemeData.dark(useMaterial3: true).colorScheme.surfaceBright;
|
|
|
|
// place holder until we can retrieve real data
|
|
final data = SessionModel(
|
|
id: 1,
|
|
title: "Projecting @ Climbers Rock",
|
|
content:
|
|
"Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.",
|
|
date: DateTime.now(),
|
|
activities: [
|
|
ActivityModel(
|
|
id: 1,
|
|
title: 'Campus Board',
|
|
type: 'fundamental',
|
|
categories: ['strength', 'power'],
|
|
description:
|
|
"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
|
|
)
|
|
)
|
|
),
|
|
],
|
|
resources: ['https://www.youtube.com/watch?v=bLz0xp1PEm4']),
|
|
ActivityModel(
|
|
id: 1,
|
|
title: 'Projecting',
|
|
type: 'fundamental',
|
|
categories: ['technique', 'conditioning'],
|
|
description:
|
|
"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
|
|
)
|
|
)
|
|
),
|
|
],
|
|
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
|
ActivityModel(
|
|
id: 1,
|
|
title: 'Weighted Pull Ups',
|
|
type: 'fundamental',
|
|
categories: ['Strength', 'Power'],
|
|
description:
|
|
"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
|
|
)
|
|
)
|
|
),
|
|
],
|
|
resources: ['https://www.youtube.com/watch?v=dyAvbUvY_PU']),
|
|
],
|
|
achievements: [
|
|
'got 1 3 5 first time!',
|
|
'no pain in elbow',
|
|
'life is pain',
|
|
'new PR for pullups'
|
|
],
|
|
media: [
|
|
Media(
|
|
id: 1,
|
|
reference: 'TwS8ycTY5cc',
|
|
type: 'youtube',
|
|
description: 'Attempting crux move'),
|
|
Media(
|
|
id: 1,
|
|
reference:
|
|
'https://static.wixstatic.com/media/c83481_1dd473ad49524ae5a95d993ba10e0a50~mv2.jpg/v1/fill/w_640,h_426,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/c83481_1dd473ad49524ae5a95d993ba10e0a50~mv2.jpg',
|
|
type: 'image',
|
|
description: 'Struggling on deadpoints'),
|
|
Media(
|
|
id: 1,
|
|
reference: 'TwS8ycTY5cc',
|
|
type: 'youtube',
|
|
description: 'Attempting crux move')
|
|
]);
|
|
|
|
if (type == 0) {
|
|
return Card(
|
|
color: color,
|
|
margin: const EdgeInsets.fromLTRB(15, 15, 15, 0),
|
|
clipBehavior: Clip.hardEdge,
|
|
child: InkWell(
|
|
// splashColor: Colors.deepPurple,
|
|
onTap: () => showGeneralDialog(
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
transitionDuration: const Duration(milliseconds: 220),
|
|
transitionBuilder: (BuildContext context,
|
|
Animation<double> animation,
|
|
Animation<double> secondaryAnimation,
|
|
Widget child) {
|
|
Animation<Offset> custom = Tween<Offset>(
|
|
begin: const Offset(0.0, 1.0),
|
|
end: const Offset(0.0, 0.0))
|
|
.animate(animation);
|
|
return SlideTransition(
|
|
position: custom,
|
|
child: Dialog.fullscreen(child: SessionView(data: data)));
|
|
},
|
|
barrierDismissible: true,
|
|
barrierLabel: '',
|
|
context: context,
|
|
pageBuilder: (context, animation1, animation2) {
|
|
return Container();
|
|
}),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
ListTile(
|
|
leading: Padding(
|
|
padding: const EdgeInsets.fromLTRB(0, 8, 0, 0),
|
|
child: Container(
|
|
width: 60,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
fit: BoxFit.cover,
|
|
image:
|
|
AssetImage('assets/images/placeholder.jpg')),
|
|
// color: Colors.blue,
|
|
borderRadius:
|
|
BorderRadius.all(Radius.elliptical(10, 10)),
|
|
),
|
|
)),
|
|
title: Text(maxLines: 1, data.title),
|
|
subtitle: Text(maxLines: 1, dateFormat.format(data.date)),
|
|
),
|
|
ListTile(
|
|
contentPadding: const EdgeInsets.fromLTRB(15, 0, 15, 15),
|
|
title: Text(
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: const TextStyle(fontWeight: FontWeight.w300),
|
|
data.content),
|
|
),
|
|
],
|
|
)),
|
|
);
|
|
} else {
|
|
return Card(
|
|
color: const Color.fromARGB(125, 0, 0, 0),
|
|
child: InkWell(
|
|
// overlayColor: MaterialStateColor(Colors.deepPurple as int),
|
|
// splashColor: Colors.deepPurple,
|
|
borderRadius: const BorderRadius.all(Radius.elliptical(10, 10)),
|
|
onTap: () => showGeneralDialog(
|
|
// barrierColor: Colors.black.withOpacity(0.5),
|
|
transitionDuration: const Duration(milliseconds: 220),
|
|
transitionBuilder: (BuildContext context,
|
|
Animation<double> animation,
|
|
Animation<double> secondaryAnimation,
|
|
Widget child) {
|
|
Animation<Offset> custom = Tween<Offset>(
|
|
begin: const Offset(0.0, 1.0),
|
|
end: const Offset(0.0, 0.0))
|
|
.animate(animation);
|
|
return SlideTransition(
|
|
position: custom,
|
|
child:
|
|
Dialog.fullscreen(child: SessionView(data: data)));
|
|
},
|
|
barrierDismissible: true,
|
|
barrierLabel: '',
|
|
context: context,
|
|
pageBuilder: (context, animation1, animation2) {
|
|
return Container();
|
|
}),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
// color: const Color.fromARGB(47, 0, 0, 0),
|
|
borderRadius: BorderRadius.circular(10),
|
|
image: const DecorationImage(
|
|
colorFilter: ColorFilter.mode(
|
|
Color.fromARGB(220, 41, 39, 39),
|
|
BlendMode.hardLight),
|
|
image: AssetImage('assets/images/placeholder.jpg'),
|
|
fit: BoxFit.cover),
|
|
),
|
|
child: Align(
|
|
alignment: Alignment.center,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
ListTile(
|
|
title: Text(
|
|
maxLines: 3,
|
|
data.title,
|
|
textAlign: TextAlign.center),
|
|
subtitle: Text(
|
|
maxLines: 1,
|
|
dateFormat.format(data.date),
|
|
textAlign: TextAlign.center),
|
|
),
|
|
])))));
|
|
}
|
|
}
|
|
}
|