mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-30 01:34:57 +01:00
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>
25 lines
696 B
Dart
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;
|
|
}
|