73 lines
2.3 KiB
Dart
73 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:trainhub_flutter/domain/entities/workout_activity.dart';
|
|
|
|
class ActivityCard extends StatelessWidget {
|
|
final WorkoutActivityEntity activity;
|
|
|
|
const ActivityCard({super.key, required this.activity});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isRest = activity.type == 'rest';
|
|
|
|
return Card(
|
|
elevation: 4,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24.0),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
activity.name,
|
|
style: Theme.of(context).textTheme.headlineMedium,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 8),
|
|
if (!isRest) ...[
|
|
Text(
|
|
"${activity.sectionName} • Set ${activity.setIndex}/${activity.totalSets}",
|
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
if (activity.originalExercise != null)
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
_buildInfo(
|
|
context,
|
|
"Sets",
|
|
"${activity.originalExercise!.sets}",
|
|
),
|
|
const SizedBox(width: 24),
|
|
_buildInfo(
|
|
context,
|
|
activity.originalExercise!.isTime ? "Secs" : "Reps",
|
|
"${activity.originalExercise!.value}",
|
|
),
|
|
],
|
|
),
|
|
] else
|
|
Text(
|
|
"Resting...",
|
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildInfo(BuildContext context, String label, String value) {
|
|
return Column(
|
|
children: [
|
|
Text(value, style: Theme.of(context).textTheme.headlineSmall),
|
|
Text(label, style: Theme.of(context).textTheme.labelMedium),
|
|
],
|
|
);
|
|
}
|
|
}
|