implement vehicle crud screens
This commit is contained in:
parent
2506ea1270
commit
083f2d200d
|
@ -31,20 +31,17 @@ class PhpGroup extends Api {
|
||||||
static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall();
|
static ForgotPasswordCall forgotPasswordCall = ForgotPasswordCall();
|
||||||
static ChangePasswordCall changePasswordCall = ChangePasswordCall();
|
static ChangePasswordCall changePasswordCall = ChangePasswordCall();
|
||||||
static GetLocalsCall getLocalsCall = GetLocalsCall();
|
static GetLocalsCall getLocalsCall = GetLocalsCall();
|
||||||
static PostScheduleVisitorCall postScheduleVisitorCall =
|
static PostScheduleVisitorCall postScheduleVisitorCall = PostScheduleVisitorCall();
|
||||||
PostScheduleVisitorCall();
|
|
||||||
static PostScheduleVisitCall postScheduleVisitCall = PostScheduleVisitCall();
|
static PostScheduleVisitCall postScheduleVisitCall = PostScheduleVisitCall();
|
||||||
static GetScheduleVisitCall getScheduleVisitCall = GetScheduleVisitCall();
|
static GetScheduleVisitCall getScheduleVisitCall = GetScheduleVisitCall();
|
||||||
static GetDadosCall getDadosCall = GetDadosCall();
|
static GetDadosCall getDadosCall = GetDadosCall();
|
||||||
static GetVisitorByDocCall getVisitorByDocCall = GetVisitorByDocCall();
|
static GetVisitorByDocCall getVisitorByDocCall = GetVisitorByDocCall();
|
||||||
static GetFotoVisitanteCall getFotoVisitanteCall = GetFotoVisitanteCall();
|
static GetFotoVisitanteCall getFotoVisitanteCall = GetFotoVisitanteCall();
|
||||||
static PostProvVisitSchedulingCall postProvVisitSchedulingCall =
|
static PostProvVisitSchedulingCall postProvVisitSchedulingCall = PostProvVisitSchedulingCall();
|
||||||
PostProvVisitSchedulingCall();
|
|
||||||
static GetVisitsCall getVisitsCall = GetVisitsCall();
|
static GetVisitsCall getVisitsCall = GetVisitsCall();
|
||||||
static DeleteVisitCall deleteVisitCall = DeleteVisitCall();
|
static DeleteVisitCall deleteVisitCall = DeleteVisitCall();
|
||||||
static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall();
|
static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall();
|
||||||
static RespondeSolicitacaoCall respondeSolicitacaoCall =
|
static RespondeSolicitacaoCall respondeSolicitacaoCall = RespondeSolicitacaoCall();
|
||||||
RespondeSolicitacaoCall();
|
|
||||||
static GetAccessCall getAccessCall = GetAccessCall();
|
static GetAccessCall getAccessCall = GetAccessCall();
|
||||||
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
static GetLiberationsCall getLiberationsCall = GetLiberationsCall();
|
||||||
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
static GetMessagesCall getMessagesCall = GetMessagesCall();
|
||||||
|
@ -63,22 +60,134 @@ class PhpGroup extends Api {
|
||||||
static GetPetPhoto getPetPhoto = GetPetPhoto();
|
static GetPetPhoto getPetPhoto = GetPetPhoto();
|
||||||
static UnregisterDevice unregisterDevice = UnregisterDevice();
|
static UnregisterDevice unregisterDevice = UnregisterDevice();
|
||||||
static GetVehiclesByProperty getVehiclesByProperty = GetVehiclesByProperty();
|
static GetVehiclesByProperty getVehiclesByProperty = GetVehiclesByProperty();
|
||||||
static GetResidentsByProperty getResidentsByProperty =
|
static GetResidentsByProperty getResidentsByProperty = GetResidentsByProperty();
|
||||||
GetResidentsByProperty();
|
|
||||||
static GetOpenedVisits getOpenedVisits = GetOpenedVisits();
|
static GetOpenedVisits getOpenedVisits = GetOpenedVisits();
|
||||||
GetLicense getLicense = GetLicense();
|
GetLicense getLicense = GetLicense();
|
||||||
static GetProvSchedules getProvSchedules = GetProvSchedules();
|
static GetProvSchedules getProvSchedules = GetProvSchedules();
|
||||||
|
static RegisterVehicle registerVehicle = RegisterVehicle();
|
||||||
|
static UpdateVehicle updateVehicle = UpdateVehicle();
|
||||||
|
static DeleteVehicle deleteVehicle = DeleteVehicle();
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeleteVehicle {
|
||||||
|
Future<ApiCallResponse> call({vehicleId}) async {
|
||||||
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
|
const String atividade = 'excluirVeiculo';
|
||||||
|
|
||||||
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
callName: 'deleteVehicle',
|
||||||
|
apiUrl: '$baseUrl/processRequest.php',
|
||||||
|
callType: ApiCallType.POST,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
'devUUID': devUUID,
|
||||||
|
'userUUID': userUUID,
|
||||||
|
'cliID': cliID,
|
||||||
|
'atividade': atividade,
|
||||||
|
'vehicleId': vehicleId,
|
||||||
|
},
|
||||||
|
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||||
|
returnBody: true,
|
||||||
|
encodeBodyUtf8: false,
|
||||||
|
decodeUtf8: false,
|
||||||
|
cache: false,
|
||||||
|
isStreamingApi: false,
|
||||||
|
alwaysAllowBody: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RegisterVehicle {
|
||||||
|
Future<ApiCallResponse> call({
|
||||||
|
final String? licensePlate,
|
||||||
|
final String? color,
|
||||||
|
final String? model,
|
||||||
|
}) async {
|
||||||
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
|
const String atividade = 'cadastrarVeiculo';
|
||||||
|
|
||||||
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
callName: 'registerVehicle',
|
||||||
|
apiUrl: '$baseUrl/processRequest.php',
|
||||||
|
callType: ApiCallType.POST,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
'devUUID': devUUID,
|
||||||
|
'userUUID': userUUID,
|
||||||
|
'cliID': cliID,
|
||||||
|
'atividade': atividade,
|
||||||
|
'licensePlate': licensePlate,
|
||||||
|
'color': color,
|
||||||
|
'model': model,
|
||||||
|
},
|
||||||
|
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||||
|
returnBody: true,
|
||||||
|
encodeBodyUtf8: false,
|
||||||
|
decodeUtf8: false,
|
||||||
|
cache: false,
|
||||||
|
isStreamingApi: false,
|
||||||
|
alwaysAllowBody: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateVehicle {
|
||||||
|
Future<ApiCallResponse> call({
|
||||||
|
final String? vehicleId,
|
||||||
|
final String? licensePlate,
|
||||||
|
final String? color,
|
||||||
|
final String? model,
|
||||||
|
}) async {
|
||||||
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
|
const String atividade = 'atualizarVeiculo';
|
||||||
|
|
||||||
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
callName: 'updateVehicle',
|
||||||
|
apiUrl: '$baseUrl/processRequest.php',
|
||||||
|
callType: ApiCallType.POST,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
},
|
||||||
|
params: {
|
||||||
|
'devUUID': devUUID,
|
||||||
|
'userUUID': userUUID,
|
||||||
|
'cliID': cliID,
|
||||||
|
'atividade': atividade,
|
||||||
|
'licensePlate': licensePlate,
|
||||||
|
'color': color,
|
||||||
|
'model': model,
|
||||||
|
},
|
||||||
|
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
|
||||||
|
returnBody: true,
|
||||||
|
encodeBodyUtf8: false,
|
||||||
|
decodeUtf8: false,
|
||||||
|
cache: false,
|
||||||
|
isStreamingApi: false,
|
||||||
|
alwaysAllowBody: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GetProvSchedules {
|
class GetProvSchedules {
|
||||||
Future<ApiCallResponse> call(final String page, final String status) async {
|
Future<ApiCallResponse> call(final String page, final String status) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getAgendamentoProv';
|
const String atividade = 'getAgendamentoProv';
|
||||||
const String pageSize = '10';
|
const String pageSize = '10';
|
||||||
final bool isFiltered = status != '' && status != '.*';
|
final bool isFiltered = status != '' && status != '.*';
|
||||||
|
@ -111,12 +220,9 @@ class GetProvSchedules {
|
||||||
class GetOpenedVisits {
|
class GetOpenedVisits {
|
||||||
Future<ApiCallResponse> call(final String page) async {
|
Future<ApiCallResponse> call(final String page) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getOpenedVisits';
|
const String atividade = 'getOpenedVisits';
|
||||||
const String pageSize = '10';
|
const String pageSize = '10';
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -146,12 +252,9 @@ class GetOpenedVisits {
|
||||||
class GetResidentsByProperty {
|
class GetResidentsByProperty {
|
||||||
Future<ApiCallResponse> call(final String page) async {
|
Future<ApiCallResponse> call(final String page) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||||
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
||||||
final String userUUID =
|
final String cliID = await StorageHelper().get(ProfileStorageKey.clientUUID.key) ?? '';
|
||||||
await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
await StorageHelper().get(ProfileStorageKey.clientUUID.key) ?? '';
|
|
||||||
const String atividade = 'getResidentsByProperty';
|
const String atividade = 'getResidentsByProperty';
|
||||||
const String pageSize = '10';
|
const String pageSize = '10';
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -180,12 +283,9 @@ class GetResidentsByProperty {
|
||||||
class GetVehiclesByProperty {
|
class GetVehiclesByProperty {
|
||||||
Future<ApiCallResponse> call(final String page) async {
|
Future<ApiCallResponse> call(final String page) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getVehiclesByProperty';
|
const String atividade = 'getVehiclesByProperty';
|
||||||
const String pageSize = '10';
|
const String pageSize = '10';
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -216,12 +316,9 @@ class GetVehiclesByProperty {
|
||||||
class GetLicense {
|
class GetLicense {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
callName: 'getLicense',
|
callName: 'getLicense',
|
||||||
|
@ -250,10 +347,8 @@ class GetLicense {
|
||||||
class UnregisterDevice {
|
class UnregisterDevice {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
callName: 'unregisterDevice',
|
callName: 'unregisterDevice',
|
||||||
|
@ -280,12 +375,9 @@ class UnregisterDevice {
|
||||||
class DeletePet {
|
class DeletePet {
|
||||||
Future<ApiCallResponse> call({final int? petID = 0}) async {
|
Future<ApiCallResponse> call({final int? petID = 0}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'excluirPet';
|
const String atividade = 'excluirPet';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -328,12 +420,9 @@ class UpdatePet {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'atualizarPet';
|
const String atividade = 'atualizarPet';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -354,9 +443,7 @@ class UpdatePet {
|
||||||
'species': species,
|
'species': species,
|
||||||
'breed': breed,
|
'breed': breed,
|
||||||
if (color != '') 'color': color,
|
if (color != '') 'color': color,
|
||||||
if (birthdayDate != '')
|
if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||||
'birthdayDate':
|
|
||||||
ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
|
||||||
'gender': gender,
|
'gender': gender,
|
||||||
'size': size,
|
'size': size,
|
||||||
if (notes != '') 'notes': notes,
|
if (notes != '') 'notes': notes,
|
||||||
|
@ -379,12 +466,9 @@ class GetPets {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'consultaPets';
|
const String atividade = 'consultaPets';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -416,12 +500,9 @@ class GetPetPhoto {
|
||||||
Future<ApiCallResponse> call({final int? petId}) async {
|
Future<ApiCallResponse> call({final int? petId}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'consultaFotoPet';
|
const String atividade = 'consultaFotoPet';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -462,12 +543,9 @@ class RegisterPet {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'cadastrarPet';
|
const String atividade = 'cadastrarPet';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -487,9 +565,7 @@ class RegisterPet {
|
||||||
'species': species,
|
'species': species,
|
||||||
'breed': breed,
|
'breed': breed,
|
||||||
if (color != '') 'color': color,
|
if (color != '') 'color': color,
|
||||||
if (birthdayDate != '')
|
if (birthdayDate != '') 'birthdayDate': ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
||||||
'birthdayDate':
|
|
||||||
ValidatorUtil.toISO8601USA('dd/MM/yyyy', birthdayDate!),
|
|
||||||
'gender': gender,
|
'gender': gender,
|
||||||
'size': size,
|
'size': size,
|
||||||
if (notes != '') 'notes': notes,
|
if (notes != '') 'notes': notes,
|
||||||
|
@ -512,12 +588,9 @@ class BuscaEnconcomendas {
|
||||||
final String? adresseeType,
|
final String? adresseeType,
|
||||||
final String? status,
|
final String? status,
|
||||||
}) async {
|
}) async {
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getEncomendas';
|
const String atividade = 'getEncomendas';
|
||||||
|
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
@ -559,12 +632,9 @@ class CancelaVisita {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'cancelaVisita';
|
const String atividade = 'cancelaVisita';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -596,10 +666,8 @@ class CancelaVisita {
|
||||||
|
|
||||||
class DeleteAccount {
|
class DeleteAccount {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
|
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -630,12 +698,9 @@ class ChangePanic {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'updVisitado';
|
const String atividade = 'updVisitado';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -669,12 +734,9 @@ class ChangePass {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'updVisitado';
|
const String atividade = 'updVisitado';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -708,12 +770,9 @@ class RespondeVinculo {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
callName: 'respondeVinculo',
|
callName: 'respondeVinculo',
|
||||||
|
@ -745,12 +804,9 @@ class ChangeNotifica {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'updVisitado';
|
const String atividade = 'updVisitado';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -782,14 +838,10 @@ class UpdateIDE {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
final String newIde = (await StorageHelper().get(ProfileStorageKey.userDevUUID.key)) ?? '';
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
final String newIde =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.userDevUUID.key)) ?? '';
|
|
||||||
const String atividade = 'updVisitado';
|
const String atividade = 'updVisitado';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -821,12 +873,9 @@ class UpdToken {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String token = (await StorageHelper().get(SecureStorageKey.token.value)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String token =
|
|
||||||
(await StorageHelper().get(SecureStorageKey.token.value)) ?? '';
|
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
callName: 'updToken',
|
callName: 'updToken',
|
||||||
|
@ -853,17 +902,11 @@ class UpdToken {
|
||||||
class LoginCall {
|
class LoginCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String email = (await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
|
||||||
final String email =
|
final String password = (await StorageHelper().get(SecureStorageKey.password.value)) ?? '';
|
||||||
(await StorageHelper().get(SecureStorageKey.email.value)) ?? '';
|
final String type = (await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? '';
|
||||||
final String password =
|
final String description = (await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ?? '';
|
||||||
(await StorageHelper().get(SecureStorageKey.password.value)) ?? '';
|
|
||||||
final String type =
|
|
||||||
(await StorageHelper().get(SecureStorageKey.deviceType.value)) ?? '';
|
|
||||||
final String description =
|
|
||||||
(await StorageHelper().get(SecureStorageKey.deviceDescription.value)) ??
|
|
||||||
'';
|
|
||||||
late final String token;
|
late final String token;
|
||||||
try {
|
try {
|
||||||
token = await FirebaseMessagingService.getToken();
|
token = await FirebaseMessagingService.getToken();
|
||||||
|
@ -946,12 +989,9 @@ class ChangePasswordCall {
|
||||||
required final String psswd,
|
required final String psswd,
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
callName: 'changePassword',
|
callName: 'changePassword',
|
||||||
|
@ -1010,10 +1050,8 @@ class GetLocalsCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
||||||
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
|
final String userUUID = await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
||||||
final String userUUID =
|
|
||||||
await StorageHelper().get(ProfileStorageKey.userUUID.key) ?? '';
|
|
||||||
|
|
||||||
return await ApiManager.instance
|
return await ApiManager.instance
|
||||||
.makeApiCall(
|
.makeApiCall(
|
||||||
|
@ -1054,12 +1092,9 @@ class PostScheduleVisitorCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'putVisitante';
|
const String atividade = 'putVisitante';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -1112,12 +1147,9 @@ class PostScheduleVisitCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'putVisita';
|
const String atividade = 'putVisita';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -1169,12 +1201,9 @@ class GetScheduleVisitCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getVisitas';
|
const String atividade = 'getVisitas';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -1446,12 +1475,9 @@ class GetDadosCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getDados';
|
const String atividade = 'getDados';
|
||||||
|
|
||||||
return await ApiManager.instance
|
return await ApiManager.instance
|
||||||
|
@ -1487,8 +1513,7 @@ class GetDadosCall {
|
||||||
response,
|
response,
|
||||||
r'''$.error_msg''',
|
r'''$.error_msg''',
|
||||||
));
|
));
|
||||||
String? visitedDesNomeStr(dynamic response) =>
|
String? visitedDesNomeStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.DES_NOME''',
|
r'''$.visitado.DES_NOME''',
|
||||||
));
|
));
|
||||||
|
@ -1496,33 +1521,27 @@ class GetDadosCall {
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_ID''',
|
r'''$.visitado.VDO_ID''',
|
||||||
));
|
));
|
||||||
String? visitedVDOTNomeStr(dynamic response) =>
|
String? visitedVDOTNomeStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_NOME''',
|
r'''$.visitado.VDO_NOME''',
|
||||||
));
|
));
|
||||||
String? visitedVDOTipoStr(dynamic response) =>
|
String? visitedVDOTipoStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_TIPO''',
|
r'''$.visitado.VDO_TIPO''',
|
||||||
));
|
));
|
||||||
String? visitedVDOImeiStr(dynamic response) =>
|
String? visitedVDOImeiStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_IMEI''',
|
r'''$.visitado.VDO_IMEI''',
|
||||||
));
|
));
|
||||||
String? visitedVDODocumentoStr(dynamic response) =>
|
String? visitedVDODocumentoStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_DOCUMENTO''',
|
r'''$.visitado.VDO_DOCUMENTO''',
|
||||||
));
|
));
|
||||||
String? visitedVDOEmailStr(dynamic response) =>
|
String? visitedVDOEmailStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_EMAIL''',
|
r'''$.visitado.VDO_EMAIL''',
|
||||||
));
|
));
|
||||||
String? visitedVDOStatusWebStr(dynamic response) =>
|
String? visitedVDOStatusWebStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_STATUSWEB''',
|
r'''$.visitado.VDO_STATUSWEB''',
|
||||||
));
|
));
|
||||||
|
@ -1570,8 +1589,7 @@ class GetDadosCall {
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.DES_ID''',
|
r'''$.visitado.DES_ID''',
|
||||||
));
|
));
|
||||||
String? visitedVDoNotTerceirosStr(dynamic response) =>
|
String? visitedVDoNotTerceirosStr(dynamic response) => castToType<String>(getJsonField(
|
||||||
castToType<String>(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.visitado.VDO_NOTTERCEIROS''',
|
r'''$.visitado.VDO_NOTTERCEIROS''',
|
||||||
));
|
));
|
||||||
|
@ -1640,8 +1658,7 @@ class GetDadosCall {
|
||||||
.map((x) => castToType<String>(x))
|
.map((x) => castToType<String>(x))
|
||||||
.withoutNulls
|
.withoutNulls
|
||||||
.toList();
|
.toList();
|
||||||
List<String>? levelNACIndPermiteReentradaStrList(dynamic response) =>
|
List<String>? levelNACIndPermiteReentradaStrList(dynamic response) => (getJsonField(
|
||||||
(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.niveis[:].NAC_INDPERMITEREENTRADA''',
|
r'''$.niveis[:].NAC_INDPERMITEREENTRADA''',
|
||||||
true,
|
true,
|
||||||
|
@ -1659,8 +1676,7 @@ class GetDadosCall {
|
||||||
.map((x) => castToType<String>(x))
|
.map((x) => castToType<String>(x))
|
||||||
.withoutNulls
|
.withoutNulls
|
||||||
.toList();
|
.toList();
|
||||||
List<String>? levelNACTempoAntiCaronaStrList(dynamic response) =>
|
List<String>? levelNACTempoAntiCaronaStrList(dynamic response) => (getJsonField(
|
||||||
(getJsonField(
|
|
||||||
response,
|
response,
|
||||||
r'''$.niveis[:].NAC_TEMPOANTICARONA''',
|
r'''$.niveis[:].NAC_TEMPOANTICARONA''',
|
||||||
true,
|
true,
|
||||||
|
@ -1694,12 +1710,9 @@ class GetVisitorByDocCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getVisitante';
|
const String atividade = 'getVisitante';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -1751,12 +1764,9 @@ class GetFotoVisitanteCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getFotoVisitante';
|
const String atividade = 'getFotoVisitante';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -1793,12 +1803,9 @@ class PostProvVisitSchedulingCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'putAgendamentoProv';
|
const String atividade = 'putAgendamentoProv';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -1845,12 +1852,9 @@ class GetVisitsCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getVisitas';
|
const String atividade = 'getVisitas';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -2111,12 +2115,9 @@ class DeleteVisitCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'cancelaVisita';
|
const String atividade = 'cancelaVisita';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -2157,14 +2158,10 @@ class GetPessoasLocalCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String ownerUUID = (await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? '';
|
||||||
final String ownerUUID =
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.ownerUUID.key)) ?? '';
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
final String userUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
callName: 'getPessoasLocal',
|
callName: 'getPessoasLocal',
|
||||||
|
@ -2227,12 +2224,9 @@ class RespondeSolicitacaoCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'respondeSolicitacao';
|
const String atividade = 'respondeSolicitacao';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -2280,12 +2274,9 @@ class GetAccessCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getAcessos';
|
const String atividade = 'getAcessos';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
@ -2532,12 +2523,9 @@ class GetLiberationsCall {
|
||||||
final StreamController<ApiCallResponse> controller = StreamController();
|
final StreamController<ApiCallResponse> controller = StreamController();
|
||||||
|
|
||||||
Future.microtask(() async {
|
Future.microtask(() async {
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getSolicitacoes';
|
const String atividade = 'getSolicitacoes';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -2727,12 +2715,9 @@ class GetMessagesCall {
|
||||||
}) async {
|
}) async {
|
||||||
final String baseUrl = PhpGroup.getBaseUrl();
|
final String baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
|
||||||
final String devUUID =
|
final String devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
final String userUUID = (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
||||||
final String userUUID =
|
final String cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
|
|
||||||
final String cliUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
const String atividade = 'getMensagens';
|
const String atividade = 'getMensagens';
|
||||||
|
|
||||||
return await ApiManager.instance.makeApiCall(
|
return await ApiManager.instance.makeApiCall(
|
||||||
|
|
|
@ -86,20 +86,11 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
return FutureBuilder<Widget>(
|
return FutureBuilder<Widget>(
|
||||||
future: () async {
|
future: () async {
|
||||||
final bool isLogged =
|
final bool isLogged = await StorageHelper().get(SecureStorageKey.isLogged.value) == 'true';
|
||||||
await StorageHelper().get(SecureStorageKey.isLogged.value) ==
|
final bool haveLocal = await StorageHelper().get(SecureStorageKey.haveLocal.value) == 'true';
|
||||||
'true';
|
|
||||||
final bool haveLocal =
|
|
||||||
await StorageHelper().get(SecureStorageKey.haveLocal.value) ==
|
|
||||||
'true';
|
|
||||||
final bool haveUserUUID =
|
final bool haveUserUUID =
|
||||||
(await StorageHelper().get(ProfileStorageKey.userUUID.key))
|
(await StorageHelper().get(ProfileStorageKey.userUUID.key))?.isNotEmpty ?? false;
|
||||||
?.isNotEmpty ??
|
final bool haveDevUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key))?.isNotEmpty ?? false;
|
||||||
false;
|
|
||||||
final bool haveDevUUID =
|
|
||||||
(await StorageHelper().get(ProfileStorageKey.devUUID.key))
|
|
||||||
?.isNotEmpty ??
|
|
||||||
false;
|
|
||||||
|
|
||||||
if (isLogged && haveDevUUID && haveUserUUID) {
|
if (isLogged && haveDevUUID && haveUserUUID) {
|
||||||
return haveLocal
|
return haveLocal
|
||||||
|
@ -109,20 +100,17 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
create: (context) => MenuBloc(
|
create: (context) => MenuBloc(
|
||||||
style: MenuView.list_grid,
|
style: MenuView.list_grid,
|
||||||
item: EnumMenuItem.button,
|
item: EnumMenuItem.button,
|
||||||
entries: MenuEntry.getEntriesByType(
|
entries: MenuEntry.getEntriesByType(MenuEntryType.Home),
|
||||||
MenuEntryType.Home),
|
|
||||||
)..add(MenuEvent()),
|
)..add(MenuEvent()),
|
||||||
),
|
),
|
||||||
BlocProvider<HomeBloc>(
|
BlocProvider<HomeBloc>(
|
||||||
create: (context) => HomeBloc()..add(HomeEvent()),
|
create: (context) => HomeBloc()..add(HomeEvent()),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) =>
|
create: (context) => LocalProfileBloc()..add(LocalProfileEvent()),
|
||||||
LocalProfileBloc()..add(LocalProfileEvent()),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: HomePageWidget(
|
child: HomePageWidget(key: UniqueKey(), LocalsRepositoryImpl().update),
|
||||||
key: UniqueKey(), LocalsRepositoryImpl().update),
|
|
||||||
)
|
)
|
||||||
: const ReceptionPageWidget();
|
: const ReceptionPageWidget();
|
||||||
} else {
|
} else {
|
||||||
|
@ -146,10 +134,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
name: 'forgotPassword',
|
name: 'forgotPassword',
|
||||||
path: '/forgotPassword',
|
path: '/forgotPassword',
|
||||||
builder: (context, params) {
|
builder: (context, params) {
|
||||||
late final String email =
|
late final String email = params.getParam('email', ParamType.String);
|
||||||
params.getParam('email', ParamType.String);
|
late final String token = params.getParam('token', ParamType.String);
|
||||||
late final String token =
|
|
||||||
params.getParam('token', ParamType.String);
|
|
||||||
|
|
||||||
return ForgotPasswordScreen(
|
return ForgotPasswordScreen(
|
||||||
key: UniqueKey(),
|
key: UniqueKey(),
|
||||||
|
@ -166,8 +152,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
name: 'homePage',
|
name: 'homePage',
|
||||||
path: '/homePage',
|
path: '/homePage',
|
||||||
builder: (context, params) {
|
builder: (context, params) {
|
||||||
final Future<bool> Function(BuildContext context)? update =
|
final Future<bool> Function(BuildContext context)? update = params.getParam('update', ParamType.Function);
|
||||||
params.getParam('update', ParamType.Function);
|
|
||||||
return MultiBlocProvider(
|
return MultiBlocProvider(
|
||||||
providers: [
|
providers: [
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
|
@ -181,8 +166,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
create: (context) => HomeBloc()..add(HomeEvent()),
|
create: (context) => HomeBloc()..add(HomeEvent()),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) =>
|
create: (context) => LocalProfileBloc()..add(LocalProfileEvent()),
|
||||||
LocalProfileBloc()..add(LocalProfileEvent()),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: HomePageWidget(key: UniqueKey(), update),
|
child: HomePageWidget(key: UniqueKey(), update),
|
||||||
|
@ -191,16 +175,12 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'petsOnThePropertyPage',
|
name: 'petsOnThePropertyPage',
|
||||||
path: '/petsOnThePropertyPage',
|
path: '/petsOnThePropertyPage',
|
||||||
builder: (context, params) =>
|
builder: (context, params) => Scaffold(body: const PetsHistoryScreen(isApp: true))),
|
||||||
Scaffold(body: const PetsHistoryScreen(isApp: true))),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'vehiclesOnThePropertyPage',
|
name: 'vehiclesOnThePropertyPage',
|
||||||
path: '/vehiclesOnThePropertyPage',
|
path: '/vehiclesOnThePropertyPage',
|
||||||
builder: (context, params) => const VehicleOnTheProperty()),
|
builder: (context, params) => const VehiclePage()),
|
||||||
FFRoute(
|
FFRoute(name: 'receptionPage', path: '/receptionPage', builder: (context, params) => const ReceptionPageWidget()),
|
||||||
name: 'receptionPage',
|
|
||||||
path: '/receptionPage',
|
|
||||||
builder: (context, params) => const ReceptionPageWidget()),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'messageHistoryPage',
|
name: 'messageHistoryPage',
|
||||||
path: '/messageHistoryPage',
|
path: '/messageHistoryPage',
|
||||||
|
@ -212,28 +192,19 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'scheduleCompleteVisitPage',
|
name: 'scheduleCompleteVisitPage',
|
||||||
path: '/scheduleCompleteVisitPage',
|
path: '/scheduleCompleteVisitPage',
|
||||||
builder: (context, params) =>
|
builder: (context, params) => const ScheduleCompleteVisitPageWidget()),
|
||||||
const ScheduleCompleteVisitPageWidget()),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'deliverySchedule',
|
name: 'deliverySchedule', path: '/deliverySchedule', builder: (context, params) => const DeliverySchedule()),
|
||||||
path: '/deliverySchedule',
|
|
||||||
builder: (context, params) => const DeliverySchedule()),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'provisionalSchedule',
|
name: 'provisionalSchedule',
|
||||||
path: '/provisionalSchedule',
|
path: '/provisionalSchedule',
|
||||||
builder: (context, params) => const ProvisionalSchedule()),
|
builder: (context, params) => const ProvisionalSchedule()),
|
||||||
FFRoute(
|
FFRoute(name: 'fastPassPage', path: '/fastPassPage', builder: (context, params) => FastPassPageWidget()),
|
||||||
name: 'fastPassPage',
|
|
||||||
path: '/fastPassPage',
|
|
||||||
builder: (context, params) => FastPassPageWidget()),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'preferencesSettings',
|
name: 'preferencesSettings',
|
||||||
path: '/preferencesSettings',
|
path: '/preferencesSettings',
|
||||||
builder: (context, params) => PreferencesPageWidget()),
|
builder: (context, params) => PreferencesPageWidget()),
|
||||||
FFRoute(
|
FFRoute(name: 'aboutProperty', path: '/aboutProperty', builder: (context, params) => AboutPropertyPage()),
|
||||||
name: 'aboutProperty',
|
|
||||||
path: '/aboutProperty',
|
|
||||||
builder: (context, params) => AboutPropertyPage()),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'residentsOnThePropertyPage',
|
name: 'residentsOnThePropertyPage',
|
||||||
path: '/residentsOnThePropertyPage',
|
path: '/residentsOnThePropertyPage',
|
||||||
|
@ -249,11 +220,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'acessHistoryPage',
|
name: 'acessHistoryPage',
|
||||||
path: '/acessHistoryPage',
|
path: '/acessHistoryPage',
|
||||||
builder: (context, params) => AccessHistoryScreen(opt: const {
|
builder: (context, params) =>
|
||||||
'personType': '.*',
|
AccessHistoryScreen(opt: const {'personType': '.*', 'accessType': '.*', 'search': '.*'})),
|
||||||
'accessType': '.*',
|
|
||||||
'search': '.*'
|
|
||||||
})),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'provisionalHistoryPage',
|
name: 'provisionalHistoryPage',
|
||||||
path: '/provisionalHistoryPage',
|
path: '/provisionalHistoryPage',
|
||||||
|
@ -262,34 +230,13 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
name: 'liberationHistory',
|
name: 'liberationHistory',
|
||||||
path: '/liberationHistory',
|
path: '/liberationHistory',
|
||||||
builder: (context, params) => const LiberationHistoryWidget()),
|
builder: (context, params) => const LiberationHistoryWidget()),
|
||||||
FFRoute(
|
FFRoute(name: 'signInPage', path: '/signInPage', builder: (context, params) => const SignInPageWidget()),
|
||||||
name: 'signInPage',
|
FFRoute(name: 'signUpPage', path: '/signUpPage', builder: (context, params) => const SignUpPageWidget()),
|
||||||
path: '/signInPage',
|
FFRoute(name: 'welcomePage', path: '/welcomePage', builder: (context, params) => const WelcomePage()),
|
||||||
builder: (context, params) => const SignInPageWidget()),
|
FFRoute(name: 'qrCodePage', path: '/qrCodePage', builder: (context, params) => const QrCodePageWidget()),
|
||||||
FFRoute(
|
FFRoute(name: 'preferencesPage', path: '/preferencesPage', builder: (context, params) => PreferencesPageWidget()),
|
||||||
name: 'signUpPage',
|
FFRoute(name: 'packageOrder', path: '/packageOrder', builder: (context, params) => const PackageOrderPage()),
|
||||||
path: '/signUpPage',
|
FFRoute(name: 'reservation', path: '/reservation', builder: (context, params) => ReservationPageWidget()),
|
||||||
builder: (context, params) => const SignUpPageWidget()),
|
|
||||||
FFRoute(
|
|
||||||
name: 'welcomePage',
|
|
||||||
path: '/welcomePage',
|
|
||||||
builder: (context, params) => const WelcomePage()),
|
|
||||||
FFRoute(
|
|
||||||
name: 'qrCodePage',
|
|
||||||
path: '/qrCodePage',
|
|
||||||
builder: (context, params) => const QrCodePageWidget()),
|
|
||||||
FFRoute(
|
|
||||||
name: 'preferencesPage',
|
|
||||||
path: '/preferencesPage',
|
|
||||||
builder: (context, params) => PreferencesPageWidget()),
|
|
||||||
FFRoute(
|
|
||||||
name: 'packageOrder',
|
|
||||||
path: '/packageOrder',
|
|
||||||
builder: (context, params) => const PackageOrderPage()),
|
|
||||||
FFRoute(
|
|
||||||
name: 'reservation',
|
|
||||||
path: '/reservation',
|
|
||||||
builder: (context, params) => ReservationPageWidget()),
|
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: 'petsPage',
|
name: 'petsPage',
|
||||||
path: '/petsPage',
|
path: '/petsPage',
|
||||||
|
@ -305,9 +252,7 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) {
|
||||||
|
|
||||||
extension NavParamExtensions on Map<String, String?> {
|
extension NavParamExtensions on Map<String, String?> {
|
||||||
Map<String, String> get withoutNulls => Map.fromEntries(
|
Map<String, String> get withoutNulls => Map.fromEntries(
|
||||||
entries
|
entries.where((e) => e.value != null).map((e) => MapEntry(e.key, e.value!)),
|
||||||
.where((e) => e.value != null)
|
|
||||||
.map((e) => MapEntry(e.key, e.value!)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,8 +266,7 @@ extension NavigationExtensions on BuildContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension _GoRouterStateExtensions on GoRouterState {
|
extension _GoRouterStateExtensions on GoRouterState {
|
||||||
Map<String, dynamic> get extraMap =>
|
Map<String, dynamic> get extraMap => extra != null ? extra as Map<String, dynamic> : {};
|
||||||
extra != null ? extra as Map<String, dynamic> : {};
|
|
||||||
Map<String, dynamic> get allParams => <String, dynamic>{}
|
Map<String, dynamic> get allParams => <String, dynamic>{}
|
||||||
..addAll(pathParameters)
|
..addAll(pathParameters)
|
||||||
..addAll(uri.queryParameters)
|
..addAll(uri.queryParameters)
|
||||||
|
@ -335,9 +279,8 @@ extension _GoRouterStateExtensions on GoRouterState {
|
||||||
extension GoRouterLocationExtension on GoRouter {
|
extension GoRouterLocationExtension on GoRouter {
|
||||||
String getCurrentLocation() {
|
String getCurrentLocation() {
|
||||||
final RouteMatch lastMatch = routerDelegate.currentConfiguration.last;
|
final RouteMatch lastMatch = routerDelegate.currentConfiguration.last;
|
||||||
final RouteMatchList matchList = lastMatch is ImperativeRouteMatch
|
final RouteMatchList matchList =
|
||||||
? lastMatch.matches
|
lastMatch is ImperativeRouteMatch ? lastMatch.matches : routerDelegate.currentConfiguration;
|
||||||
: routerDelegate.currentConfiguration;
|
|
||||||
return matchList.uri.toString();
|
return matchList.uri.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,17 +293,13 @@ class FFParameters {
|
||||||
Map<String, dynamic> futureParamValues = {};
|
Map<String, dynamic> futureParamValues = {};
|
||||||
|
|
||||||
bool get isEmpty =>
|
bool get isEmpty =>
|
||||||
state.allParams.isEmpty ||
|
state.allParams.isEmpty || (state.allParams.length == 1 && state.extraMap.containsKey(kTransitionInfoKey));
|
||||||
(state.allParams.length == 1 &&
|
bool isAsyncParam(MapEntry<String, dynamic> param) => asyncParams.containsKey(param.key) && param.value is String;
|
||||||
state.extraMap.containsKey(kTransitionInfoKey));
|
|
||||||
bool isAsyncParam(MapEntry<String, dynamic> param) =>
|
|
||||||
asyncParams.containsKey(param.key) && param.value is String;
|
|
||||||
bool get hasFutures => state.allParams.entries.any(isAsyncParam);
|
bool get hasFutures => state.allParams.entries.any(isAsyncParam);
|
||||||
Future<bool> completeFutures() => Future.wait(
|
Future<bool> completeFutures() => Future.wait(
|
||||||
state.allParams.entries.where(isAsyncParam).map(
|
state.allParams.entries.where(isAsyncParam).map(
|
||||||
(param) async {
|
(param) async {
|
||||||
final doc = await asyncParams[param.key]!(param.value)
|
final doc = await asyncParams[param.key]!(param.value).onError((_, __) => null);
|
||||||
.onError((_, __) => null);
|
|
||||||
if (doc != null) {
|
if (doc != null) {
|
||||||
futureParamValues[param.key] = doc;
|
futureParamValues[param.key] = doc;
|
||||||
return true;
|
return true;
|
||||||
|
@ -370,15 +309,12 @@ class FFParameters {
|
||||||
),
|
),
|
||||||
).onError((_, __) => [false]).then((v) => v.every((e) => e));
|
).onError((_, __) => [false]).then((v) => v.every((e) => e));
|
||||||
|
|
||||||
dynamic getParam<T>(String paramName, ParamType type,
|
dynamic getParam<T>(String paramName, ParamType type, {bool isList = false, StructBuilder<T>? structBuilder}) {
|
||||||
{bool isList = false, StructBuilder<T>? structBuilder}) {
|
if (futureParamValues.containsKey(paramName)) return futureParamValues[paramName];
|
||||||
if (futureParamValues.containsKey(paramName))
|
|
||||||
return futureParamValues[paramName];
|
|
||||||
if (!state.allParams.containsKey(paramName)) return null;
|
if (!state.allParams.containsKey(paramName)) return null;
|
||||||
final param = state.allParams[paramName];
|
final param = state.allParams[paramName];
|
||||||
if (param is! String) return param;
|
if (param is! String) return param;
|
||||||
return deserializeParam<T>(param, type, isList,
|
return deserializeParam<T>(param, type, isList, structBuilder: structBuilder);
|
||||||
structBuilder: structBuilder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,16 +354,13 @@ class FFRoute {
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: child,
|
child: child,
|
||||||
transitionDuration: transitionInfo.duration,
|
transitionDuration: transitionInfo.duration,
|
||||||
transitionsBuilder:
|
transitionsBuilder: (context, animation, secondaryAnimation, child) => PageTransition(
|
||||||
(context, animation, secondaryAnimation, child) =>
|
|
||||||
PageTransition(
|
|
||||||
type: transitionInfo.transitionType,
|
type: transitionInfo.transitionType,
|
||||||
duration: transitionInfo.duration,
|
duration: transitionInfo.duration,
|
||||||
reverseDuration: transitionInfo.duration,
|
reverseDuration: transitionInfo.duration,
|
||||||
alignment: transitionInfo.alignment,
|
alignment: transitionInfo.alignment,
|
||||||
child: child,
|
child: child,
|
||||||
).buildTransitions(
|
).buildTransitions(context, animation, secondaryAnimation, child),
|
||||||
context, animation, secondaryAnimation, child),
|
|
||||||
)
|
)
|
||||||
: MaterialPage(key: state.pageKey, child: child);
|
: MaterialPage(key: state.pageKey, child: child);
|
||||||
},
|
},
|
||||||
|
@ -448,8 +381,7 @@ class TransitionInfo {
|
||||||
final Duration duration;
|
final Duration duration;
|
||||||
final Alignment? alignment;
|
final Alignment? alignment;
|
||||||
|
|
||||||
static TransitionInfo appDefault() =>
|
static TransitionInfo appDefault() => const TransitionInfo(hasTransition: false);
|
||||||
const TransitionInfo(hasTransition: false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class RootPageContext {
|
class RootPageContext {
|
||||||
|
@ -461,9 +393,7 @@ class RootPageContext {
|
||||||
final rootPageContext = context.read<RootPageContext?>();
|
final rootPageContext = context.read<RootPageContext?>();
|
||||||
final isRootPage = rootPageContext?.isRootPage ?? false;
|
final isRootPage = rootPageContext?.isRootPage ?? false;
|
||||||
final location = GoRouterState.of(context).uri.toString();
|
final location = GoRouterState.of(context).uri.toString();
|
||||||
return isRootPage &&
|
return isRootPage && location != '/' && location != rootPageContext?.errorRoute;
|
||||||
location != '/' &&
|
|
||||||
location != rootPageContext?.errorRoute;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Widget wrap(Widget child, {String? errorRoute}) =>
|
static Widget wrap(Widget child, {String? errorRoute}) =>
|
||||||
|
|
|
@ -54,8 +54,7 @@ class App extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
State<App> createState() => _AppState();
|
State<App> createState() => _AppState();
|
||||||
|
|
||||||
static _AppState of(BuildContext context) =>
|
static _AppState of(BuildContext context) => context.findAncestorStateOfType<_AppState>()!;
|
||||||
context.findAncestorStateOfType<_AppState>()!;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AppState extends State<App> {
|
class _AppState extends State<App> {
|
||||||
|
@ -97,8 +96,7 @@ class _AppState extends State<App> {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates =
|
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates = const [
|
||||||
const [
|
|
||||||
FFLocalizationsDelegate(),
|
FFLocalizationsDelegate(),
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
@ -140,8 +138,7 @@ class _AppState extends State<App> {
|
||||||
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
|
await StorageHelper().set(SecureStorageKey.haveLocal.value, true);
|
||||||
log('onMessageOpenedApp');
|
log('onMessageOpenedApp');
|
||||||
} else {
|
} else {
|
||||||
onMessageReceived(message.data, message.notification!.body,
|
onMessageReceived(message.data, message.notification!.body, message.data['click_action']);
|
||||||
message.data['click_action']);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FirebaseMessaging.instance.getInitialMessage().then((message) async {
|
FirebaseMessaging.instance.getInitialMessage().then((message) async {
|
||||||
|
@ -175,9 +172,7 @@ class _AppState extends State<App> {
|
||||||
_router = createRouter(_appStateNotifier);
|
_router = createRouter(_appStateNotifier);
|
||||||
Future.delayed(
|
Future.delayed(
|
||||||
const Duration(milliseconds: 1000),
|
const Duration(milliseconds: 1000),
|
||||||
() => mounted
|
() => mounted ? setState(() => _appStateNotifier.stopShowingSplashImage()) : null,
|
||||||
? setState(() => _appStateNotifier.stopShowingSplashImage())
|
|
||||||
: null,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
_setupFirebaseMessaging();
|
_setupFirebaseMessaging();
|
||||||
|
|
|
@ -504,6 +504,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
height: 40,
|
height: 40,
|
||||||
|
|
|
@ -1049,4 +1049,6 @@ class _PetsPageWidgetState extends State<PetsPageWidget>
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,220 @@
|
||||||
|
part of 'vehicles_on_the_property.dart';
|
||||||
|
|
||||||
|
/// [VehicleHistoryScreen] is a StatefulWidget that displays a list of vehicles.
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class VehicleHistoryScreen extends StatefulWidget {
|
||||||
|
VehicleHistoryScreen(this.model, {super.key});
|
||||||
|
late VehicleModel model;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<VehicleHistoryScreen> createState() => _VehicleHistoryScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _VehicleHistoryScreenState extends State<VehicleHistoryScreen> {
|
||||||
|
late Future<void> _future = _fetchVisits();
|
||||||
|
late ScrollController _scrollController;
|
||||||
|
List<dynamic> _wrap = [];
|
||||||
|
int _pageNumber = 1;
|
||||||
|
bool _hasData = false;
|
||||||
|
bool _loading = false;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
// widget.model = createModel(context, () => VehicleModel());
|
||||||
|
_future = _fetchVisits();
|
||||||
|
_scrollController = ScrollController()
|
||||||
|
..addListener(() {
|
||||||
|
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
||||||
|
_loadMore();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
|
content: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: "Não há mais dados.",
|
||||||
|
enText: "No more data.",
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
duration: const Duration(seconds: 3),
|
||||||
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRandomStatus() {
|
||||||
|
var statuses = ['ATI', 'INA', 'APR_CREATE', 'APR_DELETE', 'APR_UPDATE', 'AGU_CHANGE'];
|
||||||
|
statuses.shuffle();
|
||||||
|
return statuses.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _item(BuildContext context, Map<String, dynamic> uItem) {
|
||||||
|
uItem['status'] = getRandomStatus();
|
||||||
|
return CardItemTemplateComponentWidget(
|
||||||
|
imagePath: null,
|
||||||
|
labelsHashMap: {
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||||
|
uItem['licensePlate'] ?? '',
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:': uItem['model'] ?? '',
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:': uItem['tag'] ?? '',
|
||||||
|
},
|
||||||
|
statusHashMap: [widget.model.generateStatusColorMap(uItem)],
|
||||||
|
onTapCardItemAction: () async {
|
||||||
|
await showDialog(
|
||||||
|
useSafeArea: true,
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return Dialog(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: widget.model.buildVehicleDetails(
|
||||||
|
item: uItem,
|
||||||
|
context: context,
|
||||||
|
model: widget.model,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
).whenComplete(() {
|
||||||
|
safeSetState(() {
|
||||||
|
_pageNumber = 1;
|
||||||
|
_wrap = [];
|
||||||
|
_future = _fetchVisits().then((value) => value!.jsonBody['vehicles'] ?? []);
|
||||||
|
});
|
||||||
|
}).catchError((e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículos", e, s);
|
||||||
|
safeSetState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<ApiCallResponse?> _fetchVisits() async {
|
||||||
|
try {
|
||||||
|
setState(() => _loading = true);
|
||||||
|
|
||||||
|
var response = await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString());
|
||||||
|
|
||||||
|
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
|
||||||
|
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
||||||
|
|
||||||
|
if (vehicles.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
_wrap.addAll(vehicles);
|
||||||
|
_hasData = true;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
_showNoMoreDataSnackBar(context);
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return null;
|
||||||
|
} catch (e, s) {
|
||||||
|
DialogUtil.errorDefault(context);
|
||||||
|
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Veículo", e, s);
|
||||||
|
setState(() {
|
||||||
|
_hasData = false;
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _loadMore() {
|
||||||
|
if (_hasData == true) {
|
||||||
|
_pageNumber++;
|
||||||
|
|
||||||
|
_future = _fetchVisits();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
late final limitedHeaderTextSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Center(
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: "Nenhum veículo encontrado!",
|
||||||
|
enText: "No vehicle found",
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'Nunito',
|
||||||
|
fontSize: limitedHeaderTextSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else if (_hasData == true || _pageNumber >= 1)
|
||||||
|
Expanded(
|
||||||
|
child: FutureBuilder<void>(
|
||||||
|
future: _future,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
controller: _scrollController,
|
||||||
|
itemCount: _wrap.length + 1,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
if (index == 0) {
|
||||||
|
// Add your item here
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
textAlign: TextAlign.right,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Map<String, dynamic> item = _wrap[index - 1];
|
||||||
|
return _item(context, item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
if (_hasData == true && _loading == true)
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
||||||
|
child: Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
valueColor: AlwaysStoppedAnimation<Color>(
|
||||||
|
FlutterFlowTheme.of(context).primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
].addToStart(const SizedBox(height: 0)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,54 +1,447 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/features/backend/index.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/index.dart';
|
||||||
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
||||||
|
import 'package:hub/shared/utils/index.dart';
|
||||||
|
|
||||||
|
class VehicleModel extends FlutterFlowModel<VehiclePage> {
|
||||||
|
@override
|
||||||
|
void initState(BuildContext context) {
|
||||||
|
resetInstance();
|
||||||
|
initAsync();
|
||||||
|
tabBarController = TabController(
|
||||||
|
vsync: Navigator.of(context),
|
||||||
|
length: 2,
|
||||||
|
);
|
||||||
|
|
||||||
|
textFieldFocusLicensePlate = FocusNode();
|
||||||
|
textFieldControllerLicensePlate = TextEditingController();
|
||||||
|
|
||||||
|
textFieldFocusColor = FocusNode();
|
||||||
|
textFieldControllerColor = TextEditingController();
|
||||||
|
|
||||||
|
textFieldFocusModel = FocusNode();
|
||||||
|
textFieldControllerModel = TextEditingController();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
tabBarController.dispose();
|
||||||
|
textFieldFocusLicensePlate!.dispose();
|
||||||
|
textFieldControllerLicensePlate!.dispose();
|
||||||
|
textFieldFocusColor!.dispose();
|
||||||
|
textFieldControllerColor!.dispose();
|
||||||
|
textFieldFocusModel!.dispose();
|
||||||
|
textFieldControllerModel!.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
class VehicleModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
|
||||||
static VehicleModel? _instance = VehicleModel._internal();
|
static VehicleModel? _instance = VehicleModel._internal();
|
||||||
VehicleModel._internal();
|
VehicleModel._internal();
|
||||||
factory VehicleModel() => _instance ?? VehicleModel._internal();
|
factory VehicleModel() => _instance ?? VehicleModel._internal();
|
||||||
static void resetInstance() => _instance = null;
|
static void resetInstance() => _instance = null;
|
||||||
|
|
||||||
dynamic item;
|
dynamic item;
|
||||||
|
String? vehicleId;
|
||||||
|
|
||||||
@override
|
late final TabController tabBarController;
|
||||||
void initState(BuildContext context) {
|
VoidCallback? onUpdateVehicle;
|
||||||
resetInstance();
|
VoidCallback? onRegisterVehicle;
|
||||||
|
VoidCallback? safeSetState;
|
||||||
|
|
||||||
initAsync();
|
final GlobalKey<FormState> registerFormKey = GlobalKey<FormState>();
|
||||||
|
final GlobalKey<FormState> updateFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
|
ApiCallResponse? vehicleResponse;
|
||||||
|
bool isEditing = false;
|
||||||
|
BuildContext context = navigatorKey.currentContext!;
|
||||||
|
|
||||||
|
FocusNode? textFieldFocusLicensePlate;
|
||||||
|
TextEditingController? textFieldControllerLicensePlate;
|
||||||
|
String? textControllerLicensePlateValidator(BuildContext context, String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Placa é obrigatória',
|
||||||
|
enText: 'License Plate is required',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// (ABC-1234)
|
||||||
|
final brazilianPlateRegex = RegExp(r'^[A-Z]{3}-\d{4}$');
|
||||||
|
// (ABC1D23)
|
||||||
|
final mercosurPlateRegex = RegExp(r'^[A-Z]{3}\d[A-Z]\d{2}$');
|
||||||
|
|
||||||
|
if (!brazilianPlateRegex.hasMatch(value) && !mercosurPlateRegex.hasMatch(value)) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Placa inválida',
|
||||||
|
enText: 'Invalid license plate',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
FocusNode? textFieldFocusColor;
|
||||||
void dispose() {}
|
TextEditingController? textFieldControllerColor;
|
||||||
|
String? textControllerColorValidator(BuildContext contexnt, String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cor é obrigatória',
|
||||||
|
enText: 'Color is required',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusNode? textFieldFocusModel;
|
||||||
|
TextEditingController? textFieldControllerModel;
|
||||||
|
String? textControllerModelValidator(BuildContext contexnt, String? value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Modelo é obrigatório',
|
||||||
|
enText: 'Model is required',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> initAsync() async {}
|
Future<void> initAsync() async {}
|
||||||
|
|
||||||
|
Map<String, Color> generateStatusColorMap(dynamic uItem) {
|
||||||
|
final statusMap = {
|
||||||
|
"ATI": {
|
||||||
|
"text": FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ativo',
|
||||||
|
enText: 'Active',
|
||||||
|
),
|
||||||
|
"color": FlutterFlowTheme.of(context).success,
|
||||||
|
},
|
||||||
|
"INA": {
|
||||||
|
"text": FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Inativo',
|
||||||
|
enText: 'Inactive',
|
||||||
|
),
|
||||||
|
"color": FlutterFlowTheme.of(context).accent2,
|
||||||
|
},
|
||||||
|
"APR_CREATE": {
|
||||||
|
"text": FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Criando',
|
||||||
|
enText: 'Creating',
|
||||||
|
),
|
||||||
|
"color": FlutterFlowTheme.of(context).success,
|
||||||
|
},
|
||||||
|
"APR_DELETE": {
|
||||||
|
"text": FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Deletando',
|
||||||
|
enText: 'Deleting',
|
||||||
|
),
|
||||||
|
"color": FlutterFlowTheme.of(context).error,
|
||||||
|
},
|
||||||
|
"APR_UPDATE": {
|
||||||
|
"text": FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Atualizando',
|
||||||
|
enText: 'Updating',
|
||||||
|
),
|
||||||
|
"color": FlutterFlowTheme.of(context).warning,
|
||||||
|
},
|
||||||
|
"AGU_CHANGE": {
|
||||||
|
"text": FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Aguardando',
|
||||||
|
enText: 'Waiting',
|
||||||
|
),
|
||||||
|
"color": FlutterFlowTheme.of(context).accent2,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
final status = uItem['status'];
|
||||||
|
if (statusMap.containsKey(status)) {
|
||||||
|
return {
|
||||||
|
statusMap[status]!['text'] as String: statusMap[status]!['color'] as Color,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
List<FFButtonWidget> generateActionButtons(dynamic item) {
|
||||||
|
final Color iconButtonColor = FlutterFlowTheme.of(context).primaryText;
|
||||||
|
final FFButtonOptions buttonOptions = FFButtonOptions(
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
fontSize: LimitedFontSizeUtil.getNoResizeFont(context, 15),
|
||||||
|
),
|
||||||
|
splashColor: FlutterFlowTheme.of(context).success,
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return [
|
||||||
|
if (item['status'].contains('AGU'))
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Editar',
|
||||||
|
enText: 'Edit',
|
||||||
|
),
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: iconButtonColor,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
context.pop();
|
||||||
|
isEditing = true;
|
||||||
|
item = item;
|
||||||
|
|
||||||
|
switchTab(1);
|
||||||
|
setEditForm();
|
||||||
|
},
|
||||||
|
options: buttonOptions,
|
||||||
|
),
|
||||||
|
if (item['status'].contains('APR') || item['status'].contains('AGU'))
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelar',
|
||||||
|
enText: 'Cancel',
|
||||||
|
),
|
||||||
|
icon: Icon(Icons.close, color: iconButtonColor),
|
||||||
|
onPressed: () async {
|
||||||
|
showAlertDialog(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelar Solicitação',
|
||||||
|
enText: 'Cancel Request',
|
||||||
|
),
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Você tem certeza que deseja cancelar essa solicitação?',
|
||||||
|
enText: 'Are you sure you want to delete this request?',
|
||||||
|
), () async {
|
||||||
|
int id = item['vehicleId'];
|
||||||
|
await PhpGroup.deleteVehicle.call(vehicleId: id).then((value) {
|
||||||
|
context.pop(value);
|
||||||
|
context.pop(value);
|
||||||
|
|
||||||
|
if (value.jsonBody['error'] == false) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao cancelar solicitação',
|
||||||
|
enText: 'Error canceling request',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
} else if (value.jsonBody['error'] == true) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Success canceling request',
|
||||||
|
ptText: 'Succeso ao cancelar solicitação',
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}).catchError((err, stack) {
|
||||||
|
context.pop();
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Error canceling request',
|
||||||
|
ptText: 'Erro ao cancelar solicitação',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: buttonOptions,
|
||||||
|
),
|
||||||
|
if (item['status'].contains('ATI'))
|
||||||
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Excluir',
|
||||||
|
enText: 'Delete',
|
||||||
|
),
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: iconButtonColor,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
showAlertDialog(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Excluir Veículo',
|
||||||
|
enText: 'Delete Vehicle',
|
||||||
|
),
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Você tem certeza que deseja excluir esse veículo?',
|
||||||
|
enText: 'Are you sure you want to delete this vehicle?',
|
||||||
|
), () async {
|
||||||
|
int id = item['vehicleId'];
|
||||||
|
await PhpGroup.deleteVehicle.call(vehicleId: id).then((value) {
|
||||||
|
context.pop(value);
|
||||||
|
context.pop(value);
|
||||||
|
|
||||||
|
if (value == false) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao excluir veículo',
|
||||||
|
enText: 'Error deleting vehicle',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
} else if (value == true) {
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Success deleting vehicle',
|
||||||
|
ptText: 'Succeso ao excluir veículo',
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}).catchError((err, stack) {
|
||||||
|
context.pop();
|
||||||
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Error deleting vehicle',
|
||||||
|
ptText: 'Erro ao excluir veículo',
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
options: buttonOptions,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> generateLabelsHashMap(dynamic item) {
|
||||||
|
return {
|
||||||
|
if (item['model'] != null && item['model'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:':
|
||||||
|
item['model'].toString().toUpperCase(),
|
||||||
|
if (item['licensePlate'] != null && item['licensePlate'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
||||||
|
item['licensePlate'].toString().toUpperCase(),
|
||||||
|
if (item['color'] != null && item['color'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
||||||
|
item['color'].toString().toUpperCase(),
|
||||||
|
if (item['personName'] != null && item['personName'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Proprietário", enText: "Owner")}:':
|
||||||
|
item['personName'].toString().toUpperCase(),
|
||||||
|
if (item['tag'] != null && item['tag'] != '')
|
||||||
|
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:':
|
||||||
|
item['tag'].toString().toUpperCase(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Widget buildVehicleDetails({
|
Widget buildVehicleDetails({
|
||||||
required dynamic item,
|
required dynamic item,
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
required VehicleModel model,
|
required VehicleModel model,
|
||||||
}) {
|
}) {
|
||||||
|
final status = generateStatusColorMap(item);
|
||||||
|
final buttons = generateActionButtons(item);
|
||||||
|
final labels = generateLabelsHashMap(item);
|
||||||
return DetailsComponentWidget(
|
return DetailsComponentWidget(
|
||||||
buttons: [],
|
buttons: buttons,
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: labels,
|
||||||
if (item['model'] != null && item['model'] != '')
|
statusHashMap: [status],
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:':
|
|
||||||
item['model'].toString().toUpperCase(),
|
|
||||||
if (item['licensePlate'] != null && item['licensePlate'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
|
||||||
item['licensePlate'].toString().toUpperCase(),
|
|
||||||
if (item['color'] != null && item['color'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Cor", enText: "Color")}:':
|
|
||||||
item['color'].toString().toUpperCase(),
|
|
||||||
if (item['personName'] != null && item['personName'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Proprietário", enText: "Owner")}:':
|
|
||||||
item['personName'].toString().toUpperCase(),
|
|
||||||
if (item['tag'] != null && item['tag'] != '')
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:':
|
|
||||||
item['tag'].toString().toUpperCase(),
|
|
||||||
}),
|
|
||||||
statusHashMap: [],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setEditForm() {
|
||||||
|
if (item != null) {
|
||||||
|
vehicleId = item['vehicleId'];
|
||||||
|
textFieldControllerLicensePlate!.text = item['licensePlate'];
|
||||||
|
textFieldControllerColor!.text = item['color'];
|
||||||
|
textFieldControllerModel!.text = item['model'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isFormValid(BuildContext context) {
|
||||||
|
if (registerFormKey.currentState == null) return false;
|
||||||
|
return registerFormKey.currentState!.validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateVehicle() async {
|
||||||
|
final response = await PhpGroup.updateVehicle.call(
|
||||||
|
licensePlate: textFieldControllerLicensePlate!.text,
|
||||||
|
color: textFieldControllerColor!.text,
|
||||||
|
model: textFieldControllerModel!.text,
|
||||||
|
vehicleId: vehicleId!,
|
||||||
|
);
|
||||||
|
if (response.jsonBody['error'] == false) {
|
||||||
|
await DialogUtil.success(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Veículo atualizado com sucesso',
|
||||||
|
enText: 'Vehicle updated successfully',
|
||||||
|
)).then((_) async {
|
||||||
|
switchTab(0);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
String errorMessage;
|
||||||
|
try {
|
||||||
|
errorMessage = response.jsonBody['message'];
|
||||||
|
} catch (e) {
|
||||||
|
errorMessage = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao atualizar veículo',
|
||||||
|
enText: 'Error updating vehicle',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await DialogUtil.error(context, errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> registerVehicle() async {
|
||||||
|
final response = await PhpGroup.registerVehicle.call(
|
||||||
|
licensePlate: textFieldControllerLicensePlate!.text,
|
||||||
|
color: textFieldControllerColor!.text,
|
||||||
|
model: textFieldControllerModel!.text,
|
||||||
|
);
|
||||||
|
if (response.jsonBody['error'] == false) {
|
||||||
|
await DialogUtil.success(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Veículo cadastrado com sucesso',
|
||||||
|
enText: 'Vehicle registered successfully',
|
||||||
|
)).then((_) async {
|
||||||
|
switchTab(0);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
String errorMessage;
|
||||||
|
try {
|
||||||
|
errorMessage = response.jsonBody['message'];
|
||||||
|
} catch (e) {
|
||||||
|
errorMessage = FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Erro ao cadastrar veículo',
|
||||||
|
enText: 'Error registering vehicle',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await DialogUtil.error(context, errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void switchTab(int index) {
|
||||||
|
tabBarController.animateTo(index);
|
||||||
|
if (index == 0) handleEditingChanged(false);
|
||||||
|
safeSetState?.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearFields() async {
|
||||||
|
textFieldControllerLicensePlate!.clear();
|
||||||
|
textFieldControllerColor!.clear();
|
||||||
|
textFieldControllerModel!.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleEditingChanged(bool editing) {
|
||||||
|
isEditing = editing;
|
||||||
|
clearFields();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
part of 'vehicles_on_the_property.dart';
|
||||||
|
|
||||||
|
/// [VehicleRegisterScreen] is a StatefulWidget that displays a form to register a vehicle.
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class VehicleRegisterScreen extends StatefulWidget {
|
||||||
|
VehicleRegisterScreen(this.model, {super.key});
|
||||||
|
late VehicleModel model;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<VehicleRegisterScreen> createState() => _VehicleRegisterScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _VehicleRegisterScreenState extends State<VehicleRegisterScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
double limitedInputFontSize = LimitedFontSizeUtil.getInputFontSize(context);
|
||||||
|
double limitedHeaderFontSize = LimitedFontSizeUtil.getHeaderFontSize(context);
|
||||||
|
double limitedSubHeaderFontSize = LimitedFontSizeUtil.getSubHeaderFontSize(context);
|
||||||
|
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Preencha o formulário de cadastro com os dados do seu veículo',
|
||||||
|
enText: 'Fill out the registration form with your vehicle data',
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
fontSize: limitedHeaderFontSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: widget.model.registerFormKey,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomInputUtil(
|
||||||
|
controller: widget.model.textFieldControllerLicensePlate,
|
||||||
|
validator: widget.model.textControllerLicensePlateValidator.asValidator(context),
|
||||||
|
focusNode: widget.model.textFieldFocusLicensePlate,
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||||
|
hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||||
|
suffixIcon: Symbols.format_color_text,
|
||||||
|
haveMaxLength: true,
|
||||||
|
onChanged: (value) => setState(() {}),
|
||||||
|
maxLength: 80,
|
||||||
|
),
|
||||||
|
CustomInputUtil(
|
||||||
|
controller: widget.model.textFieldControllerModel,
|
||||||
|
validator: widget.model.textControllerModelValidator.asValidator(context),
|
||||||
|
focusNode: widget.model.textFieldFocusModel,
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'),
|
||||||
|
hintText: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ex: Voyage, Ford',
|
||||||
|
enText: 'e.g. Voyage, Ford',
|
||||||
|
),
|
||||||
|
suffixIcon: Symbols.car_repair,
|
||||||
|
haveMaxLength: true,
|
||||||
|
onChanged: (value) => setState(() {}),
|
||||||
|
maxLength: 80,
|
||||||
|
),
|
||||||
|
CustomInputUtil(
|
||||||
|
controller: widget.model.textFieldControllerColor,
|
||||||
|
validator: widget.model.textControllerColorValidator.asValidator(context),
|
||||||
|
focusNode: widget.model.textFieldFocusColor,
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'),
|
||||||
|
hintText: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ex: Preto, Amarelo, Branco',
|
||||||
|
enText: 'e.g. Black, Yellow, White',
|
||||||
|
),
|
||||||
|
suffixIcon: Symbols.palette,
|
||||||
|
haveMaxLength: true,
|
||||||
|
onChanged: (value) => setState(() {}),
|
||||||
|
maxLength: 80,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
||||||
|
child: SubmitButtonUtil(
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register'),
|
||||||
|
onPressed: widget.model.isFormValid(context) ? widget.model.registerVehicle : null),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
part of 'vehicles_on_the_property.dart';
|
||||||
|
|
||||||
|
/// [VehicleUpdateScreen] is a StatefulWidget that displays a form to update a vehicle.
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class VehicleUpdateScreen extends StatefulWidget {
|
||||||
|
VehicleUpdateScreen(this.model, {super.key});
|
||||||
|
late VehicleModel model;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<VehicleUpdateScreen> createState() => _VehicleUpdateScreenState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _VehicleUpdateScreenState extends State<VehicleUpdateScreen> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Preencha o formulário de alteração com os dados do seu veículo',
|
||||||
|
enText: 'Fill out the update form with your vehicle data',
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Form(
|
||||||
|
key: widget.model.updateFormKey,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
CustomInputUtil(
|
||||||
|
controller: widget.model.textFieldControllerLicensePlate,
|
||||||
|
validator: widget.model.textControllerLicensePlateValidator.asValidator(context),
|
||||||
|
focusNode: widget.model.textFieldFocusLicensePlate,
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||||
|
hintText: FFLocalizations.of(context).getVariableText(ptText: 'Placa', enText: 'License Plate'),
|
||||||
|
suffixIcon: Symbols.format_color_text,
|
||||||
|
haveMaxLength: true,
|
||||||
|
onChanged: (value) => setState(() {}),
|
||||||
|
maxLength: 80,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||||
|
child: CustomInputUtil(
|
||||||
|
controller: widget.model.textFieldControllerModel,
|
||||||
|
validator: widget.model.textControllerModelValidator.asValidator(context),
|
||||||
|
focusNode: widget.model.textFieldFocusModel,
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Modelo', enText: 'Model'),
|
||||||
|
hintText: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ex: Voyage, Ford',
|
||||||
|
enText: 'e.g. Voyage, Ford',
|
||||||
|
),
|
||||||
|
suffixIcon: Icons.car_repair,
|
||||||
|
haveMaxLength: true,
|
||||||
|
onChanged: (value) => setState(() {}),
|
||||||
|
maxLength: 80,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(0, 0, 0, 15),
|
||||||
|
child: CustomInputUtil(
|
||||||
|
controller: widget.model.textFieldControllerColor,
|
||||||
|
validator: widget.model.textControllerColorValidator.asValidator(context),
|
||||||
|
focusNode: widget.model.textFieldFocusColor,
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Cor', enText: 'Color'),
|
||||||
|
hintText: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Ex: Preto, Amarelo, Branco',
|
||||||
|
enText: 'e.g. Black, Yellow, White',
|
||||||
|
),
|
||||||
|
suffixIcon: Icons.pets_outlined,
|
||||||
|
haveMaxLength: true,
|
||||||
|
onChanged: (value) => setState(() {}),
|
||||||
|
maxLength: 80,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(70, 20, 70, 30),
|
||||||
|
child: SubmitButtonUtil(
|
||||||
|
labelText: FFLocalizations.of(context).getVariableText(ptText: 'Salvar', enText: 'Save'),
|
||||||
|
onPressed: widget.model.isFormValid(context) ? widget.model.updateVehicle : null),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,10 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:hub/components/atomic_components/shared_components_atoms/custom_input.dart';
|
||||||
|
import 'package:hub/components/atomic_components/shared_components_atoms/submit_button.dart';
|
||||||
|
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||||
import 'package:hub/features/backend/index.dart';
|
import 'package:hub/features/backend/index.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
||||||
|
@ -9,141 +14,109 @@ import 'package:hub/pages/vehicles_on_the_property/vehicle_model.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/limited_text_size.dart';
|
import 'package:hub/shared/utils/limited_text_size.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
|
|
||||||
class VehicleOnTheProperty extends StatefulWidget {
|
part 'vehicle_history_screen.dart';
|
||||||
const VehicleOnTheProperty({super.key});
|
part 'vehicle_register_screen.dart';
|
||||||
|
part 'vehicle_update_screen.dart';
|
||||||
|
|
||||||
|
/// [VehiclePage] is a StatefulWidget that displays the vehicle screens.
|
||||||
|
|
||||||
|
class VehiclePage extends StatefulWidget {
|
||||||
|
const VehiclePage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_VehicleOnThePropertyState createState() => _VehicleOnThePropertyState();
|
_VehiclePageState createState() => _VehiclePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _VehicleOnThePropertyState extends State<VehicleOnTheProperty>
|
class _VehiclePageState extends State<VehiclePage> with TickerProviderStateMixin {
|
||||||
with TickerProviderStateMixin {
|
|
||||||
late ScrollController _scrollController;
|
|
||||||
|
|
||||||
int _pageNumber = 1;
|
|
||||||
bool _hasData = false;
|
|
||||||
bool _loading = false;
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
late final VehicleModel model;
|
late final VehicleModel _model;
|
||||||
|
|
||||||
late Future<void> _future;
|
|
||||||
List<dynamic> _wrap = [];
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
model = createModel(context, () => VehicleModel());
|
_model = createModel(context, () => VehicleModel());
|
||||||
_future = _fetchVisits();
|
|
||||||
_scrollController = ScrollController()
|
_model.updateOnChange = true;
|
||||||
..addListener(() {
|
_model.onUpdateVehicle = () {
|
||||||
if (_scrollController.position.atEdge &&
|
safeSetState(() {
|
||||||
_scrollController.position.pixels != 0) {
|
_model.clearFields();
|
||||||
_loadMore();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
_model.onRegisterVehicle = () {
|
||||||
|
safeSetState(() {
|
||||||
|
_model.clearFields();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
_model.safeSetState = () {
|
||||||
|
safeSetState(() {});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_scrollController.dispose();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
late final limitedHeaderTextSize =
|
final backgroundColor = FlutterFlowTheme.of(context).primaryBackground;
|
||||||
LimitedFontSizeUtil.getHeaderFontSize(context);
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: backgroundColor,
|
||||||
appBar: _appBar(context),
|
appBar: _buildAppBar(context),
|
||||||
body: Column(
|
body: _buildBody(context),
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (_hasData == false && _pageNumber <= 1 && _loading == false)
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Center(
|
|
||||||
child: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: "Nenhum veículo encontrado!",
|
|
||||||
enText: "No vehicle found",
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontFamily: 'Nunito',
|
|
||||||
fontSize: limitedHeaderTextSize,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else if (_hasData == true || _pageNumber >= 1)
|
|
||||||
Expanded(
|
|
||||||
child: FutureBuilder<void>(
|
|
||||||
future: _future,
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
return ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
controller: _scrollController,
|
|
||||||
itemCount: _wrap.length + 1,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
if (index == 0) {
|
|
||||||
// Add your item here
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 30, top: 10),
|
|
||||||
child: Text(
|
|
||||||
'',
|
|
||||||
textAlign: TextAlign.right,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
final item = _wrap[index - 1];
|
|
||||||
return _item(context, item);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
if (_hasData == true && _loading == true)
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.only(top: 15, bottom: 15),
|
|
||||||
child: Center(
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
FlutterFlowTheme.of(context).primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
].addToStart(const SizedBox(height: 0)),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferredSizeWidget _appBar(BuildContext context) {
|
/// [Body] of the page.
|
||||||
|
void onEditingChanged(bool value) {
|
||||||
|
setState(() {
|
||||||
|
_model.handleEditingChanged(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBody(BuildContext context) {
|
||||||
|
final vehicleHistoryScreenLabel =
|
||||||
|
FFLocalizations.of(context).getVariableText(ptText: 'Consultar', enText: 'Consult');
|
||||||
|
final vehicleRegisterScreenLabel =
|
||||||
|
FFLocalizations.of(context).getVariableText(ptText: 'Cadastrar', enText: 'Register');
|
||||||
|
final vehicleUpdateScreenLabel = FFLocalizations.of(context).getVariableText(ptText: 'Editar', enText: 'Edit');
|
||||||
|
|
||||||
|
return TabViewUtil(
|
||||||
|
context: context,
|
||||||
|
model: _model,
|
||||||
|
labelTab1: vehicleHistoryScreenLabel,
|
||||||
|
labelTab2: _model.isEditing ? vehicleUpdateScreenLabel : vehicleRegisterScreenLabel,
|
||||||
|
controller: _model.tabBarController,
|
||||||
|
widget1: VehicleHistoryScreen(_model),
|
||||||
|
widget2: _model.isEditing ? VehicleUpdateScreen(_model) : VehicleRegisterScreen(_model),
|
||||||
|
onEditingChanged: onEditingChanged,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// -----------------------------------
|
||||||
|
/// [AppBar] with the title of the page.
|
||||||
|
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
||||||
|
final theme = FlutterFlowTheme.of(context);
|
||||||
|
final backgroundColor = theme.primaryBackground;
|
||||||
|
final primaryText = theme.primaryText;
|
||||||
|
final title = FFLocalizations.of(context).getVariableText(enText: 'Vehicles', ptText: 'Veículos');
|
||||||
|
final titleStyle = theme.headlineMedium.override(
|
||||||
|
fontFamily: theme.headlineMediumFamily,
|
||||||
|
color: primaryText,
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(theme.headlineMediumFamily),
|
||||||
|
);
|
||||||
|
final backButton = _backButton(context, theme);
|
||||||
|
|
||||||
return AppBar(
|
return AppBar(
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: backgroundColor,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: Text(
|
title: Text(title, style: titleStyle),
|
||||||
FFLocalizations.of(context)
|
leading: backButton,
|
||||||
.getVariableText(enText: 'Vehicles', ptText: 'Veículos'),
|
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).headlineMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
leading: _backButton(context, FlutterFlowTheme.of(context)),
|
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
actions: [],
|
actions: [],
|
||||||
|
@ -151,131 +124,22 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty>
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
Widget _backButton(BuildContext context, FlutterFlowTheme theme) {
|
||||||
|
final Icon icon = Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
color: theme.primaryText,
|
||||||
|
size: 30.0,
|
||||||
|
);
|
||||||
|
onPressed() => Navigator.of(context).pop();
|
||||||
return FlutterFlowIconButton(
|
return FlutterFlowIconButton(
|
||||||
key: ValueKey<String>('BackNavigationAppBar'),
|
key: ValueKey<String>('BackNavigationAppBar'),
|
||||||
borderColor: Colors.transparent,
|
borderColor: Colors.transparent,
|
||||||
borderRadius: 30.0,
|
borderRadius: 30.0,
|
||||||
borderWidth: 1.0,
|
borderWidth: 1.0,
|
||||||
buttonSize: 60.0,
|
buttonSize: 60.0,
|
||||||
icon: Icon(
|
icon: icon,
|
||||||
Icons.keyboard_arrow_left,
|
onPressed: onPressed,
|
||||||
color: theme.primaryText,
|
|
||||||
size: 30.0,
|
|
||||||
),
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ApiCallResponse?> _fetchVisits() async {
|
/// -----------------------------------
|
||||||
try {
|
|
||||||
setState(() => _loading = true);
|
|
||||||
|
|
||||||
var response =
|
|
||||||
await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString());
|
|
||||||
|
|
||||||
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
|
|
||||||
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);
|
|
||||||
|
|
||||||
if (vehicles.isNotEmpty) {
|
|
||||||
setState(() {
|
|
||||||
_wrap.addAll(vehicles);
|
|
||||||
_hasData = true;
|
|
||||||
_loading = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
_showNoMoreDataSnackBar(context);
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
_hasData = false;
|
|
||||||
_loading = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return null;
|
|
||||||
} catch (e, s) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
LogUtil.requestAPIFailed(
|
|
||||||
"proccessRequest.php", "", "Consulta de Veículo", e, s);
|
|
||||||
setState(() {
|
|
||||||
_hasData = false;
|
|
||||||
_loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _loadMore() {
|
|
||||||
if (_hasData == true) {
|
|
||||||
_pageNumber++;
|
|
||||||
|
|
||||||
_future = _fetchVisits();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showNoMoreDataSnackBar(BuildContext context) {
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(
|
|
||||||
content: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: "Não há mais dados.",
|
|
||||||
enText: "No more data.",
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: LimitedFontSizeUtil.getBodyFontSize(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
duration: const Duration(seconds: 3),
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _item(BuildContext context, dynamic uItem) {
|
|
||||||
return CardItemTemplateComponentWidget(
|
|
||||||
imagePath: null,
|
|
||||||
labelsHashMap: {
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Placa", enText: "License Plate")}:':
|
|
||||||
uItem['licensePlate'] ?? '',
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Modelo", enText: "Model")}:':
|
|
||||||
uItem['model'] ?? '',
|
|
||||||
'${FFLocalizations.of(context).getVariableText(ptText: "Tag", enText: "Tag")}:':
|
|
||||||
uItem['tag'] ?? '',
|
|
||||||
},
|
|
||||||
statusHashMap: [],
|
|
||||||
onTapCardItemAction: () async {
|
|
||||||
await showDialog(
|
|
||||||
useSafeArea: true,
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return Dialog(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: model.buildVehicleDetails(
|
|
||||||
item: uItem,
|
|
||||||
context: context,
|
|
||||||
model: model,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
).whenComplete(() {
|
|
||||||
safeSetState(() {
|
|
||||||
_pageNumber = 1;
|
|
||||||
_wrap = [];
|
|
||||||
_future = _fetchVisits()
|
|
||||||
.then((value) => value!.jsonBody['vehicles'] ?? []);
|
|
||||||
});
|
|
||||||
}).catchError((e, s) {
|
|
||||||
DialogUtil.errorDefault(context);
|
|
||||||
LogUtil.requestAPIFailed(
|
|
||||||
"proccessRequest.php", "", "Consulta de Veículos", e, s);
|
|
||||||
safeSetState(() {
|
|
||||||
_hasData = false;
|
|
||||||
_loading = false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,12 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
import 'package:hub/pages/vehicles_on_the_property/vehicles_on_the_property.dart';
|
||||||
|
|
||||||
class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
class VisitsModel extends FlutterFlowModel<VehiclePage> {
|
||||||
static VisitsModel? _instance;
|
static VisitsModel? _instance;
|
||||||
|
|
||||||
VisitsModel._internal({this.onRefresh});
|
VisitsModel._internal({this.onRefresh});
|
||||||
|
|
||||||
factory VisitsModel({VoidCallback? onRefresh}) =>
|
factory VisitsModel({VoidCallback? onRefresh}) => _instance ??= VisitsModel._internal(onRefresh: onRefresh);
|
||||||
_instance ??= VisitsModel._internal(onRefresh: onRefresh);
|
|
||||||
|
|
||||||
static void resetInstance() => _instance = null;
|
static void resetInstance() => _instance = null;
|
||||||
late final VoidCallback? onRefresh;
|
late final VoidCallback? onRefresh;
|
||||||
|
@ -34,8 +33,7 @@ class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
||||||
|
|
||||||
Future<void> initAsync() async {
|
Future<void> initAsync() async {
|
||||||
devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
devUUID = (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
|
||||||
cliUUID =
|
cliUUID = (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
||||||
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
|
|
||||||
onRefresh?.call();
|
onRefresh?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +87,7 @@ class VisitsModel extends FlutterFlowModel<VehicleOnTheProperty> {
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: item['VTA_FIXA'] ? "Entrada Recorrente" : "Entrada Única",
|
ptText: item['VTA_FIXA'] ? "Entrada Recorrente" : "Entrada Única",
|
||||||
enText: item['VTA_FIXA'] ? "Recurrent Entry" : "Single Entry",
|
enText: item['VTA_FIXA'] ? "Recurrent Entry" : "Single Entry",
|
||||||
): item['VTA_FIXA'] == false
|
): item['VTA_FIXA'] == false ? FlutterFlowTheme.of(context).success : FlutterFlowTheme.of(context).warning,
|
||||||
? FlutterFlowTheme.of(context).success
|
|
||||||
: FlutterFlowTheme.of(context).warning,
|
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue