The previous logic didn't consult the app's supportedLocales. For the Android 13 per-app
picker this was fine (the user picked a locale that's also in `locales_config.xml`), but
for users whose primary locale wasn't in the supportedLocales list but whose secondary
one *was*, the app would fall through to English instead of honoring the secondary
Closes#930. The validateLanguage stub in AddExerciseProvider was making
the API call but ignoring the response and always returning false. This
wires it up properly: the method now returns null on success or the
server's error message on a language mismatch (caught from the 400
WgerHttpException). The stepper's onStepContinue is now async-aware for
steps 2 (Description) and 3 (Translation) — it calls validateLanguage
after form validation passes, blocks navigation, and displays the error
inline if the check fails. Mocks regenerated to reflect the return type
change from Future<bool> to Future<String?>.
- added locales_config.xml with supported languages
- linked localeConfig in AndroidManifest.xml
- updated MaterialApp with localeListResolutionCallback for system sync
Mirrors the React refactor in wger-project/react#1237 addressing
Roland's review — the SwitchListTile + conditional Slider pair
expressed one semantic decision ("what grade ceiling?") through two
controls. Folded "Off" into the slider itself:
- Slider stops are now Off | A | B | C | D | E (was A..E, gated by
a SwitchListTile).
- Off position sends no `nutriscoreMax`; A..E map as before.
- Heading changed from "Filter by Nutri-Score" to "Nutri-Score
filter", with a dynamic helper ("No filter" / "<grade> or better").
- Model: `IngredientFilters.nutriscoreMax` is now nullable; removed
`filterNutriscore`. `copyWith` takes a `clearNutriscoreMax` flag
because Dart's `??` cannot distinguish "no argument" from "null".
- Storage collapsed: `saveIngredientNutriscoreMax(null)` removes the
key; `getIngredientNutriscoreMax()` returns `null` when absent.
- Riverpod notifier: removed `toggleNutriscore`; `chooseNutriscoreMax`
now takes `NutriScore?`.
- l10n: removed `filterNutriscoreMax`; added `filterNutriscoreOff`,
`filterNutriscoreNoFilter`, `filterNutriscoreOrBetter` (placeholder).
Tests updated: 61/61 pass.
Adds a "Filter by Nutri-Score" switch and an A–E discrete slider to
the ingredient search filter popover. The worst acceptable grade is
sent to the backend as `nutriscore__lte=<a|b|c|d|e>`, matching the
new filter exposed by wger-project/wger#2295.
- Extend `IngredientFilters` with `filterNutriscore` + `nutriscoreMax`
- Persist both settings through `PreferenceHelper`
- Expose `toggleNutriscore` and `chooseNutriscoreMax` on the riverpod
notifier
- Propagate `nutriscoreMax` through `NutritionPlansProvider.searchIngredient`
- Add English strings `filterNutriscore` / `filterNutriscoreMax`
- Widget tests cover: slider hidden until switch flipped, query emitted
with/without the filter
- Update stale generated Mockito overrides across the four test files
that mock `NutritionPlansProvider` so the new named arg lines up
Refs wger-project/wger#2295
We can simply use the regular "exerciseinfo" endpoint, like we do for
ingredients. We still call fetchAndSetExercise for them, which is not
efficient, but
This makes working with it a bit easier
# Conflicts:
# lib/models/exercises/exercise_submission.dart
# lib/models/exercises/exercise_submission.freezed.dart
# lib/models/exercises/exercise_submission.g.dart
When adding an extra exercise during a workout, addExerciseAfterPage()
creates a SetConfigData with no unit objects loaded. Log.fromSetConfigData
was using the weightUnit/repetitionUnit setters which overwrite the default
IDs with null when the objects are null, causing the server to reject the
request with a ValidationError ("Repetitions unit must be present").
Fixes#1149
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>