Skip to content

Fix onboarding weight validation text and negative profile values#303

Merged
simonoppowa merged 3 commits intosimonoppowa:developfrom
LarytheLord:fix/signup-weight-validation-288
Apr 18, 2026
Merged

Fix onboarding weight validation text and negative profile values#303
simonoppowa merged 3 commits intosimonoppowa:developfrom
LarytheLord:fix/signup-weight-validation-288

Conversation

@LarytheLord
Copy link
Copy Markdown
Contributor

Summary

Fixes the onboarding weight validation message and prevents negative values in profile height/weight pickers.

Closes #288
Closes #216
Closes #217

Changes

  • onboarding_second_page_body.dart
    • Fixed validateWeight() to return onboardingWrongWeightLabel instead of onboardingWrongHeightLabel.
  • set_height_dialog.dart
    • Added lower-bound clamping for picker minimum value (>= 1) so users cannot scroll into negative heights.
    • Added confirmation-time guard to ensure returned value respects the same lower bound.
  • set_weight_dialog.dart
    • Added lower-bound clamping for picker minimum value (>= 1) so users cannot scroll into negative weights.
    • Added confirmation-time guard to ensure returned value respects the same lower bound.

Notes

I could not run Flutter tests in this environment because flutter/dart are not installed here.

@LarytheLord
Copy link
Copy Markdown
Contributor Author

LarytheLord commented Mar 3, 2026

Pushed a technical follow-up in commit 2e9d76d to make this PR easier to maintain and safer.

  • extracted profile height/weight picker bound and clamp logic into a shared utility (profile_picker_bounds.dart)
  • updated both set-height and set-weight dialogs to use the shared functions
  • added focused unit tests covering min/max range behavior and lower-bound clamping (profile_picker_bounds_test.dart)

This keeps the original bug fixes intact while adding regression coverage for the boundary logic.

@LarytheLord LarytheLord changed the base branch from main to develop March 8, 2026 14:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an incorrect onboarding validation message for weight input and hardens the profile height/weight picker dialogs to prevent users from selecting negative values by introducing shared bounds/clamping helpers (with unit tests).

Changes:

  • Fix validateWeight() to return the correct localized “wrong weight” message.
  • Introduce profile_picker_bounds.dart to centralize min/max range computation and confirmation-time clamping for height/weight pickers.
  • Add unit tests for the new picker-bounds utilities.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/features/onboarding/presentation/widgets/onboarding_second_page_body.dart Corrects weight validation to use the weight-specific error string.
lib/features/profile/presentation/widgets/set_height_dialog.dart Uses shared bounds helpers and clamps the confirmed height to a non-negative minimum.
lib/features/profile/presentation/widgets/set_weight_dialog.dart Uses shared bounds helpers and clamps the confirmed weight to a non-negative minimum.
lib/features/profile/presentation/utils/profile_picker_bounds.dart New shared min/max + clamp helpers for picker dialogs.
test/unit_test/profile_picker_bounds_test.dart Adds tests for min/max/clamp behavior in the new bounds helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/features/profile/presentation/utils/profile_picker_bounds.dart Outdated
Comment thread lib/features/profile/presentation/utils/profile_picker_bounds.dart Outdated
Comment thread test/unit_test/profile_picker_bounds_test.dart
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@simonoppowa simonoppowa merged commit 161623e into simonoppowa:develop Apr 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants