mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Move plate calculator visibility logic to the exercise itself
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user