mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-07-04 15:23:02 +02:00
Full-featured workout tracker with session persistence, auto A/B cycling, warmup weights (4/5 of target), settings weight stepper, history + progress graph, HTTP sync server, and crash-safe active session resume. Removed per-set break timers per user preference. Dropped audioplayers and vibration dependencies; updated permission_handler to 12.x to eliminate two of three KGP build warnings (shared_preferences_android is an upstream issue). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1003 B
Dart
40 lines
1003 B
Dart
/// Result of a single set during a workout session.
|
|
library;
|
|
|
|
class SetResult {
|
|
const SetResult({
|
|
required this.targetReps,
|
|
required this.doneReps,
|
|
required this.weight,
|
|
});
|
|
|
|
final int targetReps;
|
|
|
|
/// How many reps the user actually completed (may be < targetReps on failure).
|
|
final int doneReps;
|
|
|
|
final double weight;
|
|
|
|
/// True when the user completed every target rep.
|
|
bool get succeeded => doneReps >= targetReps;
|
|
|
|
SetResult copyWith({int? doneReps}) => SetResult(
|
|
targetReps: targetReps,
|
|
doneReps: doneReps ?? this.doneReps,
|
|
weight: weight,
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'targetReps': targetReps,
|
|
'doneReps': doneReps,
|
|
'weight': weight,
|
|
'succeeded': succeeded,
|
|
};
|
|
|
|
factory SetResult.fromJson(Map<String, dynamic> json) => SetResult(
|
|
targetReps: json['targetReps'] as int,
|
|
doneReps: json['doneReps'] as int,
|
|
weight: (json['weight'] as num).toDouble(),
|
|
);
|
|
}
|