This commit is contained in:
efrilm
2025-10-23 20:11:16 +07:00
parent 290360674f
commit e585cf4292
4 changed files with 40 additions and 26 deletions
@@ -47,7 +47,7 @@ class CategoryLoaderBloc
final result = await _categoryRepository.getCategories(
page: 1,
limit: 10,
limit: 50,
isActive: event.isActive,
search: event.search,
forceRemote: event.forceRemote,
@@ -59,11 +59,13 @@ class CategoryLoaderBloc
emit(CategoryLoaderState.error(failure));
},
(response) async {
final categories = response.data.categories;
categories.insert(0, CategoryModel.all());
final categories = [
CategoryModel.all(),
...response.data.categories,
];
final totalPages = response.data.totalPages;
final hasReachedMax = categories.length < 10 || 1 >= totalPages;
final hasReachedMax = categories.length < 50 || 1 >= totalPages;
log('✅ Categories loaded: ${categories.length}, hasReachedMax: $hasReachedMax');