Merge master

This commit is contained in:
Roland Geider
2026-04-30 19:41:17 +02:00
19 changed files with 326 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shared_preferences/util/legacy_to_async_migration_util.dart';
import 'package:wger/models/nutrition/ingredient.dart';
import 'package:wger/providers/nutrition_repository.dart';
/// A helper class that manages preferences using SharedPreferencesAsync
@@ -68,4 +69,24 @@ class PreferenceHelper {
);
}
}
//4.nutri-score worst acceptable grade (null means the filter is off)
Future<void> saveIngredientNutriscoreMax(NutriScore? value) async {
if (value == null) {
await PreferenceHelper.asyncPref.remove('ingredientNutriscoreMax');
} else {
await PreferenceHelper.asyncPref.setString('ingredientNutriscoreMax', value.name);
}
}
Future<NutriScore?> getIngredientNutriscoreMax() async {
final value = await PreferenceHelper.asyncPref.getString('ingredientNutriscoreMax');
if (value == null) {
return null;
}
return NutriScore.values.firstWhere(
(e) => e.name == value,
orElse: () => NutriScore.c,
);
}
}

View File

@@ -1255,5 +1255,27 @@
"syncStatusErrorDetails": "Error details",
"@syncStatusErrorDetails": {
"description": "Header of the expandable section in the sync status dialog that reveals the raw error message"
},
"filterNutriscore": "Nutri-Score filter",
"@filterNutriscore": {
"description": "Heading for the Nutri-Score slider in the ingredient search filter dialog"
},
"filterNutriscoreOff": "Off",
"@filterNutriscoreOff": {
"description": "Label for the first slider stop, which disables the Nutri-Score filter"
},
"filterNutriscoreNoFilter": "No filter",
"@filterNutriscoreNoFilter": {
"description": "Helper text shown under the Nutri-Score slider when it is at the Off position"
},
"filterNutriscoreOrBetter": "{grade} or better",
"@filterNutriscoreOrBetter": {
"description": "Helper text shown under the Nutri-Score slider when a grade is selected (e.g. 'C or better')",
"placeholders": {
"grade": {
"type": "String",
"example": "C"
}
}
}
}

View File

@@ -1,25 +1,36 @@
//model is used to store ingredient filters values
import 'package:wger/models/nutrition/ingredient.dart';
import 'package:wger/providers/nutrition_repository.dart';
class IngredientFilters {
final bool isVegan;
final bool isVegetarian;
final IngredientSearchLanguage searchLanguage;
/// Worst acceptable Nutri-Score grade, sent to the backend as
/// `nutriscore__lte`. `null` means the filter is off (slider at the
/// "No filter" position).
final NutriScore? nutriscoreMax;
IngredientFilters({
required this.isVegan,
required this.isVegetarian,
required this.searchLanguage,
this.nutriscoreMax,
});
IngredientFilters copyWith({
bool? isVegan,
bool? isVegetarian,
IngredientSearchLanguage? searchLanguage,
NutriScore? nutriscoreMax,
bool clearNutriscoreMax = false,
}) {
return IngredientFilters(
isVegan: isVegan ?? this.isVegan,
isVegetarian: isVegetarian ?? this.isVegetarian,
searchLanguage: searchLanguage ?? this.searchLanguage,
nutriscoreMax: clearNutriscoreMax ? null : (nutriscoreMax ?? this.nutriscoreMax),
);
}
}

View File

@@ -55,10 +55,8 @@ class IngredientRepository {
}
/// Substring-search by name against the locally-synced ingredients,
/// with optional diet-flag filters. Used for offline-mode ingredient
/// pickers — PowerSync's sync_rules only pull ingredients down when
/// they're referenced by one of the user's plans or logs, so the
/// effective search corpus is the user's previously-used ingredients.
/// with optional diet-flag and Nutri-Score filters. Used for offline-mode
/// ingredient pickers
///
/// Hydrates `image` and `weightUnits` on the returned rows so the
/// result is shape-compatible with the REST search.
@@ -66,6 +64,7 @@ class IngredientRepository {
String term, {
bool isVegan = false,
bool isVegetarian = false,
NutriScore? nutriscoreMax,
int limit = 100,
}) async {
_logger.finer('Local ingredient search: "$term"');
@@ -78,6 +77,9 @@ class IngredientRepository {
if (isVegetarian) {
query.where(_db.ingredientTable.isVegetarian.equals(true));
}
if (nutriscoreMax != null) {
query.where(_db.ingredientTable.nutriscore.isSmallerOrEqualValue(nutriscoreMax.name));
}
query
..orderBy([OrderingTerm(expression: _db.ingredientTable.name)])
..limit(limit);

View File

@@ -19,6 +19,7 @@
import 'package:flutter_riverpod/flutter_riverpod.dart' show Provider;
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:wger/helpers/shared_preferences.dart';
import 'package:wger/models/nutrition/ingredient.dart';
import 'package:wger/models/nutrition/ingredient_filters.dart';
import 'package:wger/providers/nutrition_repository.dart';
@@ -33,10 +34,12 @@ class IngredientFiltersNotifier extends _$IngredientFiltersNotifier {
final isVegan = await preferenceHelper.getIngredientVeganFilter();
final isVegetarian = await preferenceHelper.getIngredientVegetarianFilter();
final searchLanguage = await preferenceHelper.getIngredientSearchLanguage();
final nutriscoreMax = await preferenceHelper.getIngredientNutriscoreMax();
return IngredientFilters(
isVegan: isVegan,
isVegetarian: isVegetarian,
searchLanguage: searchLanguage,
nutriscoreMax: nutriscoreMax,
);
}
@@ -67,6 +70,16 @@ class IngredientFiltersNotifier extends _$IngredientFiltersNotifier {
state = AsyncData(current.copyWith(searchLanguage: value));
await PreferenceHelper.instance.saveIngredientSearchLanguage(value);
}
Future<void> chooseNutriscoreMax(NutriScore? value) async {
final current = _current();
state = AsyncData(
value == null
? current.copyWith(clearNutriscoreMax: true)
: current.copyWith(nutriscoreMax: value),
);
await PreferenceHelper.instance.saveIngredientNutriscoreMax(value);
}
}
// Synchronous helper provider to unwrap the AsyncValue produced by `ingredientFiltersProvider`

View File

@@ -33,7 +33,7 @@ final class IngredientFiltersNotifierProvider
IngredientFiltersNotifier create() => IngredientFiltersNotifier();
}
String _$ingredientFiltersNotifierHash() => r'839633dd545b6a9a6cbb8840098fe15f7c827897';
String _$ingredientFiltersNotifierHash() => r'0d6cc41b8e45673367dc756d55a95b8ac4252d7d';
abstract class _$IngredientFiltersNotifier extends $AsyncNotifier<IngredientFilters> {
FutureOr<IngredientFilters> build();

View File

@@ -313,6 +313,7 @@ class NutritionNotifier extends _$NutritionNotifier {
IngredientSearchLanguage searchLanguage = IngredientSearchLanguage.current,
bool isVegan = false,
bool isVegetarian = false,
NutriScore? nutriscoreMax,
}) {
final repo = ref.read(nutritionRepositoryProvider);
return repo.searchIngredient(
@@ -321,6 +322,7 @@ class NutritionNotifier extends _$NutritionNotifier {
searchLanguage: searchLanguage,
isVegan: isVegan,
isVegetarian: isVegetarian,
nutriscoreMax: nutriscoreMax,
);
}

View File

@@ -33,7 +33,7 @@ final class NutritionNotifierProvider
NutritionNotifier create() => NutritionNotifier();
}
String _$nutritionNotifierHash() => r'f878ce8a83635739948af8b2f27fd8d239880207';
String _$nutritionNotifierHash() => r'afac5137c8f510197cbefb08fe595f8a59d4024b';
abstract class _$NutritionNotifier extends $StreamNotifier<NutritionState> {
Stream<NutritionState> build();

View File

@@ -155,12 +155,19 @@ class NutritionRepository {
// --- Ingredients ---
/// Searches for an ingredient via the REST API.
///
/// [nutriscoreMax] — if non-null, the worst acceptable Nutri-Score grade,
/// sent to the backend as `nutriscore__lte`. The Django filterset
/// compares lexicographically on the `a`..`e` choices, so passing
/// [NutriScore.b] yields "only A or B".
Future<List<Ingredient>> searchIngredient(
String name, {
String languageCode = 'en',
IngredientSearchLanguage searchLanguage = IngredientSearchLanguage.current,
bool isVegan = false,
bool isVegetarian = false,
NutriScore? nutriscoreMax,
}) async {
if (name.length <= 1) {
return [];
@@ -193,6 +200,9 @@ class NutritionRepository {
if (isVegetarian) {
query['is_vegetarian'] = 'true';
}
if (nutriscoreMax != null) {
query['nutriscore__lte'] = nutriscoreMax.name;
}
_logger.info('Searching ingredients from server');
final response = await _base.fetch(

View File

@@ -157,7 +157,8 @@ class _IngredientTypeaheadState extends ConsumerState<IngredientTypeahead> {
widget.onDeselectIngredient();
// Online: REST search across all ingredients in the wger DB.
// Offline: SQL substring search against the local snapshot
// Offline: SQL substring search against the local snapshot.
// Both honour the diet flags and the Nutri-Score filter.
if (ref.read(networkStatusProvider)) {
return ref
.read(nutritionProvider.notifier)
@@ -167,6 +168,7 @@ class _IngredientTypeaheadState extends ConsumerState<IngredientTypeahead> {
searchLanguage: filters.searchLanguage,
isVegan: filters.isVegan,
isVegetarian: filters.isVegetarian,
nutriscoreMax: filters.nutriscoreMax,
);
}
return ref
@@ -175,6 +177,7 @@ class _IngredientTypeaheadState extends ConsumerState<IngredientTypeahead> {
pattern,
isVegan: filters.isVegan,
isVegetarian: filters.isVegetarian,
nutriscoreMax: filters.nutriscoreMax,
);
},
itemBuilder: (context, ingredient) {
@@ -382,6 +385,16 @@ class _IngredientTypeaheadState extends ConsumerState<IngredientTypeahead> {
});
},
),
_NutriscoreSlider(
value: filters.nutriscoreMax,
onChanged: (grade) {
setDialogState(() {
ref
.read(ingredientFiltersProvider.notifier)
.chooseNutriscoreMax(grade);
});
},
),
],
),
actions: [
@@ -402,6 +415,74 @@ class _IngredientTypeaheadState extends ConsumerState<IngredientTypeahead> {
}
}
/// Discrete slider that lets the user pick the worst acceptable [NutriScore]
/// grade. Index 0 is the "Off" position (no filter, `null` value) and
/// indices 1..N map to [NutriScore.values].
class _NutriscoreSlider extends StatelessWidget {
final NutriScore? value;
final ValueChanged<NutriScore?> onChanged;
const _NutriscoreSlider({required this.value, required this.onChanged});
static const int _offIndex = 0;
int _valueToIndex(NutriScore? v) => v == null ? _offIndex : NutriScore.values.indexOf(v) + 1;
NutriScore? _indexToValue(int i) => i == _offIndex ? null : NutriScore.values[i - 1];
@override
Widget build(BuildContext context) {
final i18n = AppLocalizations.of(context);
final index = _valueToIndex(value);
final maxIndex = NutriScore.values.length; // 0=Off, then A..E
final helperText = value == null
? i18n.filterNutriscoreNoFilter
: i18n.filterNutriscoreOrBetter(value!.name.toUpperCase());
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
i18n.filterNutriscore,
style: Theme.of(context).textTheme.bodyMedium,
),
Text(
helperText,
style: Theme.of(context).textTheme.bodySmall,
),
Slider(
value: index.toDouble(),
min: 0,
max: maxIndex.toDouble(),
divisions: maxIndex,
label: value == null ? i18n.filterNutriscoreOff : value!.name.toUpperCase(),
onChanged: (v) => onChanged(_indexToValue(v.round())),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
i18n.filterNutriscoreOff,
style: Theme.of(context).textTheme.labelSmall,
),
...NutriScore.values.map(
(score) => Text(
score.name.toUpperCase(),
style: Theme.of(context).textTheme.labelSmall,
),
),
],
),
),
],
),
);
}
}
class IngredientAvatar extends ConsumerWidget {
final Ingredient ingredient;

View File

@@ -85,10 +85,10 @@ packages:
dependency: "direct dev"
description:
name: build_runner
sha256: "521daf8d189deb79ba474e43a696b41c49fb3987818dbacf3308f1e03673a75e"
sha256: "4425a87d87d0d1303540f867994303f5b141ad2f6ecac7ac2cf8851f41c0cef1"
url: "https://pub.dev"
source: hosted
version: "2.13.1"
version: "2.14.0"
built_collection:
dependency: transitive
description:
@@ -109,26 +109,26 @@ packages:
dependency: transitive
description:
name: camera
sha256: "4142a19a38e388d3bab444227636610ba88982e36dff4552d5191a86f65dc437"
sha256: "034c38cb8014d29698dcae6d20276688a1bf74e6487dfeb274d70ea05d5f7777"
url: "https://pub.dev"
source: hosted
version: "0.11.4"
version: "0.12.0+1"
camera_android_camerax:
dependency: transitive
description:
name: camera_android_camerax
sha256: "8516fe308bc341a5067fb1a48edff0ddfa57c0d3cdcc9dbe7ceca3ba119e2577"
sha256: b5064cf25a2787d122d0bf12e77c7b1033a2b983d0730e3091f770ee376efde5
url: "https://pub.dev"
source: hosted
version: "0.6.30"
version: "0.7.2"
camera_avfoundation:
dependency: transitive
description:
name: camera_avfoundation
sha256: "11b4aee2f5e5e038982e152b4a342c749b414aa27857899d20f4323e94cb5f0b"
sha256: "90e4cc3fde331581a3b2d35d83be41dbb7393af0ab857eb27b732174289cb96d"
url: "https://pub.dev"
source: hosted
version: "0.9.23+2"
version: "0.10.1"
camera_platform_interface:
dependency: transitive
description:
@@ -566,10 +566,10 @@ packages:
dependency: "direct main"
description:
name: flutter_zxing
sha256: dbcd89da2c9aa84f48d7d7e1ba436825f8656a69b142abb7bcdb7c2d9c22d48c
sha256: "6bf0cb0fde122455e73ae78214457c106fbde3c633af4624ce29567ac590ef21"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
version: "2.3.0"
font_awesome_flutter:
dependency: "direct main"
description:
@@ -627,10 +627,10 @@ packages:
dependency: transitive
description:
name: hooks
sha256: e79ed1e8e1929bc6ecb6ec85f0cb519c887aa5b423705ded0d0f2d9226def388
sha256: "025f060e86d2d4c3c47b56e33caf7f93bf9283340f26d23424ebcfccf34f621e"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "1.0.3"
html:
dependency: transitive
description:
@@ -976,18 +976,18 @@ packages:
dependency: "direct main"
description:
name: package_info_plus
sha256: c2a4a9404e578d7c69e3cf19f0b057d906bd0b073deedc8006db997a8bfe97ca
sha256: "4bf625947f6c7713ee242296a682e23e44823c09cf9d79e4f1238923c92db852"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
version: "10.1.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "063b21cce7a2e3d902897d6cefc3bd211bb8ea42190698be72219cd5017f1c65"
sha256: db762cb2f4f25ee60fb6359773861b0f199e00b90d237bd85a76a1e806b46ef4
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "4.1.0"
path:
dependency: "direct main"
description:
@@ -1148,6 +1148,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.0"
record_use:
dependency: transitive
description:
name: record_use
sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
rfc_6901:
dependency: transitive
description:
@@ -1685,10 +1693,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: "316d813e24518851c2682b1a57bc7e2e54e9c7b81493d48bef502fea0c17f841"
sha256: ba7d5750e3441caa1bbe31d9e516348fcf8dfcb32aa29ef87a844a59f4d1f1d0
url: "https://pub.dev"
source: hosted
version: "6.0.1"
version: "6.1.0"
xdg_directories:
dependency: transitive
description:

View File

@@ -269,6 +269,7 @@ class MockNutritionRepository extends _i1.Mock implements _i7.NutritionRepositor
_i7.IngredientSearchLanguage? searchLanguage = _i7.IngredientSearchLanguage.current,
bool? isVegan = false,
bool? isVegetarian = false,
_i9.NutriScore? nutriscoreMax,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -279,6 +280,7 @@ class MockNutritionRepository extends _i1.Mock implements _i7.NutritionRepositor
#searchLanguage: searchLanguage,
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
},
),
returnValue: _i4.Future<List<_i9.Ingredient>>.value(
@@ -351,13 +353,19 @@ class MockIngredientRepository extends _i1.Mock implements _i11.IngredientReposi
String? term, {
bool? isVegan = false,
bool? isVegetarian = false,
_i9.NutriScore? nutriscoreMax,
int? limit = 100,
}) =>
(super.noSuchMethod(
Invocation.method(
#searchByName,
[term],
{#isVegan: isVegan, #isVegetarian: isVegetarian, #limit: limit},
{
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
#limit: limit,
},
),
returnValue: _i4.Future<List<_i9.Ingredient>>.value(
<_i9.Ingredient>[],

View File

@@ -53,6 +53,7 @@ void main() {
searchLanguage: anyNamed('searchLanguage'),
isVegan: anyNamed('isVegan'),
isVegetarian: anyNamed('isVegetarian'),
nutriscoreMax: anyNamed('nutriscoreMax'),
),
).thenAnswer(
(invocation) => Future.value([
@@ -137,6 +138,7 @@ void main() {
searchLanguage: anyNamed('searchLanguage'),
isVegan: anyNamed('isVegan'),
isVegetarian: anyNamed('isVegetarian'),
nutriscoreMax: anyNamed('nutriscoreMax'),
),
).thenAnswer((_) => Future.value([ingredient1]));
@@ -160,6 +162,7 @@ void main() {
searchLanguage: anyNamed('searchLanguage'),
isVegan: anyNamed('isVegan'),
isVegetarian: anyNamed('isVegetarian'),
nutriscoreMax: anyNamed('nutriscoreMax'),
),
).thenAnswer((_) => Future.value([milk]));
@@ -181,6 +184,7 @@ void main() {
searchLanguage: anyNamed('searchLanguage'),
isVegan: anyNamed('isVegan'),
isVegetarian: anyNamed('isVegetarian'),
nutriscoreMax: anyNamed('nutriscoreMax'),
),
).thenAnswer((_) => Future.value([ingredient2]));
@@ -224,6 +228,78 @@ void main() {
searchLanguage: IngredientSearchLanguage.current,
isVegan: true,
isVegetarian: false,
nutriscoreMax: null,
),
).called(1);
});
testWidgets('Nutri-Score slider is always visible and defaults to Off', (
WidgetTester tester,
) async {
await tester.pumpWidget(createWidgetUnderTest());
await tester.tap(find.byIcon(Icons.tune));
await tester.pumpAndSettle();
// Slider is rendered by default, at the Off position (value == 0)
final sliderFinder = find.byType(Slider);
expect(sliderFinder, findsOneWidget);
expect(tester.widget<Slider>(sliderFinder).value, 0.0);
// The "No filter" helper text is shown
expect(find.text('No filter'), findsOneWidget);
});
testWidgets('Moving the slider sends nutriscoreMax on subsequent search', (
WidgetTester tester,
) async {
await tester.pumpWidget(createWidgetUnderTest());
await tester.tap(find.byIcon(Icons.tune));
await tester.pumpAndSettle();
// Move the slider off the Off position — index 1 is the first grade, A
final sliderFinder = find.byType(Slider);
final Slider slider = tester.widget<Slider>(sliderFinder);
slider.onChanged!(1.0);
await tester.pumpAndSettle();
await tester.tap(find.text('Close'));
await tester.pumpAndSettle();
// Act
await tester.enterText(find.byType(TextFormField), 'Apple');
await tester.pump(const Duration(milliseconds: 600));
// Assert — index 1 maps to NutriScore.a
verify(
mockRepo.searchIngredient(
'Apple',
languageCode: 'en',
searchLanguage: IngredientSearchLanguage.current,
isVegan: false,
isVegetarian: false,
nutriscoreMax: NutriScore.a,
),
).called(1);
});
testWidgets('Search omits nutriscoreMax when the slider is at Off', (
WidgetTester tester,
) async {
await tester.pumpWidget(createWidgetUnderTest());
await tester.enterText(find.byType(TextFormField), 'Apple');
await tester.pump(const Duration(milliseconds: 600));
verify(
mockRepo.searchIngredient(
'Apple',
languageCode: 'en',
searchLanguage: IngredientSearchLanguage.current,
isVegan: false,
isVegetarian: false,
nutriscoreMax: null,
),
).called(1);
});

