fix force close

This commit is contained in:
efrilm 2025-10-07 21:49:15 +07:00
parent 455a6afd70
commit 613b216c04
5 changed files with 76 additions and 58 deletions

View File

@ -117,4 +117,14 @@ class CategoryModel {
'updated_at': updatedAt.toIso8601String(),
};
}
factory CategoryModel.all() => CategoryModel(
id: 'all',
organizationId: '',
name: 'Semua',
businessType: 'restaurant',
metadata: {},
createdAt: DateTime.now(),
updatedAt: DateTime.now(),
);
}

View File

@ -65,6 +65,8 @@ class CategoryLoaderBloc
log('✅ Categories loaded: ${categories.length}, hasReachedMax: $hasReachedMax');
categories.insert(0, CategoryModel.all());
emit(CategoryLoaderState.loaded(
categories: categories,
hasReachedMax: hasReachedMax,

View File

@ -49,9 +49,7 @@ class _CategoryTabBarState extends State<CategoryTabBar>
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: widget.categories.length,
child: Column(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Material(
@ -90,7 +88,6 @@ class _CategoryTabBarState extends State<CategoryTabBar>
),
),
],
),
);
}
}

View File

@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:enaklo_pos/core/extensions/int_ext.dart';
import 'package:enaklo_pos/presentation/home/dialog/variant_dialog.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:enaklo_pos/core/constants/variables.dart';
@ -62,7 +63,15 @@ class ProductCard extends StatelessWidget {
height: 120,
memCacheHeight: 120,
memCacheWidth: 120,
errorWidget: (context, url, error) => Container(
errorWidget: (context, url, error) {
FirebaseCrashlytics.instance.recordError(
error,
StackTrace.current,
reason:
'Failed to load image from: $url, productId: ${data.id}, productName: ${data.name}',
fatal: false,
);
return Container(
width: double.infinity,
height: 120,
decoration: BoxDecoration(
@ -72,8 +81,8 @@ class ProductCard extends StatelessWidget {
Icons.image,
color: AppColors.grey,
),
),
),
);
}),
),
const Spacer(),
Text(

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.1+4
version: 1.0.2+4
environment:
sdk: ">=3.2.4 <4.0.0"