Merge pull request #96 from FRE-Informatica/hot-fix/vehicles
Label de total de veiculos
This commit is contained in:
commit
66b6b6d884
|
@ -53,26 +53,29 @@ Future<void> _initializeSystemSettings() async {
|
||||||
final crashlyticsInstance = FirebaseCrashlytics.instance;
|
final crashlyticsInstance = FirebaseCrashlytics.instance;
|
||||||
|
|
||||||
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
//kDebugMode
|
|
||||||
print('Debug mode');
|
print('Debug mode');
|
||||||
|
// await crashlyticsInstance.setCrashlyticsCollectionEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
print('Release mode');
|
print('Release mode');
|
||||||
bool unsentReports =
|
// await crashlyticsInstance.setCrashlyticsCollectionEnabled(true);
|
||||||
await FirebaseCrashlytics.instance.checkForUnsentReports();
|
|
||||||
if (unsentReports) {
|
// Verifica e envia relatórios não enviados de forma assíncrona
|
||||||
// Existem relatórios não enviados
|
// crashlyticsInstance.checkForUnsentReports().then((unsentReports) {
|
||||||
await crashlyticsInstance.sendUnsentReports();
|
// if (unsentReports) {
|
||||||
print('Existem relatórios de falhas não enviados.');
|
// crashlyticsInstance.sendUnsentReports();
|
||||||
} else {
|
// print('Existem relatórios de falhas não enviados.');
|
||||||
// Não existem relatórios não enviados
|
// } else {
|
||||||
print('Todos os relatórios de falhas foram enviados.');
|
// print('Todos os relatórios de falhas foram enviados.');
|
||||||
}
|
// }
|
||||||
await crashlyticsInstance.setCrashlyticsCollectionEnabled(true);
|
// }).catchError((error) {
|
||||||
// if (crashlyticsInstance.isCrashlyticsCollectionEnabled) {
|
// print('Erro ao verificar ou enviar relatórios não enviados: $error');
|
||||||
FlutterError.onError = await crashlyticsInstance.recordFlutterError;
|
// });
|
||||||
|
|
||||||
|
// Configura o tratamento de erros não capturados
|
||||||
|
FlutterError.onError = crashlyticsInstance.recordFlutterError;
|
||||||
print('Crashlytics enabled');
|
print('Crashlytics enabled');
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class VehicleHistoryScreen extends StatefulWidget {
|
||||||
class _VehicleHistoryScreenState extends State<VehicleHistoryScreen>
|
class _VehicleHistoryScreenState extends State<VehicleHistoryScreen>
|
||||||
with Pageable {
|
with Pageable {
|
||||||
final apiCall = PhpGroup.getVehiclesByProperty;
|
final apiCall = PhpGroup.getVehiclesByProperty;
|
||||||
int count = 0;
|
int totalOwnerVehicles = 0;
|
||||||
final PagingController<int, dynamic> _pagingController =
|
final PagingController<int, dynamic> _pagingController =
|
||||||
PagingController<int, dynamic>(firstPageKey: 1);
|
PagingController<int, dynamic>(firstPageKey: 1);
|
||||||
bool _isSnackble = true;
|
bool _isSnackble = true;
|
||||||
|
@ -28,7 +28,7 @@ class _VehicleHistoryScreenState extends State<VehicleHistoryScreen>
|
||||||
(newItems.jsonBody['vehicles'] as List<dynamic>?) ?? [];
|
(newItems.jsonBody['vehicles'] as List<dynamic>?) ?? [];
|
||||||
|
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
count = newItems.jsonBody['total_rows'] ?? 0;
|
totalOwnerVehicles = newItems.jsonBody['total_owner_vehicles'] ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
return (vehicles.isNotEmpty, vehicles);
|
return (vehicles.isNotEmpty, vehicles);
|
||||||
|
@ -96,6 +96,12 @@ class _VehicleHistoryScreenState extends State<VehicleHistoryScreen>
|
||||||
|
|
||||||
Widget _buildHeader(BuildContext context) {
|
Widget _buildHeader(BuildContext context) {
|
||||||
final bodyFontSize = LimitedFontSizeUtil.getBodyFontSize(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(
|
return SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
child: Center(
|
child: Center(
|
||||||
|
@ -103,7 +109,7 @@ class _VehicleHistoryScreenState extends State<VehicleHistoryScreen>
|
||||||
(widget.model.amountRegister == '0' ||
|
(widget.model.amountRegister == '0' ||
|
||||||
widget.model.amountRegister == null)
|
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,
|
textAlign: TextAlign.right,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'Nunito',
|
fontFamily: 'Nunito',
|
||||||
|
|
Loading…
Reference in New Issue