This commit is contained in:
jantunesmessias 2025-02-10 17:58:53 -03:00
parent 8573d722f5
commit 56f16d2934
43 changed files with 515 additions and 228 deletions

View File

@ -25,7 +25,7 @@ Future<void> _loggedWithMultiLocalsAccount(
.set(ProfileStorageKey.ownerUUID.key, '7'); .set(ProfileStorageKey.ownerUUID.key, '7');
await StorageHelper() // await StorageHelper() //
.set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO'); .set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
await PhpGroup // await FreAccessWSGlobal //
.resopndeVinculo .resopndeVinculo
.call(tarefa: 'A'); .call(tarefa: 'A');
await LicenseRepositoryImpl() // await LicenseRepositoryImpl() //
@ -58,7 +58,7 @@ Future<void> _loggedWithSomeoneLocalAccount(
.set(ProfileStorageKey.ownerUUID.key, '7'); .set(ProfileStorageKey.ownerUUID.key, '7');
await StorageHelper() // await StorageHelper() //
.set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO'); .set(ProfileStorageKey.clientName.key, 'FRE ACCESS DEMO');
await PhpGroup // await FreAccessWSGlobal //
.resopndeVinculo .resopndeVinculo
.call(tarefa: 'A'); .call(tarefa: 'A');
await LicenseRepositoryImpl() // await LicenseRepositoryImpl() //

View File

@ -77,7 +77,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
Future<ApiCallResponse?> _fetchLocals() async { Future<ApiCallResponse?> _fetchLocals() async {
try { try {
setState(() => _loading = true); setState(() => _loading = true);
widget.response = await PhpGroup.getLocalsCall.call(); widget.response = await FreAccessWSGlobal.getLocalsCall.call();
final bool isError = widget.response?.jsonBody['error']; final bool isError = widget.response?.jsonBody['error'];
if (isError) { if (isError) {
@ -149,7 +149,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState
Future<dynamic> _fetchResponseLink(String status, String cliID) async { Future<dynamic> _fetchResponseLink(String status, String cliID) async {
try { try {
await StorageHelper().set(ProfileStorageKey.clientUUID.key, cliID); await StorageHelper().set(ProfileStorageKey.clientUUID.key, cliID);
var response = await PhpGroup.resopndeVinculo.call(tarefa: status); var response =
await FreAccessWSGlobal.resopndeVinculo.call(tarefa: status);
if (response.jsonBody['error'] == false) { if (response.jsonBody['error'] == false) {
return { return {

View File

@ -781,7 +781,7 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
IconButton( IconButton(
onPressed: () async { onPressed: () async {
_model.postScheduleVisit = _model.postScheduleVisit =
await PhpGroup.postScheduleVisitCall.call( await FreAccessWSGlobal.postScheduleVisitCall.call(
devDesc: widget.visitObsStr, devDesc: widget.visitObsStr,
idVisitante: widget.visitorStrList, idVisitante: widget.visitorStrList,
dtInicio: dtInicio:
@ -793,13 +793,14 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
obs: widget.visitObsStr, obs: widget.visitObsStr,
); );
if (PhpGroup.postScheduleVisitCall.error( if (FreAccessWSGlobal.postScheduleVisitCall.error(
(_model.postScheduleVisit?.jsonBody ?? ''), (_model.postScheduleVisit?.jsonBody ?? ''),
) == ) ==
false) { false) {
context.pop(); context.pop();
} else { } else {
final String? msg = PhpGroup.postScheduleVisitCall.errorMsg( final String? msg =
FreAccessWSGlobal.postScheduleVisitCall.errorMsg(
(_model.postScheduleVisit?.jsonBody ?? ''), (_model.postScheduleVisit?.jsonBody ?? ''),
); );
await DialogUtil.error(context, msg!) await DialogUtil.error(context, msg!)

View File

@ -75,7 +75,7 @@ class _UpArrowLinkedLocalsComponentWidgetState
), ),
), ),
child: FutureBuilder<ApiCallResponse>( child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getLocalsCall.call(), future: FreAccessWSGlobal.getLocalsCall.call(),
builder: (context, snapshot) { builder: (context, snapshot) {
// Customize what your widget looks like when it's loading. // Customize what your widget looks like when it's loading.
if (!snapshot.hasData) { if (!snapshot.hasData) {
@ -94,7 +94,7 @@ class _UpArrowLinkedLocalsComponentWidgetState
return Builder( return Builder(
builder: (context) { builder: (context) {
final eachLocals = (PhpGroup.getLocalsCall final eachLocals = (FreAccessWSGlobal.getLocalsCall
.locais( .locais(
gridViewGetLocalsResponse.jsonBody, gridViewGetLocalsResponse.jsonBody,
) )

View File

@ -63,14 +63,14 @@ class AccessNotificationModalTemplateComponentModel
}) async { }) async {
ApiCallResponse? visitRequest; ApiCallResponse? visitRequest;
visitRequest = await PhpGroup.respondeSolicitacaoCall.call( visitRequest = await FreAccessWSGlobal.respondeSolicitacaoCall.call(
referencia: refUUID, referencia: refUUID,
tarefa: actionValue, tarefa: actionValue,
resposta: responseValue, resposta: responseValue,
idVisitante: vteUUID, idVisitante: vteUUID,
); );
if (PhpGroup.respondeSolicitacaoCall.error( if (FreAccessWSGlobal.respondeSolicitacaoCall.error(
(visitRequest.jsonBody ?? ''), (visitRequest.jsonBody ?? ''),
) == ) ==
false) { false) {

View File

@ -951,9 +951,10 @@ class _ScheduleProvisionalVisitPageWidgetState
? null ? null
: () async { : () async {
try { try {
model.provVisitSchedule = await PhpGroup model.provVisitSchedule =
.postProvVisitSchedulingCall await FreAccessWSGlobal
.call( .postProvVisitSchedulingCall
.call(
data: DateFormat('dd/MM/yyyy HH:mm:ss') data: DateFormat('dd/MM/yyyy HH:mm:ss')
.format(DateFormat( .format(DateFormat(
'dd/MM/yyyy HH:mm:ss') 'dd/MM/yyyy HH:mm:ss')
@ -964,7 +965,8 @@ class _ScheduleProvisionalVisitPageWidgetState
nome: model.personNameTextController.text, nome: model.personNameTextController.text,
proID: model.ownerUUID, proID: model.ownerUUID,
); );
if (PhpGroup.postProvVisitSchedulingCall if (FreAccessWSGlobal
.postProvVisitSchedulingCall
.error((model.provVisitSchedule .error((model.provVisitSchedule
?.jsonBody ?? ?.jsonBody ??
'')) == '')) ==
@ -982,7 +984,7 @@ class _ScheduleProvisionalVisitPageWidgetState
model.notesTextController?.clear(); model.notesTextController?.clear();
}); });
} else { } else {
var message = PhpGroup var message = FreAccessWSGlobal
.postProvVisitSchedulingCall .postProvVisitSchedulingCall
.msg((model.provVisitSchedule .msg((model.provVisitSchedule
?.jsonBody ?? ?.jsonBody ??

View File

@ -46,7 +46,7 @@ class RegisiterVistorTemplateComponentModel
Future<bool> getVisitanteByDocument( Future<bool> getVisitanteByDocument(
String document, BuildContext context) async { String document, BuildContext context) async {
final response = await PhpGroup.getVisitorByDocCall.call( final response = await FreAccessWSGlobal.getVisitorByDocCall.call(
documento: document, documento: document,
); );

View File

@ -760,7 +760,7 @@ class _RegisiterVistorTemplateComponentWidgetState
_model.uploadedLocalFile, _model.uploadedLocalFile,
); );
_model.scheduleVisitor = _model.scheduleVisitor =
await PhpGroup.postScheduleVisitorCall await FreAccessWSGlobal.postScheduleVisitorCall
.call( .call(
documento: _model.textController2.text, documento: _model.textController2.text,
nome: _model.textController1.text, nome: _model.textController1.text,
@ -775,7 +775,7 @@ class _RegisiterVistorTemplateComponentWidgetState
.onError((e, s) async { .onError((e, s) async {
return await DialogUtil.errorDefault(context); return await DialogUtil.errorDefault(context);
}); });
if (PhpGroup.postScheduleVisitorCall.error( if (FreAccessWSGlobal.postScheduleVisitorCall.error(
(_model.scheduleVisitor?.jsonBody ?? ''), (_model.scheduleVisitor?.jsonBody ?? ''),
) == ) ==
false) { false) {
@ -822,8 +822,8 @@ class _RegisiterVistorTemplateComponentWidgetState
} else { } else {
return await DialogUtil.error( return await DialogUtil.error(
context, context,
PhpGroup.postScheduleVisitorCall.errorMsg( FreAccessWSGlobal.postScheduleVisitorCall
_model .errorMsg(_model
.scheduleVisitor?.jsonBody) == .scheduleVisitor?.jsonBody) ==
null null
? FFLocalizations.of(context) ? FFLocalizations.of(context)
@ -832,7 +832,8 @@ class _RegisiterVistorTemplateComponentWidgetState
'Erro ao se conectar com o servidor', 'Erro ao se conectar com o servidor',
enText: 'Error connecting to server', enText: 'Error connecting to server',
) )
: PhpGroup.postScheduleVisitorCall : FreAccessWSGlobal
.postScheduleVisitorCall
.errorMsg( .errorMsg(
_model.scheduleVisitor?.jsonBody) _model.scheduleVisitor?.jsonBody)
.toString()); .toString());

View File

@ -818,11 +818,11 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
), ),
onPressed: () async { onPressed: () async {
_model.deleteVisit = _model.deleteVisit =
await PhpGroup.deleteVisitCall.call( await FreAccessWSGlobal.deleteVisitCall.call(
idVisita: widget.visitIdStr, idVisita: widget.visitIdStr,
); );
if (PhpGroup.deleteVisitCall.error( if (FreAccessWSGlobal.deleteVisitCall.error(
(_model.deleteVisit?.jsonBody ?? ''), (_model.deleteVisit?.jsonBody ?? ''),
) == ) ==
false) { false) {

View File

@ -406,23 +406,23 @@ class _VisitorSearchModalTemplateComponentWidgetState
_model.textController?.selection = _model.textController?.selection =
TextSelection.collapsed(offset: _model.textController!.text.length); TextSelection.collapsed(offset: _model.textController!.text.length);
}); });
_model.getVisitorByDoc = await PhpGroup.getVisitorByDocCall.call( _model.getVisitorByDoc = await FreAccessWSGlobal.getVisitorByDocCall.call(
documento: _model.textController.text.replaceFirst(RegExp(r'^0+'), '')); documento: _model.textController.text.replaceFirst(RegExp(r'^0+'), ''));
if (PhpGroup.getVisitorByDocCall if (FreAccessWSGlobal.getVisitorByDocCall
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != .vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
'0' && '0' &&
PhpGroup.getVisitorByDocCall FreAccessWSGlobal.getVisitorByDocCall
.error((_model.getVisitorByDoc?.jsonBody ?? '')) == .error((_model.getVisitorByDoc?.jsonBody ?? '')) ==
false && false &&
PhpGroup.getVisitorByDocCall FreAccessWSGlobal.getVisitorByDocCall
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) != .vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
null) { null) {
String newDoc = String newDoc =
_model.textController.text.replaceFirst(RegExp(r'^0+'), ''); _model.textController.text.replaceFirst(RegExp(r'^0+'), '');
bool existDoc = _model.docs.contains(newDoc); bool existDoc = _model.docs.contains(newDoc);
if (existDoc == false) { if (existDoc == false) {
_model.addToVisitors(PhpGroup.getVisitorByDocCall _model.addToVisitors(FreAccessWSGlobal.getVisitorByDocCall
.visitante((_model.getVisitorByDoc?.jsonBody ?? ''))); .visitante((_model.getVisitorByDoc?.jsonBody ?? '')));
safeSetState(() {}); safeSetState(() {});
_model.addToDocs( _model.addToDocs(

View File

@ -14,7 +14,7 @@ import '../../../flutter_flow/random_data_util.dart';
class AuthenticationService { class AuthenticationService {
static Future<void> login(BuildContext context) async { static Future<void> login(BuildContext context) async {
try { try {
final GetLocalsCall callback = PhpGroup.getLocalsCall; final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
final response = await callback.call(); final response = await callback.call();
if (response.jsonBody['error']) { if (response.jsonBody['error']) {
@ -46,7 +46,7 @@ class AuthenticationService {
}) async { }) async {
try { try {
final ApiCallResponse? response; final ApiCallResponse? response;
final LoginCall callback = PhpGroup.loginCall; final LoginCall callback = FreAccessWSGlobal.loginCall;
String deviceDescription = randomString(10, 10, true, false, false); String deviceDescription = randomString(10, 10, true, false, false);
await StorageHelper() await StorageHelper()
.set(SecureStorageKey.deviceDescription.value, deviceDescription); .set(SecureStorageKey.deviceDescription.value, deviceDescription);
@ -111,7 +111,7 @@ class AuthenticationService {
if ((email != null && email != '') && if ((email != null && email != '') &&
(passwd != null && passwd != '' && passwd.length > 7) && (passwd != null && passwd != '' && passwd.length > 7) &&
(name != null && name != '')) { (name != null && name != '')) {
response = await PhpGroup.registerCall.call( response = await FreAccessWSGlobal.registerCall.call(
name: name, name: name,
password: passwd, password: passwd,
email: email, email: email,
@ -137,7 +137,7 @@ class AuthenticationService {
} }
static Future<void> signOut(BuildContext context) async { static Future<void> signOut(BuildContext context) async {
await PhpGroup.unregisterDevice.call(); await FreAccessWSGlobal.unregisterDevice.call();
final Map<String, dynamic> extra = <String, dynamic>{ final Map<String, dynamic> extra = <String, dynamic>{
kTransitionInfoKey: const TransitionInfo( kTransitionInfoKey: const TransitionInfo(
hasTransition: true, hasTransition: true,
@ -158,7 +158,7 @@ class AuthenticationService {
static Future<bool> forgotPassword(BuildContext context, String email) async { static Future<bool> forgotPassword(BuildContext context, String email) async {
try { try {
final ApiCallResponse? response; final ApiCallResponse? response;
final ForgotPasswordCall callback = PhpGroup.forgotPasswordCall; final ForgotPasswordCall callback = FreAccessWSGlobal.forgotPasswordCall;
final String message = FFLocalizations.of(context).getVariableText( final String message = FFLocalizations.of(context).getVariableText(
enText: "Send E-mail Successful!", enText: "Send E-mail Successful!",
ptText: "E-mail Enviado com Sucesso!"); ptText: "E-mail Enviado com Sucesso!");
@ -183,7 +183,8 @@ class AuthenticationService {
static Future<bool> changePassword( static Future<bool> changePassword(
BuildContext context, String email, String password, String token) async { BuildContext context, String email, String password, String token) async {
try { try {
final ApiCallResponse response = await PhpGroup.changePasswordCall final ApiCallResponse response = await FreAccessWSGlobal
.changePasswordCall
.call(email: email, psswd: password, token: token); .call(email: email, psswd: password, token: token);
if (response.jsonBody['error'] == false) { if (response.jsonBody['error'] == false) {
@ -209,7 +210,7 @@ class AuthenticationService {
static Future<void> deleteAccount(BuildContext context) async { static Future<void> deleteAccount(BuildContext context) async {
String content; String content;
try { try {
await PhpGroup.deleteAccount.call().then((value) async { await FreAccessWSGlobal.deleteAccount.call().then((value) async {
if (value.jsonBody['error'] == false) { if (value.jsonBody['error'] == false) {
content = FFLocalizations.of(context).getVariableText( content = FFLocalizations.of(context).getVariableText(
enText: 'Account deleted successfully', enText: 'Account deleted successfully',

View File

@ -24,7 +24,9 @@ abstract class Api {
GetLicense getLicense = GetLicense(); GetLicense getLicense = GetLicense();
} }
class PhpGroup extends Api { abstract class Endpoint {}
class FreAccessWSGlobal extends Api {
static String getBaseUrl() => 'https://freaccess.com.br/freaccess'; static String getBaseUrl() => 'https://freaccess.com.br/freaccess';
static Map<String, String> headers = {}; static Map<String, String> headers = {};
static LoginCall loginCall = LoginCall(); static LoginCall loginCall = LoginCall();
@ -70,11 +72,86 @@ class PhpGroup extends Api {
static GetOpenedVisits getOpenedVisits = GetOpenedVisits(); static GetOpenedVisits getOpenedVisits = GetOpenedVisits();
GetLicense getLicense = GetLicense(); GetLicense getLicense = GetLicense();
static GetProvSchedules getProvSchedules = GetProvSchedules(); static GetProvSchedules getProvSchedules = GetProvSchedules();
static GetCategories getCategories = GetCategories();
static GetDocuments getDocuments = GetDocuments();
} }
class GetProvSchedules { class GetCategories extends Endpoint {
Future<ApiCallResponse> call() async {
final String baseUrl = FreAccessWSGlobal.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 = 'listaCategoriasDocumentos';
const String pageSize = '10';
// final bool isFiltered = filter != '' && filter != '.*';
return await ApiManager.instance.makeApiCall(
callName: 'listaCategoriasDocumentos',
apiUrl: '$baseUrl/processRequest.php',
callType: ApiCallType.POST,
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
params: {
// if (isFiltered) 'filter': filter,
'devUUID': devUUID,
'userUUID': userUUID,
'cliID': cliID,
'atividade': atividade,
'pageSize': pageSize,
},
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true,
encodeBodyUtf8: false,
decodeUtf8: false,
cache: false,
isStreamingApi: false,
alwaysAllowBody: false,
);
}
}
class GetDocuments extends Endpoint {
Future<ApiCallResponse> call(final String page) async {
final String baseUrl = FreAccessWSGlobal.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 = 'listaDocumentos';
const String pageSize = '10';
// final bool isFiltered = filter != '' && filter != '.*';
return await ApiManager.instance.makeApiCall(
callName: 'listaDocumentos',
apiUrl: '$baseUrl/processRequest.php',
callType: ApiCallType.POST,
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
params: {
// if (isFiltered) 'filter': filter,
'devUUID': devUUID,
'userUUID': userUUID,
'cliID': cliID,
'atividade': atividade,
'page': page,
'pageSize': pageSize,
},
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true,
encodeBodyUtf8: false,
decodeUtf8: false,
cache: false,
isStreamingApi: false,
alwaysAllowBody: false,
);
}
}
class GetProvSchedules extends Endpoint {
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 = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String userUUID = final String userUUID =
@ -110,9 +187,9 @@ class GetProvSchedules {
} }
} }
class GetOpenedVisits { class GetOpenedVisits extends Endpoint {
Future<ApiCallResponse> call(final String page) async { Future<ApiCallResponse> call(final String page) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String userUUID = final String userUUID =
@ -145,9 +222,9 @@ class GetOpenedVisits {
} }
} }
class GetResidentsByProperty { class GetResidentsByProperty extends Endpoint {
Future<ApiCallResponse> call(final String page) async { Future<ApiCallResponse> call(final String page) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? ''; await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
final String userUUID = final String userUUID =
@ -179,9 +256,9 @@ class GetResidentsByProperty {
} }
} }
class GetVehiclesByProperty { class GetVehiclesByProperty extends Endpoint {
Future<ApiCallResponse> call(final String page) async { Future<ApiCallResponse> call(final String page) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String userUUID = final String userUUID =
@ -215,9 +292,9 @@ class GetVehiclesByProperty {
static GetLicense getLicense = GetLicense(); static GetLicense getLicense = GetLicense();
} }
class GetLicense { class GetLicense extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String userUUID = final String userUUID =
@ -249,9 +326,9 @@ class GetLicense {
} }
} }
class UnregisterDevice { class UnregisterDevice extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String userUUID = final String userUUID =
@ -279,9 +356,9 @@ class UnregisterDevice {
} }
} }
class DeletePet { class DeletePet extends Endpoint {
Future<ApiCallResponse> call({final int? petID = 0}) async { Future<ApiCallResponse> call({final int? petID = 0}) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String userUUID = final String userUUID =
@ -315,7 +392,7 @@ class DeletePet {
} }
} }
class UpdatePet { class UpdatePet extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final int? petID, final int? petID,
final String? image, final String? image,
@ -328,7 +405,7 @@ class UpdatePet {
final String? size, final String? size,
final String? notes, final String? notes,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -374,12 +451,12 @@ class UpdatePet {
} }
} }
class GetPets { class GetPets extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final int? page, final int? page,
final int? pageSize, final int? pageSize,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -414,9 +491,9 @@ class GetPets {
} }
} }
class GetPetPhoto { class GetPetPhoto extends Endpoint {
Future<ApiCallResponse> call({final int? petId}) async { Future<ApiCallResponse> call({final int? petId}) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -450,7 +527,7 @@ class GetPetPhoto {
} }
} }
class RegisterPet { class RegisterPet extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? image, final String? image,
final String? name, final String? name,
@ -462,7 +539,7 @@ class RegisterPet {
final String? size, final String? size,
final String? notes, final String? notes,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -507,7 +584,7 @@ class RegisterPet {
} }
} }
class BuscaEnconcomendas { class BuscaEnconcomendas extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? page, final String? page,
final String? pageSize, final String? pageSize,
@ -522,7 +599,7 @@ class BuscaEnconcomendas {
(await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.clientUUID.key)) ?? '';
const String atividade = 'getEncomendas'; const String atividade = 'getEncomendas';
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
return await ApiManager.instance.makeApiCall( return await ApiManager.instance.makeApiCall(
callName: 'getEncomendas', callName: 'getEncomendas',
@ -551,7 +628,7 @@ class BuscaEnconcomendas {
} }
} }
class CancelaVisita { class CancelaVisita extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final int? idDestino, final int? idDestino,
final int? idVisita, final int? idVisita,
@ -559,7 +636,7 @@ class CancelaVisita {
final String? UsuEmail, final String? UsuEmail,
final String? DevDesc, final String? DevDesc,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -596,14 +673,14 @@ class CancelaVisita {
} }
} }
class DeleteAccount { class DeleteAccount extends Endpoint {
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 = final String userUUID =
(await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.userUUID.key)) ?? '';
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
return await ApiManager.instance.makeApiCall( return await ApiManager.instance.makeApiCall(
callName: 'deleteAccount', callName: 'deleteAccount',
apiUrl: '$baseUrl/deleteAccount.php', apiUrl: '$baseUrl/deleteAccount.php',
@ -626,11 +703,11 @@ class DeleteAccount {
} }
} }
class ChangePanic { class ChangePanic extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? newSenhaPanico, final String? newSenhaPanico,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -665,11 +742,11 @@ class ChangePanic {
} }
} }
class ChangePass { class ChangePass extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? newSenha, final String? newSenha,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -704,11 +781,11 @@ class ChangePass {
} }
} }
class RespondeVinculo { class RespondeVinculo extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? tarefa, final String? tarefa,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -741,11 +818,11 @@ class RespondeVinculo {
} }
} }
class ChangeNotifica { class ChangeNotifica extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? notifica, final String? notifica,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -780,9 +857,9 @@ class ChangeNotifica {
} }
} }
class UpdateIDE { class UpdateIDE extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -819,9 +896,9 @@ class UpdateIDE {
} }
} }
class UpdToken { class UpdToken extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -852,9 +929,9 @@ class UpdToken {
} }
} }
class LoginCall { class LoginCall extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String email = final String email =
@ -902,7 +979,7 @@ class LoginCall {
} }
} }
class RegisterCall { class RegisterCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
required final String name, required final String name,
required final String email, required final String email,
@ -912,7 +989,7 @@ class RegisterCall {
required final String tipo, required final String tipo,
required final String descricao, required final String descricao,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
return await ApiManager.instance.makeApiCall( return await ApiManager.instance.makeApiCall(
callName: 'register', callName: 'register',
@ -941,13 +1018,13 @@ class RegisterCall {
} }
} }
class ChangePasswordCall { class ChangePasswordCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
required final String email, required final String email,
required final String token, required final String token,
required final String psswd, required final String psswd,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
final String userUUID = final String userUUID =
@ -981,11 +1058,11 @@ class ChangePasswordCall {
} }
} }
class ForgotPasswordCall { class ForgotPasswordCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? email, final String? email,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
return await ApiManager.instance.makeApiCall( return await ApiManager.instance.makeApiCall(
callName: 'forgotPassword', callName: 'forgotPassword',
@ -1008,9 +1085,9 @@ class ForgotPasswordCall {
} }
} }
class GetLocalsCall { class GetLocalsCall extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? ''; await StorageHelper().get(ProfileStorageKey.devUUID.key) ?? '';
@ -1047,14 +1124,14 @@ class GetLocalsCall {
) as List?; ) as List?;
} }
class PostScheduleVisitorCall { class PostScheduleVisitorCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
required final String documento, required final String documento,
required final String nome, required final String nome,
required final String tipo, required final String tipo,
required final String foto, required final String foto,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -1101,7 +1178,7 @@ class PostScheduleVisitorCall {
)); ));
} }
class PostScheduleVisitCall { class PostScheduleVisitCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? devDesc, final String? devDesc,
final String? idVisitante, final String? idVisitante,
@ -1112,7 +1189,7 @@ class PostScheduleVisitCall {
final int? idNAC, final int? idNAC,
final String? obs, final String? obs,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -1163,13 +1240,13 @@ class PostScheduleVisitCall {
)); ));
} }
class GetScheduleVisitCall { class GetScheduleVisitCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final int? pageSize, final int? pageSize,
final int? pageNumber, final int? pageNumber,
final String? chaveBusca, final String? chaveBusca,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -1444,9 +1521,9 @@ class GetScheduleVisitCall {
)); ));
} }
class GetDadosCall { class GetDadosCall extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -1690,11 +1767,11 @@ class GetDadosCall {
)); ));
} }
class GetVisitorByDocCall { class GetVisitorByDocCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? documento, final String? documento,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -1746,12 +1823,12 @@ class GetVisitorByDocCall {
)); ));
} }
class GetFotoVisitanteCall { class GetFotoVisitanteCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? documento, final String? documento,
final String? tipo, final String? tipo,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -1786,14 +1863,14 @@ class GetFotoVisitanteCall {
} }
} }
class PostProvVisitSchedulingCall { class PostProvVisitSchedulingCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? data, final String? data,
final String? motivo, final String? motivo,
final String? nome, final String? nome,
final String? proID, final String? proID,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -1840,12 +1917,12 @@ class PostProvVisitSchedulingCall {
)); ));
} }
class GetVisitsCall { class GetVisitsCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final int? pageSize, final int? pageSize,
final int? pageNumber, final int? pageNumber,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -2107,11 +2184,11 @@ class GetVisitsCall {
.toList(); .toList();
} }
class DeleteVisitCall { class DeleteVisitCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? idVisita, final String? idVisita,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -2155,9 +2232,9 @@ class DeleteVisitCall {
)); ));
} }
class GetPessoasLocalCall { class GetPessoasLocalCall extends Endpoint {
Future<ApiCallResponse> call() async { Future<ApiCallResponse> call() async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -2220,14 +2297,14 @@ class GetPessoasLocalCall {
.toList(); .toList();
} }
class RespondeSolicitacaoCall { class RespondeSolicitacaoCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? referencia, final String? referencia,
final String? tarefa, final String? tarefa,
final String? resposta, final String? resposta,
final String? idVisitante, final String? idVisitante,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -2274,13 +2351,13 @@ class RespondeSolicitacaoCall {
)); ));
} }
class GetAccessCall { class GetAccessCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? pageSize, final String? pageSize,
final String? pageNumber, final String? pageNumber,
final String? pesTipo, final String? pesTipo,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';
@ -2528,9 +2605,9 @@ class GetAccessCall {
.toList(); .toList();
} }
class GetLiberationsCall { class GetLiberationsCall extends Endpoint {
Stream<ApiCallResponse> call() { Stream<ApiCallResponse> call() {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final StreamController<ApiCallResponse> controller = StreamController(); final StreamController<ApiCallResponse> controller = StreamController();
Future.microtask(() async { Future.microtask(() async {
@ -2721,13 +2798,13 @@ class GetLiberationsCall {
.toList(); .toList();
} }
class GetMessagesCall { class GetMessagesCall extends Endpoint {
Future<ApiCallResponse> call({ Future<ApiCallResponse> call({
final String? pageSize, final String? pageSize,
final String? pageNumber, final String? pageNumber,
final String? tipoDestino, final String? tipoDestino,
}) async { }) async {
final String baseUrl = PhpGroup.getBaseUrl(); final String baseUrl = FreAccessWSGlobal.getBaseUrl();
final String devUUID = final String devUUID =
(await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? ''; (await StorageHelper().get(ProfileStorageKey.devUUID.key)) ?? '';

View File

@ -12,7 +12,6 @@ interface class Category extends Entity {
interface class Document extends Entity { interface class Document extends Entity {
final String title; final String title;
final String description;
final Category category; final Category category;
final String to; final String to;
final String from; final String from;
@ -20,13 +19,12 @@ interface class Document extends Entity {
final String updatedAt; final String updatedAt;
Document({ Document({
required this.createdAt, required this.createdAt,
required this.updatedAt, required this.updatedAt,
required this.category, required this.category,
required this.to, required this.to,
required this.from, required this.from,
required this.title, required this.title,
required this.description,
}); });
} }

View File

@ -26,7 +26,20 @@ class DocumentManagerScreen extends StatelessScreen {
document.updatedAt.toLowerCase().contains(lowerQuery); document.updatedAt.toLowerCase().contains(lowerQuery);
} }
DocumentItem itemBuilder(document) => DocumentItem(document: document); DocumentItem itemBuilder(dynamic item) {
log('item: $item');
final doc = Document(
createdAt: '00/00/00',
updatedAt: '00/00/00',
category: Category(color: Colors.black, title: item['category']),
to: item['person'],
from: '',
title: item['description'],
);
final docItem = DocumentItem(document: doc);
return docItem;
}
void filterByCategory(Category query) { void filterByCategory(Category query) {
print('Test'); print('Test');
@ -75,13 +88,15 @@ class DocumentManagerScreen extends StatelessScreen {
return Column( return Column(
children: [ children: [
Expanded( Expanded(
child: LocalSearchView<Document>( child: RemoteSearchListView<dynamic>(
key: _listViewKey, key: _listViewKey,
header: header, header: header,
onSearch: filterByString, onSearch: filterByString,
list: documents, list: documents,
itemBuilder: itemBuilder, itemBuilder: itemBuilder,
filter: filter, filter: filter,
title: '',
// fetchItems: (String ) { },,
), ),
), ),
] // ] //

View File

@ -8,7 +8,6 @@ List<Document> generateDocuments(int count) {
count, count,
(index) => Document( (index) => Document(
title: 'Lorem Ipsum et Cetera $index', title: 'Lorem Ipsum et Cetera $index',
description: 'Description for document $index',
category: Category(color: color(), title: str()), category: Category(color: color(), title: str()),
to: str(), to: str(),
from: str(), from: str(),

View File

@ -198,7 +198,7 @@ class _AccessHistoryState extends State<AccessHistoryScreen> {
Future<ApiCallResponse?> fetchAccessHistoryService() async { Future<ApiCallResponse?> fetchAccessHistoryService() async {
try { try {
setState(() => _loading = true); setState(() => _loading = true);
var response = await PhpGroup.getAccessCall.call( var response = await FreAccessWSGlobal.getAccessCall.call(
pageSize: _pageSize.toString(), pageSize: _pageSize.toString(),
pageNumber: _pageNumber.toString(), pageNumber: _pageNumber.toString(),
pesTipo: _personType != 'E' && _personType != 'O' ? 'T' : _personType, pesTipo: _personType != 'E' && _personType != 'O' ? 'T' : _personType,

View File

@ -222,8 +222,8 @@ class ProvisionalHistoryState extends State<ProvisionalHistoryPage> {
Future<ApiCallResponse?> fetchHistoryService() async { Future<ApiCallResponse?> fetchHistoryService() async {
try { try {
setState(() => _loading = true); setState(() => _loading = true);
var response = var response = await FreAccessWSGlobal.getProvSchedules(
await PhpGroup.getProvSchedules(_pageNumber.toString(), status); _pageNumber.toString(), status);
final List<dynamic> history = final List<dynamic> history =
response.jsonBody['agendamento']['value'] ?? []; response.jsonBody['agendamento']['value'] ?? [];

View File

@ -32,7 +32,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
@override @override
Future<void> linkLocal(BuildContext context) async { Future<void> linkLocal(BuildContext context) async {
try { try {
final GetLocalsCall callback = PhpGroup.getLocalsCall; final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
var response = await callback.call(); var response = await callback.call();
final bool? isError = response.jsonBody['error']; final bool? isError = response.jsonBody['error'];
@ -72,7 +72,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
Future<bool> processLocals(BuildContext context) async { Future<bool> processLocals(BuildContext context) async {
log('() => processLocals'); log('() => processLocals');
try { try {
final GetLocalsCall callback = PhpGroup.getLocalsCall; final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
final ApiCallResponse response = await callback.call(); final ApiCallResponse response = await callback.call();
final bool? isError = response.jsonBody['error']; final bool? isError = response.jsonBody['error'];
@ -163,10 +163,10 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
@override @override
Future<bool> processProperty(BuildContext context) async { Future<bool> processProperty(BuildContext context) async {
try { try {
final GetDadosCall callback = PhpGroup.getDadosCall; final GetDadosCall callback = FreAccessWSGlobal.getDadosCall;
ApiCallResponse? response = await callback.call(); ApiCallResponse? response = await callback.call();
if (response.jsonBody == null) { if (response.jsonBody == null) {
final GetLocalsCall callback = PhpGroup.getLocalsCall; final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
response = await callback.call(); response = await callback.call();
// final String errorMsg = FFLocalizations.of(context).getVariableText( // final String errorMsg = FFLocalizations.of(context).getVariableText(
// enText: 'Verify your connection', // enText: 'Verify your connection',
@ -178,7 +178,7 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
final bool? isError = response.jsonBody['error']; final bool? isError = response.jsonBody['error'];
if (isError == true) { if (isError == true) {
final GetLocalsCall callback = PhpGroup.getLocalsCall; final GetLocalsCall callback = FreAccessWSGlobal.getLocalsCall;
response = await callback.call(); response = await callback.call();
// final String errorMsg = // final String errorMsg =
// response.jsonBody['error_msg'] ?? 'Local indisponível'; // response.jsonBody['error_msg'] ?? 'Local indisponível';
@ -231,8 +231,9 @@ class LocalsRemoteDataSourceImpl implements LocalsRemoteDataSource {
enText: 'Device unlinked successfully', enText: 'Device unlinked successfully',
ptText: 'Dispositivo desvinculado com sucesso', ptText: 'Dispositivo desvinculado com sucesso',
); );
final bool status = final bool status = await FreAccessWSGlobal.resopndeVinculo
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) async { .call(tarefa: 'I')
.then((value) async {
if (value.jsonBody['error'] == false) { if (value.jsonBody['error'] == false) {
await StorageHelper().set(ProfileStorageKey.clientName.key, ''); await StorageHelper().set(ProfileStorageKey.clientName.key, '');
await StorageHelper().set(ProfileStorageKey.ownerName.key, ''); await StorageHelper().set(ProfileStorageKey.ownerName.key, '');

View File

@ -52,7 +52,7 @@ class LocalUtil {
await StorageHelper() await StorageHelper()
.set(ProfileStorageKey.ownerName.key, locals[0]['CLU_OWNER_DSC']); .set(ProfileStorageKey.ownerName.key, locals[0]['CLU_OWNER_DSC']);
var response = await PhpGroup.resopndeVinculo.call(tarefa: 'A'); var response = await FreAccessWSGlobal.resopndeVinculo.call(tarefa: 'A');
if (response.jsonBody['error'] == true) { if (response.jsonBody['error'] == true) {
await StorageHelper().set(ProfileStorageKey.clientUUID.key, ''); await StorageHelper().set(ProfileStorageKey.clientUUID.key, '');
await StorageHelper().set(ProfileStorageKey.ownerUUID.key, ''); await StorageHelper().set(ProfileStorageKey.ownerUUID.key, '');

View File

@ -37,7 +37,8 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> {
} }
Future<void> _onMenuEvent(MenuEvent event, Emitter<MenuState> emit) async { Future<void> _onMenuEvent(MenuEvent event, Emitter<MenuState> emit) async {
await LicenseRemoteDataSourceImpl(PhpGroup()).waitForSaveCompletion(); await LicenseRemoteDataSourceImpl(FreAccessWSGlobal())
.waitForSaveCompletion();
final List<MenuItem?> newEntries = final List<MenuItem?> newEntries =
await MenuRepositoryImpl().entries2Items(entries, item); await MenuRepositoryImpl().entries2Items(entries, item);

View File

@ -17,7 +17,7 @@ class LicenseRepositoryImpl implements LicenseRepository {
LicenseRepositoryImpl([Database? database, Api? api]) LicenseRepositoryImpl([Database? database, Api? api])
: database = database ?? DatabaseService.database, : database = database ?? DatabaseService.database,
api = api ?? PhpGroup() { api = api ?? FreAccessWSGlobal() {
localDataSource = LicenseLocalDataSourceImpl(this.database); localDataSource = LicenseLocalDataSourceImpl(this.database);
remoteDataSource = LicenseRemoteDataSourceImpl(this.api); remoteDataSource = LicenseRemoteDataSourceImpl(this.api);
} }

View File

@ -48,7 +48,7 @@ class FirebaseMessagingService {
await StorageHelper().set(SecureStorageKey.token.value, deviceToken); await StorageHelper().set(SecureStorageKey.token.value, deviceToken);
final ApiCallResponse? response; final ApiCallResponse? response;
response = await PhpGroup.updToken.call(); response = await FreAccessWSGlobal.updToken.call();
if (response.jsonBody['error'] == false) { if (response.jsonBody['error'] == false) {
log('Token Atualizado com Sucesso!'); log('Token Atualizado com Sucesso!');

View File

@ -25,7 +25,8 @@ Future<void> onMessageReceived(
required String? response, required String? response,
required String? id}) async { required String? id}) async {
final ApiCallResponse? respondeSolicitacaoCall; final ApiCallResponse? respondeSolicitacaoCall;
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall; final RespondeSolicitacaoCall callback =
FreAccessWSGlobal.respondeSolicitacaoCall;
respondeSolicitacaoCall = await callback.call( respondeSolicitacaoCall = await callback.call(
referencia: ref, referencia: ref,

View File

@ -50,7 +50,8 @@ class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
required String? response, required String? response,
required String? id}) async { required String? id}) async {
final ApiCallResponse? respondeSolicitacaoCall; final ApiCallResponse? respondeSolicitacaoCall;
final RespondeSolicitacaoCall callback = PhpGroup.respondeSolicitacaoCall; final RespondeSolicitacaoCall callback =
FreAccessWSGlobal.respondeSolicitacaoCall;
respondeSolicitacaoCall = await callback.call( respondeSolicitacaoCall = await callback.call(
referencia: ref, referencia: ref,

View File

@ -333,7 +333,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
Future<ApiCallResponse?> _fetchRequests() async { Future<ApiCallResponse?> _fetchRequests() async {
try { try {
safeSetState(() => _loading = true); safeSetState(() => _loading = true);
var response = await PhpGroup.getLiberationsCall.call().first; var response = await FreAccessWSGlobal.getLiberationsCall.call().first;
final List<dynamic> requests = response.jsonBody['solicitacoes'] ?? []; final List<dynamic> requests = response.jsonBody['solicitacoes'] ?? [];

View File

@ -97,7 +97,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
try { try {
setState(() => _loading = true); setState(() => _loading = true);
var response = await PhpGroup.getMessagesCall.call( var response = await FreAccessWSGlobal.getMessagesCall.call(
pageSize: _pageSize.toString(), pageSize: _pageSize.toString(),
pageNumber: _pageNumber.toString(), pageNumber: _pageNumber.toString(),
tipoDestino: _destinyType, tipoDestino: _destinyType,

View File

@ -97,7 +97,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
try { try {
setState(() => _loading = true); setState(() => _loading = true);
var response = await PhpGroup.buscaEnconcomendas.call( var response = await FreAccessWSGlobal.buscaEnconcomendas.call(
pageSize: _pageSize.toString(), pageSize: _pageSize.toString(),
page: _pageNumber.toString(), page: _pageNumber.toString(),
adresseeType: _adresseeType == '.*' ? 'TOD' : _adresseeType, adresseeType: _adresseeType == '.*' ? 'TOD' : _adresseeType,
@ -314,7 +314,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
} }
String _imagePath(dynamic order) { String _imagePath(dynamic order) {
return '${PhpGroup.getBaseUrl()}/getImage.php?cliID=$cliUUID&atividade=getFotoEncomenda&orderId=${order['id'] ?? ''}'; return '${FreAccessWSGlobal.getBaseUrl()}/getImage.php?cliID=$cliUUID&atividade=getFotoEncomenda&orderId=${order['id'] ?? ''}';
} }
Map<String, String> _labelsHashMap(dynamic order) { Map<String, String> _labelsHashMap(dynamic order) {

View File

@ -82,7 +82,7 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> {
body: SafeArea( body: SafeArea(
top: true, top: true,
child: FutureBuilder<ApiCallResponse>( child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getPessoasLocalCall.call(), future: FreAccessWSGlobal.getPessoasLocalCall.call(),
builder: (context, snapshot) { builder: (context, snapshot) {
// Customize what your widget looks like when it's loading. // Customize what your widget looks like when it's loading.
if (!snapshot.hasData) { if (!snapshot.hasData) {
@ -123,7 +123,7 @@ class _PeopleOnThePropertyPageState extends State<PeopleOnThePropertyPage> {
} }
final columnGetPessoasLocalResponse = snapshot.data!; final columnGetPessoasLocalResponse = snapshot.data!;
final getPoepleProperty = PhpGroup.getPessoasLocalCall final getPoepleProperty = FreAccessWSGlobal.getPessoasLocalCall
.pessoas( .pessoas(
columnGetPessoasLocalResponse.jsonBody, columnGetPessoasLocalResponse.jsonBody,
) )

View File

@ -100,7 +100,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
try { try {
setState(() => _loading = true); setState(() => _loading = true);
var response = await PhpGroup.getPets.call( var response = await FreAccessWSGlobal.getPets.call(
pageSize: _pageSize, pageSize: _pageSize,
page: _pageNumber, page: _pageNumber,
); );

View File

@ -280,7 +280,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
img = "base64;jpeg,$img"; img = "base64;jpeg,$img";
final url = final url =
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId'; 'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId';
final response = await PhpGroup.updatePet.call( final response = await FreAccessWSGlobal.updatePet.call(
petID: petId, petID: petId,
image: img, image: img,
birthdayDate: textControllerData!.text, birthdayDate: textControllerData!.text,
@ -323,7 +323,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
Future<void> registerPet() async { Future<void> registerPet() async {
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!); var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
img = "base64;jpeg,$img"; img = "base64;jpeg,$img";
final response = await PhpGroup.registerPet.call( final response = await FreAccessWSGlobal.registerPet.call(
image: img, image: img,
birthdayDate: textControllerData!.text, birthdayDate: textControllerData!.text,
color: textControllerColor!.text, color: textControllerColor!.text,
@ -464,7 +464,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
enText: 'Are you sure you want to delete this pet?', enText: 'Are you sure you want to delete this pet?',
), () async { ), () async {
int id = item['id']; int id = item['id'];
await PhpGroup.deletePet await FreAccessWSGlobal.deletePet
.call( .call(
petID: id, petID: id,
) )

View File

@ -62,7 +62,7 @@ class PreferencesPageModel with ChangeNotifier {
onConfirm() async { onConfirm() async {
String content; String content;
String value = !isNotify ? 'S' : 'N'; String value = !isNotify ? 'S' : 'N';
await PhpGroup.changeNotifica await FreAccessWSGlobal.changeNotifica
.call(notifica: value) .call(notifica: value)
.then((value) async { .then((value) async {
if (value.jsonBody['error'] == false) { if (value.jsonBody['error'] == false) {
@ -109,7 +109,7 @@ class PreferencesPageModel with ChangeNotifier {
); );
onConfirm() async { onConfirm() async {
String content; String content;
await PhpGroup.updateIDE.call().then((value) async { await FreAccessWSGlobal.updateIDE.call().then((value) async {
if (value.jsonBody['error'] == false) { if (value.jsonBody['error'] == false) {
notifyListeners(); notifyListeners();
content = FFLocalizations.of(context).getVariableText( content = FFLocalizations.of(context).getVariableText(
@ -141,7 +141,7 @@ class PreferencesPageModel with ChangeNotifier {
Future<void> toggleAccess(BuildContext context) async { Future<void> toggleAccess(BuildContext context) async {
onChange(String key) async { onChange(String key) async {
await StorageHelper().set(SecureStorageKey.accessPass.value, key); await StorageHelper().set(SecureStorageKey.accessPass.value, key);
await PhpGroup.changePass await FreAccessWSGlobal.changePass
.call(newSenha: key) .call(newSenha: key)
.then((value) async { .then((value) async {
final String content; final String content;
@ -180,7 +180,7 @@ class PreferencesPageModel with ChangeNotifier {
Future<void> togglePanic(BuildContext context) async { Future<void> togglePanic(BuildContext context) async {
onChange(String key) async { onChange(String key) async {
await StorageHelper().set(SecureStorageKey.panicPass.value, key); await StorageHelper().set(SecureStorageKey.panicPass.value, key);
await PhpGroup.changePanic await FreAccessWSGlobal.changePanic
.call(newSenhaPanico: key) .call(newSenhaPanico: key)
.then((value) async { .then((value) async {
final String content; final String content;

View File

@ -180,7 +180,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget>
padding: const EdgeInsets.fromLTRB(60, 0, 60, 25), padding: const EdgeInsets.fromLTRB(60, 0, 60, 25),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: () async { onPressed: () async {
PhpGroup.unregisterDevice(); FreAccessWSGlobal.unregisterDevice();
AuthenticationService.signOut(context); AuthenticationService.signOut(context);
setState(() {}); setState(() {});
}, },

View File

@ -175,8 +175,8 @@ class _ResidentsOnThePropertyState extends State<ResidentsOnTheProperty>
try { try {
setState(() => _loading = true); setState(() => _loading = true);
var response = var response = await FreAccessWSGlobal.getResidentsByProperty
await PhpGroup.getResidentsByProperty.call(_pageNumber.toString()); .call(_pageNumber.toString());
final List<dynamic> residents = response.jsonBody['residents'] ?? []; final List<dynamic> residents = response.jsonBody['residents'] ?? [];
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0); safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);

View File

@ -361,7 +361,7 @@ class ScheduleCompleteVisitPageModel
required String? accessKey, required String? accessKey,
required String? email}) async { required String? email}) async {
final ApiCallResponse? response; final ApiCallResponse? response;
final CancelaVisita callback = PhpGroup.cancelaVisita; final CancelaVisita callback = FreAccessWSGlobal.cancelaVisita;
response = await callback.call( response = await callback.call(
idDestino: idDestino, idDestino: idDestino,

View File

@ -1072,7 +1072,8 @@ class _ScheduleCompleteVisitPageWidgetState
height: scaledSizedBoxSize * 0.5, height: scaledSizedBoxSize * 0.5,
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: FutureBuilder<ApiCallResponse>( child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getDadosCall.call(), future:
FreAccessWSGlobal.getDadosCall.call(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (!snapshot.hasData) { if (!snapshot.hasData) {
return Center( return Center(
@ -1089,13 +1090,14 @@ class _ScheduleCompleteVisitPageWidgetState
); );
} }
final reasonsJsonList = final reasonsJsonList = FreAccessWSGlobal
PhpGroup.getDadosCall.reasonsJsonList(
snapshot.data!.jsonBody);
final reasonsOptionLabels = PhpGroup
.getDadosCall .getDadosCall
.reasonsMotDescStrList( .reasonsJsonList(
snapshot.data!.jsonBody); snapshot.data!.jsonBody);
final reasonsOptionLabels =
FreAccessWSGlobal.getDadosCall
.reasonsMotDescStrList(
snapshot.data!.jsonBody);
model.processDropDown1(reasonsJsonList!); model.processDropDown1(reasonsJsonList!);
@ -1196,7 +1198,8 @@ class _ScheduleCompleteVisitPageWidgetState
height: scaledSizedBoxSize * 0.5, height: scaledSizedBoxSize * 0.5,
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: FutureBuilder<ApiCallResponse>( child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getDadosCall.call(), future:
FreAccessWSGlobal.getDadosCall.call(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (!snapshot.hasData) { if (!snapshot.hasData) {
return Center( return Center(
@ -1213,13 +1216,14 @@ class _ScheduleCompleteVisitPageWidgetState
); );
} }
final lavelsJsonList = final lavelsJsonList = FreAccessWSGlobal
PhpGroup.getDadosCall.levelJsonList(
snapshot.data!.jsonBody);
final lavelsOptionLabels = PhpGroup
.getDadosCall .getDadosCall
.levelNACDescricaoStrList( .levelJsonList(
snapshot.data!.jsonBody); snapshot.data!.jsonBody);
final lavelsOptionLabels =
FreAccessWSGlobal.getDadosCall
.levelNACDescricaoStrList(
snapshot.data!.jsonBody);
model.processDropDown2(lavelsJsonList!); model.processDropDown2(lavelsJsonList!);
return FlutterFlowDropDown<String>( return FlutterFlowDropDown<String>(
@ -1557,7 +1561,7 @@ class _ScheduleCompleteVisitPageWidgetState
onPressed: model.isValid() onPressed: model.isValid()
? () async { ? () async {
Future<void> scheduleVisit() async { Future<void> scheduleVisit() async {
await PhpGroup.postScheduleVisitCall await FreAccessWSGlobal.postScheduleVisitCall
.call( .call(
devDesc: model.textController3.text, devDesc: model.textController3.text,
idVisitante: model.visitorStrList, idVisitante: model.visitorStrList,
@ -1573,7 +1577,7 @@ class _ScheduleCompleteVisitPageWidgetState
.catchError((e) async => .catchError((e) async =>
await DialogUtil.errorDefault(context)) await DialogUtil.errorDefault(context))
.then((value) async { .then((value) async {
if (PhpGroup.postScheduleVisitCall.error( if (FreAccessWSGlobal.postScheduleVisitCall.error(
(value.jsonBody ?? ''), (value.jsonBody ?? ''),
) == ) ==
false) { false) {

View File

@ -76,7 +76,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
setState(() => _loading = true); setState(() => _loading = true);
var response = await ScheduleCompleteVisitPageModel().visitHistory( var response = await ScheduleCompleteVisitPageModel().visitHistory(
requestFn: () => PhpGroup.getVisitsCall.call( requestFn: () => FreAccessWSGlobal.getVisitsCall.call(
pageSize: _pageSize, pageSize: _pageSize,
pageNumber: _pageNumber, pageNumber: _pageNumber,
), ),

View File

@ -170,8 +170,8 @@ class _VehicleOnThePropertyState extends State<VehicleOnTheProperty>
try { try {
setState(() => _loading = true); setState(() => _loading = true);
var response = var response = await FreAccessWSGlobal.getVehiclesByProperty
await PhpGroup.getVehiclesByProperty.call(_pageNumber.toString()); .call(_pageNumber.toString());
final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? []; final List<dynamic> vehicles = response.jsonBody['vehicles'] ?? [];
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0); safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);

View File

@ -176,7 +176,7 @@ class _VisitsOnThePropertyState extends State<VisitsOnTheProperty>
setState(() => _loading = true); setState(() => _loading = true);
var response = var response =
await PhpGroup.getOpenedVisits.call(_pageNumber.toString()); await FreAccessWSGlobal.getOpenedVisits.call(_pageNumber.toString());
final List<dynamic> visits = response.jsonBody['visitas'] ?? []; final List<dynamic> visits = response.jsonBody['visitas'] ?? [];
safeSetState(() => count = response.jsonBody['total_rows'] ?? 0); safeSetState(() => count = response.jsonBody['total_rows'] ?? 0);

View File

@ -0,0 +1,120 @@
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/index.dart';
import 'package:hub/shared/utils/limited_text_size.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
extension PagedListViewExtension<PageKeyType, ItemType>
on PagedSliverList<PageKeyType, ItemType> {}
mixin Pageable<T extends StatefulWidget> on State<T> {
Expanded buildPaginatedListView<X, Y>(
String noDataFound,
PagingController<X, Y> pg,
Widget Function(BuildContext, Y, int) itemBuilder) {
final theme = FlutterFlowTheme.of(context);
return Expanded(
child: RefreshIndicator(
backgroundColor: theme.primaryBackground,
color: theme.primary,
onRefresh: () async => pg.refresh(),
child: PagedListView<X, Y>(
pagingController: pg,
builderDelegate: PagedChildBuilderDelegate<Y>(
animateTransitions: true,
itemBuilder: (context, item, index) =>
itemBuilder(context, item, index),
// noMoreItemsIndicatorBuilder: ,
newPageProgressIndicatorBuilder: (context) =>
buildLoadingIndicator(context),
firstPageProgressIndicatorBuilder: (context) =>
buildLoadingIndicator(context),
noItemsFoundIndicatorBuilder: (context) =>
buildNoDataFound(context, noDataFound),
firstPageErrorIndicatorBuilder: (context) => const Placeholder(),
newPageErrorIndicatorBuilder: (context) => const Placeholder(),
),
),
),
);
}
Future<void> showError(PagingStatus status, PagingController pg) async {
if (status == PagingStatus.subsequentPageError) {
final message = FFLocalizations.of(context).getVariableText(
enText: 'Something went wrong while fetching a new page.',
ptText: 'Algo deu errado ao buscar uma nova página.',
);
final retry = FFLocalizations.of(context).getVariableText(
enText: 'Retry',
ptText: 'Recarregar',
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
action: SnackBarAction(
label: retry,
onPressed: () => pg.retryLastFailedRequest(),
),
),
);
}
}
Future<void> fetchPage({
required Future<(bool, dynamic)> Function() dataProvider,
required void Function(dynamic data) onDataAvailable,
required void Function() onDataUnavailable,
required void Function(Object error, StackTrace stackTrace) onFetchError,
}) async {
try {
final (bool isDataAvailable, dynamic data) = await dataProvider();
if (isDataAvailable) {
onDataAvailable(data);
} else {
onDataUnavailable();
}
} catch (error, stackTrace) {
onFetchError(error, stackTrace);
}
}
void showNoMoreDataSnackBar(BuildContext context) {
final message = FFLocalizations.of(context).getVariableText(
ptText: "Não há mais dados.",
enText: "No more data.",
);
showSnackbar(context, message, true);
}
Widget buildNoDataFound(BuildContext context, String title) {
final headerFontSize = LimitedFontSizeUtil.getHeaderFontSize(context);
// final bodyFontSize = LimitedFontSizeUtil.getBodyFontSize(context);
return Expanded(
child: Center(
child: Text(
title,
style: TextStyle(
fontFamily: 'Nunito',
fontSize: headerFontSize,
),
),
),
);
}
Widget buildLoadingIndicator(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 15),
child: Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(
FlutterFlowTheme.of(context).primary,
),
),
),
);
}
}

View File

@ -6,7 +6,7 @@ import 'package:hub/features/backend/index.dart';
class LogUtil { class LogUtil {
static void requestAPIFailed(String url, String body, String reason, static void requestAPIFailed(String url, String body, String reason,
dynamic error, StackTrace stack) async { dynamic error, StackTrace stack) async {
final fullUrl = "${PhpGroup.getBaseUrl()}/$url"; final fullUrl = "${FreAccessWSGlobal.getBaseUrl()}/$url";
log("URL: $fullUrl"); log("URL: $fullUrl");
log("Body: $body"); log("Body: $body");
log("Reason: $reason"); log("Reason: $reason");

View File

@ -109,92 +109,149 @@ class LocalSearchViewState<T> extends State<LocalSearchView<T>> {
} }
class RemoteSearchListView<T> extends SearchView<T> { class RemoteSearchListView<T> extends SearchView<T> {
final List<T> items; final List<T> list;
final String title; final String title;
final Widget Function(T) itemBuilder; final Widget Function(T) itemBuilder;
final Future<List<T>> Function(String) fetchItems; // final Future<List<T>> Function(String) fetchItems;
final bool Function(T, String) filter;
final Widget header;
final List<T> Function(String)? onSearch;
RemoteSearchListView({ RemoteSearchListView({
Key? key, Key? key,
required this.items, // required this.fetchItems,
required this.title, required this.title,
required this.list,
required this.itemBuilder, required this.itemBuilder,
required this.fetchItems, required this.filter,
}) : super(key: key); List<T> Function(String)? onSearch,
Widget? header,
}) : header = header ?? const SizedBox.shrink(),
onSearch = onSearch ??
((String query) =>
list.where((documents) => filter(documents, query)).toList()),
super(key: key);
@override @override
_RemoteSearchViewState<T> createState() => _RemoteSearchViewState<T>(); _RemoteSearchViewState<T> createState() => _RemoteSearchViewState<T>();
} }
class _RemoteSearchViewState<T> extends State<RemoteSearchListView<T>> { class _RemoteSearchViewState<T> extends State<RemoteSearchListView<T>>
with Pageable {
TextEditingController editingController = TextEditingController(); TextEditingController editingController = TextEditingController();
late List<T> filteredItems; late List<T> filteredItems;
bool isLoading = false; bool isLoading = false;
final apiCall = FreAccessWSGlobal.getDocuments;
int count = 0;
final PagingController<int, dynamic> _pagingController =
PagingController<int, dynamic>(firstPageKey: 1);
@override @override
void initState() { void initState() {
filteredItems = widget.items; filteredItems = widget.list;
_pagingController.addPageRequestListener(
(dynamic pageKey) => fetchPage(
dataProvider: () async {
final newItems = await apiCall.call(pageKey.toString());
if (newItems.jsonBody == null) return (false, null);
final List<dynamic> docs =
(newItems.jsonBody['value']['list'] as List<dynamic>?) ?? [];
_pagingController.nextPageKey = pageKey + 1;
safeSetState(() {
count = newItems.jsonBody['value']['count'] ?? 0;
});
return (docs.isNotEmpty, docs);
},
onDataUnavailable: () {
setState(() {});
showNoMoreDataSnackBar(context);
},
onDataAvailable: (vehicles) {
setState(() {});
_pagingController.appendLastPage(vehicles);
},
onFetchError: (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed(
"proccessRequest.php", "", "Consulta de Veículo", e, s);
setState(() {});
},
),
);
_pagingController.addStatusListener(_showError);
super.initState(); super.initState();
} }
Future<void> _showError(PagingStatus status) async {
if (status == PagingStatus.subsequentPageError) {
final message = FFLocalizations.of(context).getVariableText(
enText: 'Something went wrong while fetching a new page.',
ptText: 'Algo deu errado ao buscar uma nova página.',
);
final retry = FFLocalizations.of(context).getVariableText(
enText: 'Retry',
ptText: 'Recarregar',
);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
action: SnackBarAction(
label: retry,
onPressed: () => _pagingController.retryLastFailedRequest(),
),
),
);
}
}
void filterSearchResults(String query) async { void filterSearchResults(String query) async {
setState(() { setState(() {
isLoading = true; isLoading = true;
}); });
final results = await widget.fetchItems(query); // final results = await widget.fetchItems(query);
setState(() { // setState(() {
filteredItems = results; // filteredItems = results;
isLoading = false; // isLoading = false;
}); // });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( final noDataFound = FFLocalizations.of(context).getVariableText(
appBar: AppBar( ptText: "Nenhum veículo encontrado!",
title: Text(widget.title), enText: "No vehicle found",
), );
body: Container( return Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, children: <Widget>[
children: <Widget>[ Padding(
Padding( padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0), child: TextField(
child: TextField( onChanged: (value) => filterSearchResults(value),
onChanged: (value) { controller: editingController,
filterSearchResults(value); decoration: InputDecoration(
}, labelText: "Search",
controller: editingController, hintText: "Search",
decoration: InputDecoration( prefixIcon: Icon(Icons.search),
labelText: "Search", border: OutlineInputBorder(
hintText: "Search", borderRadius: BorderRadius.all(Radius.circular(25.0)),
prefixIcon: Icon(Icons.search),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(25.0)),
),
),
), ),
), ),
Padding( ),
padding: const EdgeInsets.fromLTRB(15, 0, 50, 0),
child: Text('Últimos Documentos'),
),
isLoading
? Center(child: CircularProgressIndicator())
: Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: filteredItems.length,
itemBuilder: (context, index) {
return widget.itemBuilder(filteredItems[index]);
},
),
),
],
), ),
), widget.header,
buildPaginatedListView<int, dynamic>(
noDataFound,
_pagingController,
(BuildContext context, dynamic item, int index) =>
widget.itemBuilder(item),
),
],
); );
} }
} }

View File

@ -1,8 +1,14 @@
import 'dart:developer';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
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/features/backend/api_requests/api_calls.dart';
import 'package:hub/features/documents/index.dart'; import 'package:hub/features/documents/index.dart';
import 'package:hub/flutter_flow/index.dart'; import 'package:hub/flutter_flow/index.dart';
import 'package:hub/shared/mixins/pegeable_mixin.dart';
import 'package:hub/shared/utils/index.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
part 'page.dart'; part 'page.dart';

View File

@ -85,6 +85,7 @@ dependencies:
url_launcher_android: ^6.3.12 url_launcher_android: ^6.3.12
url_launcher_ios: ^6.3.1 url_launcher_ios: ^6.3.1
url_launcher_platform_interface: 2.3.2 url_launcher_platform_interface: 2.3.2
infinite_scroll_pagination: ^4.1.0
# video_player: 2.8.7 # video_player: 2.8.7
# video_player_android: 2.5.0 # video_player_android: 2.5.0
# video_player_avfoundation: 2.6.1 # video_player_avfoundation: 2.6.1