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>
This makes the logic for copying or modifying the logs much easier. Also,
there were some user reports that the old logic sometimes behaved erratically
and old values were sometimes reverted.