137 lines
4.1 KiB
Dart
137 lines
4.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
|
import 'package:trainhub_flutter/core/constants/ui_constants.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.isRest;
|
|
final accentColor = isRest ? AppColors.info : AppColors.accent;
|
|
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: UIConstants.spacing24,
|
|
vertical: UIConstants.spacing16,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.surfaceContainer.withValues(alpha: 0.6),
|
|
borderRadius: UIConstants.cardBorderRadius,
|
|
border: Border.all(
|
|
color: accentColor.withValues(alpha: 0.2),
|
|
),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
// Activity type badge
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
decoration: BoxDecoration(
|
|
color: accentColor.withValues(alpha: 0.12),
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Text(
|
|
isRest ? 'REST' : 'WORK',
|
|
style: TextStyle(
|
|
color: accentColor,
|
|
fontSize: 10,
|
|
fontWeight: FontWeight.w700,
|
|
letterSpacing: 1.5,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: UIConstants.spacing12),
|
|
// Activity name
|
|
Text(
|
|
activity.name,
|
|
style: const TextStyle(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
if (!isRest) ...[
|
|
const SizedBox(height: UIConstants.spacing8),
|
|
Text(
|
|
'${activity.sectionName ?? ''} \u00B7 Set ${activity.setIndex}/${activity.totalSets}',
|
|
style: const TextStyle(
|
|
color: AppColors.textMuted,
|
|
fontSize: 13,
|
|
),
|
|
),
|
|
if (activity.originalExercise != null) ...[
|
|
const SizedBox(height: UIConstants.spacing16),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
_InfoChip(
|
|
label: 'Sets',
|
|
value: '${activity.originalExercise!.sets}',
|
|
),
|
|
const SizedBox(width: UIConstants.spacing16),
|
|
_InfoChip(
|
|
label: activity.originalExercise!.isTime ? 'Secs' : 'Reps',
|
|
value: '${activity.originalExercise!.value}',
|
|
),
|
|
],
|
|
),
|
|
],
|
|
] else
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: UIConstants.spacing8),
|
|
child: Text(
|
|
'Take a break',
|
|
style: TextStyle(
|
|
color: AppColors.textMuted,
|
|
fontSize: 14,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _InfoChip extends StatelessWidget {
|
|
final String label;
|
|
final String value;
|
|
|
|
const _InfoChip({required this.label, required this.value});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.zinc800.withValues(alpha: 0.5),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
value,
|
|
style: const TextStyle(
|
|
color: AppColors.textPrimary,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
color: AppColors.textMuted,
|
|
fontSize: 11,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|