diff --git a/lib/initialization.dart b/lib/initialization.dart index 1d50273e..939143ca 100644 --- a/lib/initialization.dart +++ b/lib/initialization.dart @@ -53,26 +53,29 @@ Future _initializeSystemSettings() async { final crashlyticsInstance = FirebaseCrashlytics.instance; await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); + if (kDebugMode) { - //kDebugMode print('Debug mode'); + // await crashlyticsInstance.setCrashlyticsCollectionEnabled(false); } else { print('Release mode'); - bool unsentReports = - await FirebaseCrashlytics.instance.checkForUnsentReports(); - if (unsentReports) { - // Existem relatórios não enviados - await crashlyticsInstance.sendUnsentReports(); - print('Existem relatórios de falhas não enviados.'); - } else { - // Não existem relatórios não enviados - print('Todos os relatórios de falhas foram enviados.'); - } - await crashlyticsInstance.setCrashlyticsCollectionEnabled(true); - // if (crashlyticsInstance.isCrashlyticsCollectionEnabled) { - FlutterError.onError = await crashlyticsInstance.recordFlutterError; + // await crashlyticsInstance.setCrashlyticsCollectionEnabled(true); + + // Verifica e envia relatórios não enviados de forma assíncrona + // crashlyticsInstance.checkForUnsentReports().then((unsentReports) { + // if (unsentReports) { + // crashlyticsInstance.sendUnsentReports(); + // print('Existem relatórios de falhas não enviados.'); + // } else { + // print('Todos os relatórios de falhas foram enviados.'); + // } + // }).catchError((error) { + // print('Erro ao verificar ou enviar relatórios não enviados: $error'); + // }); + + // Configura o tratamento de erros não capturados + FlutterError.onError = crashlyticsInstance.recordFlutterError; print('Crashlytics enabled'); - // } } } diff --git a/lib/pages/vehicles_on_the_property/vehicle_history_screen.dart b/lib/pages/vehicles_on_the_property/vehicle_history_screen.dart index 1e90cc84..ddbf6271 100644 --- a/lib/pages/vehicles_on_the_property/vehicle_history_screen.dart +++ b/lib/pages/vehicles_on_the_property/vehicle_history_screen.dart @@ -11,7 +11,7 @@ class VehicleHistoryScreen extends StatefulWidget { class _VehicleHistoryScreenState extends State with Pageable { final apiCall = PhpGroup.getVehiclesByProperty; - int count = 0; + int totalOwnerVehicles = 0; final PagingController _pagingController = PagingController(firstPageKey: 1); bool _isSnackble = true; @@ -28,7 +28,7 @@ class _VehicleHistoryScreenState extends State (newItems.jsonBody['vehicles'] as List?) ?? []; safeSetState(() { - count = newItems.jsonBody['total_rows'] ?? 0; + totalOwnerVehicles = newItems.jsonBody['total_owner_vehicles'] ?? 0; }); return (vehicles.isNotEmpty, vehicles); @@ -96,6 +96,12 @@ class _VehicleHistoryScreenState extends State Widget _buildHeader(BuildContext context) { final bodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context); + final headerTitle = FFLocalizations.of(context).getVariableText( + ptText: "Meus Veículos: ", + enText: "My Vehicles: ", + ); + final totalRegisteredVehicles = widget.model.amountRegister; + return SizedBox( height: 30, child: Center( @@ -103,7 +109,7 @@ class _VehicleHistoryScreenState extends State (widget.model.amountRegister == '0' || widget.model.amountRegister == null) ? '' - : "${FFLocalizations.of(context).getVariableText(ptText: "Quantidade de Veículos: ", enText: "Amount of Vehicles: ")}${widget.model.amountRegister}/$count", + : "$headerTitle $totalOwnerVehicles/$totalRegisteredVehicles", textAlign: TextAlign.right, style: TextStyle( fontFamily: 'Nunito',