Skip to content

feat(routines): allow custom bar weight in plate calculator#1238

Open
bhavit04 wants to merge 1 commit into
wger-project:masterfrom
bhavit04:feat/custom-bar-weight
Open

feat(routines): allow custom bar weight in plate calculator#1238
bhavit04 wants to merge 1 commit into
wger-project:masterfrom
bhavit04:feat/custom-bar-weight

Conversation

@bhavit04

Copy link
Copy Markdown

Description

Closes #1131

In the plate calculator settings the bar weight could only be chosen from a small dropdown of preset values (e.g. 10 / 15 / 20 kg). This made it impossible to configure common bars such as a 7.5 kg technique/training bar.

This PR replaces the dropdown with an editable numeric field so any positive value can be entered, while keeping the previous presets available as quick-select chips:

  • Locale-aware parsing/formatting (NumberFormat.decimalPattern), consistent with the other weight inputs in the app.
  • Invalid/empty input shows an inline error and the last valid value is retained.
  • The field stays in sync when the bar weight changes from outside (data loaded from prefs, unit switch, preset chip), without clobbering what the user is typing.
  • No new translation strings — reuses the existing barWeight label and enterValidNumber message.

Testing

  • Updated test/widgets/routines/plate_calculator_test.dart to cover both selecting a preset chip and typing a custom value (7.5).
  • flutter analyze clean; all plate-calculator tests pass.

🤖 Generated with Claude Code

The bar weight in the plate calculator settings could previously only be
set to one of a few preset values from a dropdown (e.g. 10/15/20 kg),
which made common bars like 7.5 kg impossible to configure.

Replace the dropdown with an editable, locale-aware numeric field so any
positive value can be entered, while keeping the previous presets as
quick-select chips. Invalid input is rejected with an inline error and
the last valid value is retained.

Closes wger-project#1131

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom bar weight

2 participants