Merge pull request #96 from FRE-Informatica/hot-fix/vehicles

Label de total de veiculos
This commit is contained in:
Ivan Antunes 2025-02-17 14:54:50 -03:00 committed by GitHub
commit 66b6b6d884
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 18 deletions

View File

@ -53,26 +53,29 @@ Future<void> _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;
print('Crashlytics enabled');
// 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');
}
}

View File

@ -11,7 +11,7 @@ class VehicleHistoryScreen extends StatefulWidget {
class _VehicleHistoryScreenState extends State<VehicleHistoryScreen>
with Pageable {
final apiCall = PhpGroup.getVehiclesByProperty;
int count = 0;
int totalOwnerVehicles = 0;
final PagingController<int, dynamic> _pagingController =
PagingController<int, dynamic>(firstPageKey: 1);
bool _isSnackble = true;
@ -28,7 +28,7 @@ class _VehicleHistoryScreenState extends State<VehicleHistoryScreen>
(newItems.jsonBody['vehicles'] as List<dynamic>?) ?? [];
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<VehicleHistoryScreen>
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<VehicleHistoryScreen>
(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',