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

View File

@ -128,7 +128,7 @@ class CategoryLocalDatasource {
whereArgs.add('%$search%');
}
query += ' ORDER BY name ASC';
// query += ' ORDER BY name ASC';
if (limit > 0) {
query += ' LIMIT ?';

View File

@ -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');

View File

@ -54,7 +54,19 @@ class ProductCard extends StatelessWidget {
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
child: CachedNetworkImage(
child: data.imageUrl == ""
? Container(
width: double.infinity,
height: 120,
decoration: BoxDecoration(
color: AppColors.disabled.withOpacity(0.4),
),
child: const Icon(
Icons.image,
color: AppColors.grey,
),
)
: CachedNetworkImage(
imageUrl: (data.imageUrl ?? "").contains('http')
? data.imageUrl!
: '${Variables.baseUrl}/${data.imageUrl}',
@ -68,7 +80,7 @@ class ProductCard extends StatelessWidget {
error,
StackTrace.current,
reason:
'Failed to load image from: $url, productId: ${data.id}, productName: ${data.name}',
'Failed to load image from: $url, productId: ${data.id}, productName: ${data.name}, dataUrl: ${data.imageUrl}',
fatal: false,
);
return Container(

View File

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.2+6
version: 1.0.2+7
environment:
sdk: ">=3.2.4 <4.0.0"