diff --git a/kitchenowl/lib/cubits/shoppinglist_cubit.dart b/kitchenowl/lib/cubits/shoppinglist_cubit.dart index a1c5c5a8..a44f6d80 100644 --- a/kitchenowl/lib/cubits/shoppinglist_cubit.dart +++ b/kitchenowl/lib/cubits/shoppinglist_cubit.dart @@ -18,13 +18,12 @@ class ShoppinglistCubit extends Cubit { final Household household; Future? _refreshThread; String? _refreshCurrentQuery; - int Function() recentItemCountProvider; String get query => (state is SearchShoppinglistCubitState) ? (state as SearchShoppinglistCubitState).query : ""; - ShoppinglistCubit(this.household, this.recentItemCountProvider) + ShoppinglistCubit(this.household) : super(const LoadingShoppinglistCubitState()) { PreferenceStorage.getInstance().readInt(key: 'itemSorting').then((i) { if (i != null && state.sorting.index != i) { @@ -155,9 +154,6 @@ class ShoppinglistCubit extends Cubit { final recent = List.of(shoppinglist.recentItems); recent.removeWhere((e) => e.name == item.name); recent.insert(0, ItemWithDescription.fromItem(item: item)); - if (recent.length > recentItemCountProvider()) { - recent.removeLast(); - } if (_state is SearchShoppinglistCubitState) { final result = List.of(_state.result); final index = result.indexOf(item); @@ -208,9 +204,6 @@ class ShoppinglistCubit extends Cubit { 0, selectedItems.map((e) => ItemWithDescription.fromItem(item: e)), ); - if (recent.length > recentItemCountProvider()) { - recent.removeRange(recentItemCountProvider(), recent.length); - } if (_state is SearchShoppinglistCubitState) { final result = List.of(_state.result); diff --git a/kitchenowl/lib/pages/household_page.dart b/kitchenowl/lib/pages/household_page.dart index 9b5a85d2..95dfa6e6 100644 --- a/kitchenowl/lib/pages/household_page.dart +++ b/kitchenowl/lib/pages/household_page.dart @@ -41,10 +41,7 @@ class _HouseholdPageState extends State { void initState() { super.initState(); householdCubit = HouseholdCubit(widget.household); - shoppingListCubit = ShoppinglistCubit( - widget.household, - () => App.settings.recentItemsCount, - ); + shoppingListCubit = ShoppinglistCubit(widget.household); recipeListCubit = RecipeListCubit(widget.household); plannerCubit = PlannerCubit(widget.household); expenseListCubit = ExpenseListCubit(widget.household);