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?
This commit is contained in:
Roland Geider
2021-06-13 21:09:37 +02:00
parent b88c3290c1
commit 48ee80fffe
2 changed files with 6 additions and 2 deletions

View File

@@ -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;

View File

@@ -505,7 +505,6 @@ class _LogPageState extends State<LogPage> {
}
Widget getPlates() {
//final plates = [];
final plates = plateCalculator(
double.parse(_weightController.text),
BAR_WEIGHT,
@@ -556,7 +555,9 @@ class _LogPageState extends State<LogPage> {
? 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(