officially getting data from the dbgit add . -p!
This commit is contained in:
@ -3,30 +3,31 @@ 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/database.dart' hide ActivityAction;
|
||||
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});
|
||||
final Session session;
|
||||
const SessionCard({super.key, this.type = 0, required this.session});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
initializeDateFormatting('en');
|
||||
final DateFormat dateFormat = DateFormat('yyyy-MM-dd');
|
||||
|
||||
Color color = (state == 0)
|
||||
Color color = (session.status == SessionStatus.started)
|
||||
? Theme.of(context).colorScheme.primaryContainer
|
||||
: Theme.of(context).colorScheme.surfaceContainerLow;
|
||||
|
||||
// place holder until we can retrieve real data
|
||||
final data = SessionModel(
|
||||
id: 1,
|
||||
title: "Projecting @ Climbers Rock",
|
||||
title: "Projecting @ Climbers Rock - ${session.title}",
|
||||
content:
|
||||
"Beta pully beta beta pinch one arm crimpy. Futuristic pinch, dyno dynamic drop knee climb. Climbing ondra slopey onsight beta ondra power endurance.",
|
||||
"${session.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(
|
||||
@ -40,7 +41,8 @@ class SessionCard extends StatelessWidget {
|
||||
ActivityAction(
|
||||
id: 1,
|
||||
title: '1, 3, 5',
|
||||
description: 'Move between the first, third, and fifth rungs, alternating hands. Rest and alternate sides, to start',
|
||||
description:
|
||||
'Move between the first, third, and fifth rungs, alternating hands. Rest and alternate sides, to start',
|
||||
media: [
|
||||
Media(
|
||||
id: 1,
|
||||
@ -77,7 +79,8 @@ class SessionCard extends StatelessWidget {
|
||||
ActivityAction(
|
||||
id: 1,
|
||||
title: 'Attempt Climb',
|
||||
description: 'Attempt your selected climb, if you fall off early in the climb, attempt again. 1 repitition equals roughly doing all the moves, not necessarily in 1 attempt.',
|
||||
description:
|
||||
'Attempt your selected climb, if you fall off early in the climb, attempt again. 1 repitition equals roughly doing all the moves, not necessarily in 1 attempt.',
|
||||
media: [
|
||||
Media(
|
||||
id: 1,
|
||||
@ -114,7 +117,8 @@ class SessionCard extends StatelessWidget {
|
||||
ActivityAction(
|
||||
id: 1,
|
||||
title: 'Long Pulls',
|
||||
description: 'Select your desired weight to pull, add it to the block. You should aim for an effort level of 8-9 when reaching the end of the set time, going to failure will result in significantly extended recovery time.',
|
||||
description:
|
||||
'Select your desired weight to pull, add it to the block. You should aim for an effort level of 8-9 when reaching the end of the set time, going to failure will result in significantly extended recovery time.',
|
||||
media: [
|
||||
Media(
|
||||
id: 1,
|
||||
@ -126,7 +130,8 @@ class SessionCard extends StatelessWidget {
|
||||
id: 1,
|
||||
reference: 'sZVAEy9UmoY',
|
||||
type: 'youtube',
|
||||
description: 'Principals of Grip gains, and related protocols')
|
||||
description:
|
||||
'Principals of Grip gains, and related protocols')
|
||||
],
|
||||
activityActionSet: Set(
|
||||
type: 'alternating',
|
||||
@ -212,8 +217,8 @@ class SessionCard extends StatelessWidget {
|
||||
BorderRadius.all(Radius.elliptical(10, 10)),
|
||||
),
|
||||
)),
|
||||
title: Text(maxLines: 1, data.title),
|
||||
subtitle: Text(maxLines: 1, dateFormat.format(data.date)),
|
||||
title: Text(maxLines: 1, session.title),
|
||||
subtitle: Text(maxLines: 1, dateFormat.format(session.date as DateTime)),
|
||||
trailing: IconButton(
|
||||
visualDensity: VisualDensity.compact,
|
||||
icon: Icon(Icons.close_rounded),
|
||||
@ -222,7 +227,8 @@ class SessionCard extends StatelessWidget {
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: const Text('Session Removal'),
|
||||
content: const Text('Would you like to permanently remove this session?'),
|
||||
content: const Text(
|
||||
'Would you like to permanently remove this session?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||
@ -244,7 +250,7 @@ class SessionCard extends StatelessWidget {
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(fontWeight: FontWeight.w300),
|
||||
data.content),
|
||||
session.content),
|
||||
),
|
||||
],
|
||||
)),
|
||||
@ -297,11 +303,11 @@ class SessionCard extends StatelessWidget {
|
||||
ListTile(
|
||||
title: Text(
|
||||
maxLines: 3,
|
||||
data.title,
|
||||
session.title,
|
||||
textAlign: TextAlign.center),
|
||||
subtitle: Text(
|
||||
maxLines: 1,
|
||||
dateFormat.format(data.date),
|
||||
dateFormat.format(session.date as DateTime),
|
||||
textAlign: TextAlign.center),
|
||||
),
|
||||
])))));
|
||||
|
Reference in New Issue
Block a user