From 48ee80fffe4663f57493c2e8944e66a86b69f9ab Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sun, 13 Jun 2021 21:09:37 +0200 Subject: [PATCH] Only show plate calculator for barbell exercises This might be a bit too constrained, since other exercises (e.g.) in the rack or the leg press would also benefit from this. Perhaps adding a user switch? --- lib/helpers/consts.dart | 3 +++ lib/widgets/workouts/gym_mode.dart | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/helpers/consts.dart b/lib/helpers/consts.dart index 2bc41c599..8d31d87d6 100644 --- a/lib/helpers/consts.dart +++ b/lib/helpers/consts.dart @@ -57,3 +57,6 @@ const AVAILABLE_PLATES = [1.25, 2.5, 5, 10, 15]; /// Weight of the bar, used in the plate calculator const BAR_WEIGHT = 20; + +/// ID of the equipment entry for barbell +const ID_EQUIPMENT_BARBELL = 1; diff --git a/lib/widgets/workouts/gym_mode.dart b/lib/widgets/workouts/gym_mode.dart index a8ea45ccc..40138282e 100644 --- a/lib/widgets/workouts/gym_mode.dart +++ b/lib/widgets/workouts/gym_mode.dart @@ -505,7 +505,6 @@ class _LogPageState extends State { } Widget getPlates() { - //final plates = []; final plates = plateCalculator( double.parse(_weightController.text), BAR_WEIGHT, @@ -556,7 +555,9 @@ class _LogPageState extends State { ? getPastLogs() : Container()), SizedBox(height: 15), - getPlates(), + // Only show calculator for barbell + if (widget._log.exerciseObj.equipment.map((e) => e.id).contains(ID_EQUIPMENT_BARBELL)) + getPlates(), Padding( padding: const EdgeInsets.symmetric(horizontal: 15), child: Card(