Move plate calculator visibility logic to the exercise itself

This commit is contained in:
Roland Geider
2025-10-09 22:42:10 +02:00
parent 34a013ad92
commit b4c77bf238
2 changed files with 3 additions and 3 deletions

View File

@@ -144,6 +144,8 @@ class Exercise extends Equatable {
this.authorsGlobal = authorsGlobal ?? [];
}
bool get showPlateCalculator => equipment.map((e) => e.id).contains(ID_EQUIPMENT_BARBELL);
Exercise.fromApiDataString(String baseData, List<Language> languages)
: this.fromApiData(ExerciseApiData.fromString(baseData), languages);

View File

@@ -282,11 +282,9 @@ class _LogPageState extends ConsumerState<LogPage> {
),
),
),
if (widget._log.exercise.showPlateCalculator) const LogsPlatesWidget(),
if (widget._slotData.comment.isNotEmpty)
Text(widget._slotData.comment, textAlign: TextAlign.center),
// Only show calculator for barbell
if (widget._log.exercise.equipment.map((e) => e.id).contains(ID_EQUIPMENT_BARBELL))
const LogsPlatesWidget(),
const SizedBox(height: 10),
Expanded(
child: (widget._workoutPlan.filterLogsByExercise(widget._exercise.id!).isNotEmpty)