View File

@@ -183,6 +183,7 @@ class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepositor
_i3.IngredientSearchLanguage? searchLanguage = _i3.IngredientSearchLanguage.current,
bool? isVegan = false,
bool? isVegetarian = false,
_i6.NutriScore? nutriscoreMax,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -193,6 +194,7 @@ class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepositor
#searchLanguage: searchLanguage,
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
},
),
returnValue: _i4.Future<List<_i6.Ingredient>>.value(
@@ -265,13 +267,19 @@ class MockIngredientRepository extends _i1.Mock implements _i8.IngredientReposit
String? term, {
bool? isVegan = false,
bool? isVegetarian = false,
_i6.NutriScore? nutriscoreMax,
int? limit = 100,
}) =>
(super.noSuchMethod(
Invocation.method(
#searchByName,
[term],
{#isVegan: isVegan, #isVegetarian: isVegetarian, #limit: limit},
{
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
#limit: limit,
},
),
returnValue: _i4.Future<List<_i6.Ingredient>>.value(
<_i6.Ingredient>[],

View File

@@ -118,6 +118,7 @@ void main() {
searchLanguage: anyNamed('searchLanguage'),
isVegan: anyNamed('isVegan'),
isVegetarian: anyNamed('isVegetarian'),
nutriscoreMax: anyNamed('nutriscoreMax'),
),
).thenAnswer(
(_) => Future.value([ingredient1, ingredient2]),

View File

@@ -183,6 +183,7 @@ class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepositor
_i3.IngredientSearchLanguage? searchLanguage = _i3.IngredientSearchLanguage.current,
bool? isVegan = false,
bool? isVegetarian = false,
_i6.NutriScore? nutriscoreMax,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -193,6 +194,7 @@ class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepositor
#searchLanguage: searchLanguage,
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
},
),
returnValue: _i4.Future<List<_i6.Ingredient>>.value(
@@ -265,13 +267,19 @@ class MockIngredientRepository extends _i1.Mock implements _i8.IngredientReposit
String? term, {
bool? isVegan = false,
bool? isVegetarian = false,
_i6.NutriScore? nutriscoreMax,
int? limit = 100,
}) =>
(super.noSuchMethod(
Invocation.method(
#searchByName,
[term],
{#isVegan: isVegan, #isVegetarian: isVegetarian, #limit: limit},
{
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
#limit: limit,
},
),
returnValue: _i4.Future<List<_i6.Ingredient>>.value(
<_i6.Ingredient>[],

View File

@@ -193,6 +193,7 @@ class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepositor
_i3.IngredientSearchLanguage? searchLanguage = _i3.IngredientSearchLanguage.current,
bool? isVegan = false,
bool? isVegetarian = false,
_i6.NutriScore? nutriscoreMax,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -203,6 +204,7 @@ class MockNutritionRepository extends _i1.Mock implements _i3.NutritionRepositor
#searchLanguage: searchLanguage,
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
},
),
returnValue: _i4.Future<List<_i6.Ingredient>>.value(
@@ -275,13 +277,19 @@ class MockIngredientRepository extends _i1.Mock implements _i8.IngredientReposit
String? term, {
bool? isVegan = false,
bool? isVegetarian = false,
_i6.NutriScore? nutriscoreMax,
int? limit = 100,
}) =>
(super.noSuchMethod(
Invocation.method(
#searchByName,
[term],
{#isVegan: isVegan, #isVegetarian: isVegetarian, #limit: limit},
{
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
#limit: limit,
},
),
returnValue: _i4.Future<List<_i6.Ingredient>>.value(
<_i6.Ingredient>[],

View File

@@ -199,6 +199,7 @@ class MockNutritionRepository extends _i1.Mock implements _i4.NutritionRepositor
_i4.IngredientSearchLanguage? searchLanguage = _i4.IngredientSearchLanguage.current,
bool? isVegan = false,
bool? isVegetarian = false,
_i7.NutriScore? nutriscoreMax,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -209,6 +210,7 @@ class MockNutritionRepository extends _i1.Mock implements _i4.NutritionRepositor
#searchLanguage: searchLanguage,
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
},
),
returnValue: _i5.Future<List<_i7.Ingredient>>.value(
@@ -281,13 +283,19 @@ class MockIngredientRepository extends _i1.Mock implements _i9.IngredientReposit
String? term, {
bool? isVegan = false,
bool? isVegetarian = false,
_i7.NutriScore? nutriscoreMax,
int? limit = 100,
}) =>
(super.noSuchMethod(
Invocation.method(
#searchByName,
[term],
{#isVegan: isVegan, #isVegetarian: isVegetarian, #limit: limit},
{
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
#limit: limit,
},
),
returnValue: _i5.Future<List<_i7.Ingredient>>.value(
<_i7.Ingredient>[],

View File

@@ -191,6 +191,7 @@ class MockNutritionRepository extends _i1.Mock implements _i4.NutritionRepositor
_i4.IngredientSearchLanguage? searchLanguage = _i4.IngredientSearchLanguage.current,
bool? isVegan = false,
bool? isVegetarian = false,
_i7.NutriScore? nutriscoreMax,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -201,6 +202,7 @@ class MockNutritionRepository extends _i1.Mock implements _i4.NutritionRepositor
#searchLanguage: searchLanguage,
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
},
),
returnValue: _i5.Future<List<_i7.Ingredient>>.value(
@@ -273,13 +275,19 @@ class MockIngredientRepository extends _i1.Mock implements _i9.IngredientReposit
String? term, {
bool? isVegan = false,
bool? isVegetarian = false,
_i7.NutriScore? nutriscoreMax,
int? limit = 100,
}) =>
(super.noSuchMethod(
Invocation.method(
#searchByName,
[term],
{#isVegan: isVegan, #isVegetarian: isVegetarian, #limit: limit},
{
#isVegan: isVegan,
#isVegetarian: isVegetarian,
#nutriscoreMax: nutriscoreMax,
#limit: limit,
},
),
returnValue: _i5.Future<List<_i7.Ingredient>>.value(
<_i7.Ingredient>[],