Files
swiftcontrol/lib/services/workout/past_workout.dart
Jonas Bark c8391382d4 feat: open Past Workouts in a sheet and surface duration / distance
Persists the WorkoutSummary alongside each saved workout as a sidecar
JSON file (workout-…fit.json) so the past-workouts list can render
duration, distance, avg power, and avg HR per row without parsing the
FIT. Reading is best-effort — older workouts without a sidecar fall
back to the previous filename-only layout.

Splits WorkoutsListPage into a Scaffold-wrapped page (kept for
backwards compatibility / desktop nav) and a chrome-free WorkoutsList
widget that the MiniWorkoutCard now mounts inside openSheet at the
bottom edge. WorkoutsList renders a small header and the "open folder"
shortcut when its showHeader flag is set so it stays self-contained
inside the sheet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 09:54:31 +02:00

25 lines
696 B
Dart

import 'dart:io';
import 'workout_summary.dart';
/// Listing-row view of a `.fit` file on disk. Fields are derived from the
/// filename (startedAt) plus `stat()` (sizeBytes) — we don't parse FIT here
/// to keep the list fast. [summary] is hydrated from a sidecar JSON written
/// alongside the FIT at save time; older workouts without a sidecar leave
/// it null.
class PastWorkout {
final File file;
final DateTime startedAt;
final int sizeBytes;
final WorkoutSummary? summary;
const PastWorkout({
required this.file,
required this.startedAt,
required this.sizeBytes,
this.summary,
});
String get fileName => file.path.split(Platform.pathSeparator).last;
}