fix home error
This commit is contained in:
parent
f18a70b312
commit
fabb77d2b9
@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
import 'dart:ui';
|
||||
import 'package:enaklo_pos/core/constants/theme.dart';
|
||||
import 'package:enaklo_pos/core/network/dio_client.dart';
|
||||
import 'package:enaklo_pos/data/datasources/analytic_remote_datasource.dart';
|
||||
@ -77,8 +78,6 @@ import 'package:enaklo_pos/presentation/setting/bloc/sync_product/sync_product_b
|
||||
import 'package:enaklo_pos/presentation/setting/bloc/tax_settings/tax_settings_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/table/blocs/update_table/update_table_bloc.dart';
|
||||
import 'package:enaklo_pos/presentation/home/bloc/add_order_items/add_order_items_bloc.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'presentation/auth/bloc/login/login_bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@ -86,24 +85,26 @@ import 'presentation/home/pages/dashboard_page.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// await LamanPrint.init();
|
||||
// final dir = await getApplicationDocumentsDirectory();
|
||||
// Hive.init(dir.path);
|
||||
// Hive.registerAdapter(TableDataAdapter());
|
||||
|
||||
runZonedGuarded(() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
await Firebase.initializeApp();
|
||||
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
||||
|
||||
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
|
||||
// ✅ Tambah custom logs
|
||||
FlutterError.onError = (errorDetails) {
|
||||
FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails);
|
||||
};
|
||||
|
||||
// ✅ Catch platform errors juga
|
||||
PlatformDispatcher.instance.onError = (error, stack) {
|
||||
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
|
||||
return true;
|
||||
};
|
||||
|
||||
await SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.landscapeLeft,
|
||||
DeviceOrientation.landscapeRight,
|
||||
]);
|
||||
runApp(ProviderScope(child: MyApp()));
|
||||
}, (error, stack) {
|
||||
// ✅ Ini udah bener
|
||||
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
|
||||
});
|
||||
}
|
||||
|
||||
@ -202,21 +202,14 @@ class _HomePageState extends State<HomePage> {
|
||||
return NotificationListener<
|
||||
ScrollNotification>(
|
||||
onNotification: (notification) {
|
||||
return state.maybeWhen(
|
||||
orElse: () => false,
|
||||
loaded: (products,
|
||||
hasReachedMax,
|
||||
currentPage,
|
||||
isLoadingMore) {
|
||||
return _handleScrollNotification(
|
||||
notification, categoryId);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: GridView.builder(
|
||||
itemCount: products.length,
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.all(16),
|
||||
cacheExtent: 80.0,
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: 180,
|
||||
|
||||
@ -60,6 +60,8 @@ class ProductCard extends StatelessWidget {
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: 120,
|
||||
memCacheHeight: 120,
|
||||
memCacheWidth: 120,
|
||||
errorWidget: (context, url, error) => Container(
|
||||
width: double.infinity,
|
||||
height: 120,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user