Filters Fix

wala_plus_with_dialog_removal
FaizHashmi 2 weeks ago
parent c976b9c9db
commit 367218702b

@ -335,7 +335,11 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
try {
int nextPage = currentPage + 1;
String catParam = (currentCategoryId == "all" || currentCategoryId == "0") ? "" : currentCategoryId;
// Must match fetchOffers's category resolution exactly (including the selected
// subcategory, if any) - otherwise pagination silently switches filters mid-scroll,
// fetching an overlapping result set under the same page number and duplicating items.
String effectiveCategoryId = _selectedSubcategoryId ?? currentCategoryId;
String catParam = (effectiveCategoryId == "all" || effectiveCategoryId == "0") ? "" : effectiveCategoryId;
String? offerTypeParam = OffersAndDiscountsApiClient.mapOfferTypeFilter(selectedTypeFilter);
String? queryParam = searchQuery.trim().isNotEmpty ? searchQuery.trim() : null;
int? radiusParam = _radiusFromFilterDistance(_filterDistance);
@ -378,7 +382,8 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
}
Future<void> _onRefresh() async {
await Future.wait<dynamic>(<Future<void>>[fetchCategories(), fetchOffers(categoryId: currentCategoryId.isEmpty ? "all" : currentCategoryId, query: _searchController.text)]);
String effectiveCategoryId = _selectedSubcategoryId ?? (currentCategoryId.isEmpty ? "all" : currentCategoryId);
await Future.wait<dynamic>(<Future<void>>[fetchCategories(), fetchOffers(categoryId: effectiveCategoryId, query: _searchController.text)]);
}
// '5km'/'10km'/'25km' -> 5/10/25 for WP_Radius; 'any' -> null (omit the param - no distance cap).

Loading…
Cancel
Save