44 lines
1.1 KiB
Dart
44 lines
1.1 KiB
Dart
/// Muscle groups tracked by the resistance-training log.
|
|
///
|
|
/// Pure Dart (no framework imports) so the enum can be shared by the domain
|
|
/// entity, the future drift-backed repository (persisted via
|
|
/// [persistenceKey]), and the presentation layer.
|
|
enum MuscleGroup {
|
|
chest,
|
|
back,
|
|
shoulders,
|
|
legs,
|
|
arms,
|
|
core;
|
|
|
|
/// Stable string persisted in the database; never changes across renames.
|
|
String get persistenceKey => name;
|
|
|
|
/// Human-readable label for dialogs and log grouping headers.
|
|
String get displayName {
|
|
switch (this) {
|
|
case MuscleGroup.chest:
|
|
return 'Chest';
|
|
case MuscleGroup.back:
|
|
return 'Back';
|
|
case MuscleGroup.shoulders:
|
|
return 'Shoulders';
|
|
case MuscleGroup.legs:
|
|
return 'Legs';
|
|
case MuscleGroup.arms:
|
|
return 'Arms';
|
|
case MuscleGroup.core:
|
|
return 'Core';
|
|
}
|
|
}
|
|
|
|
/// Parses a persisted key; returns `null` for unknown/legacy values.
|
|
static MuscleGroup? tryParse(String? raw) {
|
|
if (raw == null) return null;
|
|
for (final group in values) {
|
|
if (group.persistenceKey == raw) return group;
|
|
}
|
|
return null;
|
|
}
|
|
}
|