This commit is contained in:
jantunesmessias 2024-09-26 12:45:29 -03:00
parent 12535eb7e8
commit e10ff71b13
98 changed files with 805 additions and 943 deletions

View File

@ -1,19 +1,14 @@
import UIKit
import Flutter
import flutter_secure_storage
@main
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
// Configurar o Keychain para remover dados quando o app for desinstalado
let secureStorage = FlutterSecureStoragePlugin()
secureStorage.setAccessibility(.whenPasscodeSetThisDeviceOnly)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

View File

@ -1,12 +1,11 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/foundation.dart';
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/utils/cache_util.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
import '/flutter_flow/flutter_flow_util.dart';
@ -62,8 +61,8 @@ class UnregisterDevice {
Future<ApiCallResponse> call() async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
return ApiManager.instance.makeApiCall(
callName: 'unregisterDevice',
@ -93,9 +92,9 @@ class DeletePet {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'excluirPet';
return ApiManager.instance.makeApiCall(
@ -138,9 +137,9 @@ class UpdatePet {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'atualizarPet';
return ApiManager.instance.makeApiCall(
@ -186,9 +185,9 @@ class GetPets {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'consultaPets';
return ApiManager.instance.makeApiCall(
@ -222,9 +221,9 @@ class GetPetPhoto {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'consultaFotoPet';
return ApiManager.instance.makeApiCall(
@ -265,9 +264,9 @@ class RegisterPet {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'cadastrarPet';
return ApiManager.instance.makeApiCall(
@ -312,9 +311,9 @@ class BuscaEnconcomendas {
String? adresseeType = '',
String? status = '',
}) async {
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'getEncomendas';
final baseUrl = PhpGroup.getBaseUrl();
@ -356,9 +355,9 @@ class CancelaVisita {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'cancelaVisita';
return ApiManager.instance.makeApiCall(
@ -390,8 +389,8 @@ class CancelaVisita {
class DeleteAccount {
Future<ApiCallResponse> call() async {
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final baseUrl = PhpGroup.getBaseUrl();
return ApiManager.instance.makeApiCall(
@ -422,9 +421,9 @@ class ChangePanic {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'updVisitado';
return ApiManager.instance.makeApiCall(
@ -458,9 +457,9 @@ class ChangePass {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'updVisitado';
return ApiManager.instance.makeApiCall(
@ -495,8 +494,8 @@ class RespondeVinculo {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
return ApiManager.instance.makeApiCall(
callName: 'respondeVinculo',
@ -528,9 +527,9 @@ class ChangeNotifica {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'updVisitado';
return ApiManager.instance.makeApiCall(
@ -562,9 +561,9 @@ class UpdToken {
Future<ApiCallResponse> call() async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final token = SecureStorageHelper().token;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final token = StorageUtil().token;
return ApiManager.instance.makeApiCall(
callName: 'updToken',
@ -591,12 +590,11 @@ class UpdToken {
class LoginCall {
Future<ApiCallResponse> call() async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final email = SecureStorageHelper().email;
final password = SecureStorageHelper().passwd;
final type = SecureStorageHelper().deviceType;
final description = SecureStorageHelper().deviceDescription;
final devUUID = StorageUtil().devUUID;
final email = StorageUtil().email;
final password = StorageUtil().passwd;
final type = StorageUtil().deviceType;
final description = StorageUtil().deviceDescription;
final token = FirebaseMessagingService.getToken();
return ApiManager.instance.makeApiCall(
@ -695,8 +693,8 @@ class GetLocalsCall {
Future<ApiCallResponse> call() async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
return ApiManager.instance.makeApiCall(
callName: 'getLocals',
@ -735,9 +733,9 @@ class PostScheduleVisitorCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'putVisitante';
return ApiManager.instance.makeApiCall(
@ -790,9 +788,9 @@ class PostScheduleVisitCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'putVisita';
return ApiManager.instance.makeApiCall(
@ -844,9 +842,9 @@ class GetScheduleVisitCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliUUID = StorageUtil().cliUUID;
const atividade = 'getVisitas';
return ApiManager.instance.makeApiCall(
@ -1118,9 +1116,9 @@ class GetDadosCall {
Future<ApiCallResponse> call() async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliUUID = StorageUtil().cliUUID;
const atividade = 'getDados';
return ApiManager.instance.makeApiCall(
@ -1361,9 +1359,9 @@ class GetVisitorByDocCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'getVisitante';
return ApiManager.instance.makeApiCall(
@ -1415,9 +1413,9 @@ class GetFotoVisitanteCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'getFotoVisitante';
return ApiManager.instance.makeApiCall(
@ -1454,9 +1452,9 @@ class PostProvVisitSchedulingCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'putAgendamentoProv';
return ApiManager.instance.makeApiCall(
@ -1503,9 +1501,9 @@ class GetVisitsCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'getVisitas';
return ApiManager.instance.makeApiCall(
@ -1766,9 +1764,9 @@ class DeleteVisitCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliID = StorageUtil().cliUUID;
const atividade = 'cancelaVisita';
return ApiManager.instance.makeApiCall(
@ -1809,10 +1807,10 @@ class GetPessoasLocalCall {
Future<ApiCallResponse> call() async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final ownerUUID = SQLiteStorageHelper().ownerUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final ownerUUID = StorageUtil().ownerUUID;
final userUUID = StorageUtil().userUUID;
final cliUUID = StorageUtil().cliUUID;
return ApiManager.instance.makeApiCall(
callName: 'getPessoasLocal',
@ -1875,9 +1873,9 @@ class RespondeSolicitacaoCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliUUID = StorageUtil().cliUUID;
const atividade = 'respondeSolicitacao';
return ApiManager.instance.makeApiCall(
@ -1925,9 +1923,9 @@ class GetAccessCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliUUID = StorageUtil().cliUUID;
const atividade = 'getAcessos';
return ApiManager.instance.makeApiCall(
@ -2174,9 +2172,9 @@ class GetLiberationsCall {
final StreamController<ApiCallResponse> controller = StreamController();
Future.microtask(() async {
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliUUID = StorageUtil().cliUUID;
const atividade = 'getSolicitacoes';
try {
@ -2366,9 +2364,9 @@ class GetMessagesCall {
}) async {
final baseUrl = PhpGroup.getBaseUrl();
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
final cliUUID = StorageUtil().cliUUID;
const atividade = 'getMensagens';
return ApiManager.instance.makeApiCall(

View File

@ -148,7 +148,7 @@ class ApiCallResponse {
class ApiManager {
ApiManager._();
static Map<ApiCallOptions, ApiCallResponse> _apiCache = {};
static final Map<ApiCallOptions, ApiCallResponse> _apiCache = {};
static ApiManager? _instance;
static ApiManager get instance => _instance ??= ApiManager._();

View File

@ -1,12 +1,10 @@
import 'dart:developer';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'notification_service.dart';
@ -65,7 +63,7 @@ class FirebaseMessagingService {
final String? deviceToken = await _firebaseMessaging.getToken();
if (deviceToken != null) {
SecureStorageHelper().token = deviceToken;
StorageUtil().token = deviceToken;
final ApiCallResponse? response;
response = await PhpGroup.updToken.call();

View File

@ -16,13 +16,14 @@ import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:sqflite/sqflite.dart';
Future<void> onMessageReceived(
Map<String, dynamic> payload, String? extra, String? handleClick) async {
final localId = jsonDecode(payload['local']!)['CLI_ID'];
final cliUUID = SQLiteStorageHelper().cliUUID;
final cliUUID = StorageUtil().cliUUID;
answersRequest(
{required BuildContext context,
required String? ref,
@ -49,7 +50,7 @@ Future<void> onMessageReceived(
switch (handleClick) {
case 'visit_request':
showDialog(
context: SecureStorageHelper().context!,
context: StorageUtil().context!,
barrierColor: Colors.transparent,
barrierDismissible: true,
builder: (BuildContext context) {
@ -172,7 +173,7 @@ Future<void> onMessageReceived(
break;
case 'access':
showDialog(
context: SecureStorageHelper().context!,
context: StorageUtil().context!,
barrierColor: Colors.transparent,
barrierDismissible: true,
builder: (BuildContext context) {
@ -224,14 +225,14 @@ Future<void> onMessageReceived(
}
],
// onTapCardItemAction: () {},
buttons: [],
buttons: const [],
),
);
});
break;
case 'mensagem':
showDialog(
context: SecureStorageHelper().context!,
context: StorageUtil().context!,
barrierColor: Colors.transparent,
barrierDismissible: true,
builder: (BuildContext context) {
@ -254,8 +255,8 @@ Future<void> onMessageReceived(
break;
case 'enroll_cond':
SecureStorageHelper().haveLocal = true;
SecureStorageHelper().context!.go('/homePage');
StorageUtil().haveLocal = true;
StorageUtil().context!.go('/homePage');
break;
default:
break;
@ -292,11 +293,11 @@ class NotificationService {
.isNotificationAllowed()
.then((isAllowed) async {
final bool requestOSnotification =
SQLiteStorageHelper().requestOSnotification;
StorageUtil().requestOSnotification;
if (!requestOSnotification) {
if (!isAllowed) {
SQLiteStorageHelper().requestOSnotification = true;
StorageUtil().requestOSnotification = true;
await AwesomeNotifications().requestPermissionToSendNotifications();
}
}

View File

@ -4,19 +4,23 @@ import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import '../../../app_state.dart';
class MenuButtonWidget extends MenuEntry {
const MenuButtonWidget({
Key? key,
super.key,
this.action,
this.title,
this.icon,
}) : super(key: key);
});
@override
final Function()? action;
@override
final String? title;
@override
final IconData? icon;
@override
@ -34,7 +38,7 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
onTap: () async {
final cliUUID = SQLiteStorageHelper().cliUUID;
final cliUUID = StorageUtil().cliUUID;
if (cliUUID.isEmpty) {
return DialogUtil.warningDefault(context);

View File

@ -5,14 +5,17 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
class MenuCardItem extends MenuEntry {
const MenuCardItem({
Key? key,
super.key,
this.action,
this.title,
this.icon,
}) : super(key: key);
});
@override
final Function()? action;
@override
final String? title;
@override
final IconData? icon;
@override

View File

@ -9,11 +9,11 @@ class AppBarUtil extends StatelessWidget implements PreferredSizeWidget {
final Widget? actionButton;
const AppBarUtil({
Key? key,
super.key,
required this.title,
this.onBackButtonPressed,
this.actionButton,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {

View File

@ -18,7 +18,7 @@ class CustomDatePickerUtil extends StatefulWidget {
final FormFieldValidator<String>? validator;
CustomDatePickerUtil({
Key? key,
super.key,
this.controller,
this.focusNode,
required this.hintText,
@ -29,7 +29,7 @@ class CustomDatePickerUtil extends StatefulWidget {
required this.firstDate,
this.lastDate,
this.validator,
}) : super(key: key);
});
@override
_CustomDatePickerState createState() => _CustomDatePickerState();

View File

@ -22,7 +22,7 @@ class CustomInputUtil extends StatefulWidget {
final void Function(String)? onChanged;
CustomInputUtil(
{Key? key,
{super.key,
this.controller,
required this.labelText,
required this.hintText,
@ -35,8 +35,7 @@ class CustomInputUtil extends StatefulWidget {
this.maxLength = 80,
this.validator,
this.obscureText,
required this.haveMaxLength})
: super(key: key);
required this.haveMaxLength});
@override
State<CustomInputUtil> createState() => _CustomInputUtilState();

View File

@ -21,7 +21,7 @@ class CustomSelect extends StatefulWidget {
bool isRequired;
CustomSelect({
Key? key,
super.key,
required this.options,
required this.optionsLabel,
required this.hintText,
@ -30,7 +30,7 @@ class CustomSelect extends StatefulWidget {
this.isRequired = false,
this.dropDownValue,
this.isMultiSelect = false,
}) : super(key: key);
});
@override
_CustomSelectState createState() => _CustomSelectState();

View File

@ -15,12 +15,12 @@ class MediaUploadButtonUtil extends StatefulWidget {
FFUploadedFile? uploadedFiles;
MediaUploadButtonUtil({
Key? key,
super.key,
required this.onUploadComplete,
required this.isUploading,
required this.labelText,
this.uploadedFiles,
}) : super(key: key);
});
@override
State<MediaUploadButtonUtil> createState() => _MediaUploadButtonUtilState();

View File

@ -9,7 +9,7 @@ class SubmitButtonUtil extends StatelessWidget {
final String labelText;
Future Function()? onPressed;
SubmitButtonUtil({
SubmitButtonUtil({super.key,
required this.labelText,
required this.onPressed,
});

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

View File

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
abstract class MenuEntry extends StatefulWidget {
const MenuEntry({
Key? key,
super.key,
this.action,
this.title,
this.icon,
}) : super(key: key);
});
final Function()? action;
final String? title;

View File

@ -10,10 +10,10 @@ class OptModalWidget extends StatefulWidget {
final String defaultAccessType;
const OptModalWidget({
Key? key,
super.key,
this.defaultPersonType = '.*',
this.defaultAccessType = '.*',
}) : super(key: key);
});
@override
_OptModalWidgetState createState() => _OptModalWidgetState();

View File

@ -11,10 +11,10 @@ class OptModalWidget extends StatefulWidget {
final String defaultAccessType;
const OptModalWidget({
Key? key,
super.key,
this.defaultPersonType = '.*',
this.defaultAccessType = '.*',
}) : super(key: key);
});
@override
_OptModalWidgetState createState() => _OptModalWidgetState();
@ -315,12 +315,12 @@ class _OptModalWidgetState extends State<OptModalWidget> {
),
ElevatedButton(
onPressed: _applyFilter,
child:
Text(FFLocalizations.of(context).getText('88kshkph')),
style: ElevatedButton.styleFrom(
foregroundColor: FlutterFlowTheme.of(context).info,
backgroundColor: FlutterFlowTheme.of(context).primary,
),
child:
Text(FFLocalizations.of(context).getText('88kshkph')),
),
],
),

View File

@ -5,16 +5,17 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class OrderFilterModalWidget extends StatefulWidget {
final String defaultAdresseeType;
final String defaultStatus;
const OrderFilterModalWidget({
Key? key,
super.key,
this.defaultAdresseeType = '.*',
this.defaultStatus = '.*',
}) : super(key: key);
});
@override
_OrderFilterModalWidgetState createState() => _OrderFilterModalWidgetState();
@ -26,25 +27,25 @@ class _OrderFilterModalWidgetState extends State<OrderFilterModalWidget> {
late Map<String, dynamic> selected;
final List<Map<String, String>> adresseeTypeOptions = [
{
'title': FFLocalizations.of(SecureStorageHelper().context!)
'title': FFLocalizations.of(StorageUtil().context!)
.getVariableText(enText: 'Resident', ptText: 'Morador'),
'value': 'MOR'
},
{
'title': FFLocalizations.of(SecureStorageHelper().context!)
'title': FFLocalizations.of(StorageUtil().context!)
.getVariableText(enText: 'Property', ptText: 'Propriedade'),
'value': 'PRO'
},
];
final List<Map<String, String>> statusOptions = [
{
'title': FFLocalizations.of(SecureStorageHelper().context!)
'title': FFLocalizations.of(StorageUtil().context!)
.getVariableText(
ptText: 'Aguardando Retirada', enText: 'Waiting for Pickup'),
'value': 'notPickedUp'
},
{
'title': FFLocalizations.of(SecureStorageHelper().context!)
'title': FFLocalizations.of(StorageUtil().context!)
.getVariableText(ptText: 'Retirado', enText: 'Picked Up'),
'value': 'pickedUp'
},

View File

@ -9,7 +9,7 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
class VisitorNotFoundComponentWidget extends StatefulWidget {
const VisitorNotFoundComponentWidget({this.doc, Key? key}) : super(key: key);
const VisitorNotFoundComponentWidget({this.doc, super.key});
final String? doc;
@override

View File

@ -6,6 +6,7 @@ import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart';
import '/backend/api_requests/api_calls.dart';
@ -70,7 +71,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
if (locals != null && locals.isNotEmpty) {
if (locals.isNotEmpty) {
setState(() {
_localsWrap.addAll(locals);
_hasData = true;
@ -80,9 +81,9 @@ class _BottomArrowLinkedLocalsComponentWidgetState
// Verifica se apenas um local e se o status é 'A'
if (locals.length == 1 && locals[0]['CLU_STATUS'] == 'A') {
final local = locals[0];
SQLiteStorageHelper().cliName = local['CLI_NOME'];
SQLiteStorageHelper().cliUUID = local['CLI_ID'];
SQLiteStorageHelper().ownerUUID = local['CLU_OWNER_ID'];
StorageUtil().cliName = local['CLI_NOME'];
StorageUtil().cliUUID = local['CLI_ID'];
StorageUtil().ownerUUID = local['CLU_OWNER_ID'];
context.pop();
}
@ -104,6 +105,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
_loading = false;
});
}
return null;
}
Future<dynamic> _fetchResponseLink(String status, String cliID) async {
@ -170,9 +172,9 @@ class _BottomArrowLinkedLocalsComponentWidgetState
statusHashMap: [_statusHashMap(local)],
onTapCardItemAction: () async {
if (local['CLU_STATUS'] == 'A') {
SQLiteStorageHelper().cliUUID = local['CLI_ID'];
SQLiteStorageHelper().cliName = local['CLI_NOME'];
SQLiteStorageHelper().ownerUUID = local['CLU_OWNER_ID'];
StorageUtil().cliUUID = local['CLI_ID'];
StorageUtil().cliName = local['CLI_NOME'];
StorageUtil().ownerUUID = local['CLU_OWNER_ID'];
context.pop();
} else if (local['CLU_STATUS'] == 'B') {
@ -292,7 +294,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
FFLocalizations.of(context).getVariableText(
ptText: 'Escolha um local', enText: 'Choose a location'),
overflow: TextOverflow.ellipsis,
style: TextStyle(fontWeight: FontWeight.bold),
style: const TextStyle(fontWeight: FontWeight.bold),
)))),
),
),

View File

@ -1,6 +1,6 @@
import 'dart:math';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'local_profile_component_widget.dart' show LocalProfileComponentWidget;
@ -20,8 +20,8 @@ class LocalProfileComponentModel
}
Future<void> getData() async {
cliName = SQLiteStorageHelper().cliName;
cliUUID = SQLiteStorageHelper().cliUUID;
cliName = StorageUtil().cliName;
cliUUID = StorageUtil().cliUUID;
setStateCallback?.call();
}

View File

@ -7,6 +7,7 @@ import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart';
import '/flutter_flow/custom_functions.dart' as functions;
@ -17,7 +18,7 @@ import 'local_profile_component_model.dart';
export 'local_profile_component_model.dart';
class LocalProfileComponentWidget extends StatefulWidget {
LocalProfileComponentWidget({Key? key}) : super(key: key);
const LocalProfileComponentWidget({super.key});
@override
State<LocalProfileComponentWidget> createState() =>
@ -42,7 +43,7 @@ class _LocalProfileComponentWidgetState
_model.setStateCallback = () => safeSetState(() {});
() async {
_model.cliUUID = SQLiteStorageHelper().cliUUID;
_model.cliUUID = StorageUtil().cliUUID;
if (_model.cliUUID.isEmpty) {
await processLocals();
@ -73,11 +74,11 @@ class _LocalProfileComponentWidgetState
final petAmountRegister = response.jsonBody['petAmountRegister'] ?? '0';
final name = response.jsonBody['visitado']['VDO_NOME'];
SQLiteStorageHelper().whatsapp = whatsapp;
SQLiteStorageHelper().provisional = provisional;
SQLiteStorageHelper().pets = pets;
SQLiteStorageHelper().petAmountRegister = petAmountRegister;
SQLiteStorageHelper().cliName = name;
StorageUtil().whatsapp = whatsapp;
StorageUtil().provisional = provisional;
StorageUtil().pets = pets;
StorageUtil().petAmountRegister = petAmountRegister;
StorageUtil().cliName = name;
safeSetState(() {});
return;
@ -86,7 +87,7 @@ class _LocalProfileComponentWidgetState
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
safeSetState(() {});
return;
} catch (e, s) {
} catch (e) {
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
}
}
@ -95,7 +96,7 @@ class _LocalProfileComponentWidgetState
try {
final GetLocalsCall callback = PhpGroup.getLocalsCall;
final cliUUID = SQLiteStorageHelper().cliUUID;
final cliUUID = StorageUtil().cliUUID;
var response = await callback.call();
List<dynamic> locals = response.jsonBody['locais'] ?? [];

View File

@ -72,7 +72,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
}
Future deliverySchedule(BuildContext context) async {
final bool isProvisional = SQLiteStorageHelper().provisional;
final bool isProvisional = StorageUtil().provisional;
if (isProvisional == true) {
context.push(
@ -91,7 +91,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
}
Future provisionalSchedule(BuildContext context) async {
final isProvisional = SQLiteStorageHelper().provisional;
final isProvisional = StorageUtil().provisional;
if (isProvisional == true) {
context.push(
'/provisionalSchedule',
@ -109,7 +109,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
}
Future fastPassAction(BuildContext context) async {
final isWpp = SQLiteStorageHelper().whatsapp;
final isWpp = StorageUtil().whatsapp;
if (isWpp) {
context.push(
'/fastPassPage',
@ -201,7 +201,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
ptText: 'Tem certeza',
), () async {
PhpGroup.unregisterDevice.call();
StorageManager.purge();
StorageUtil.purge();
context.go(
'/welcomePage',
@ -231,7 +231,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
}
Future packageOrder(BuildContext context) async {
final isWpp = SQLiteStorageHelper().whatsapp;
final isWpp = StorageUtil().whatsapp;
if (isWpp) {
context.push(
@ -250,7 +250,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
}
Future reservation(BuildContext context) async {
final isWpp = SQLiteStorageHelper().whatsapp;
final isWpp = StorageUtil().whatsapp;
if (isWpp) {
context.push(
'/reservation',
@ -277,13 +277,13 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
return Padding(
padding: MediaQuery.viewInsetsOf(context),
child: OptionSelectionModalWidget(
routesListStr: <String>[
routesListStr: const <String>[
'liberationHistory',
'acessHistoryPage',
'scheduleCompleteVisitPage',
'messageHistoryPage'
],
iconsListIcon: <IconData>[
iconsListIcon: const <IconData>[
Icons.history_rounded,
Icons.history_rounded,
Icons.history_rounded,
@ -366,7 +366,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
}
Future petsAction(BuildContext context) async {
bool isPet = SQLiteStorageHelper().pets;
bool isPet = StorageUtil().pets;
if (isPet) {
context.push(
'/petsPage',

View File

@ -6,9 +6,6 @@ import '/flutter_flow/flutter_flow_util.dart';
import 'message_well_component_widget.dart' show MessageWellComponentWidget;
import 'package:flutter/material.dart';
///
import 'package:flutter/material.dart';
class MessageWellComponentModel

View File

@ -35,7 +35,7 @@ class _MessageWellComponentWidgetState
@override
void initState() {
super.initState();
WidgetsBinding.instance?.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) {
context.read<MessageWellNotifier>().fetchMessages();
});

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'package:hub/backend/api_requests/api_manager.dart';
@ -6,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:intl/intl.dart';
class ScheduleVisitDetailModel
@ -59,9 +59,9 @@ class ScheduleVisitDetailModel
}
Future<void> initDB() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -9,7 +9,6 @@ import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:provider/provider.dart';
class ScheduleVisitDetailWidget extends StatefulWidget {
const ScheduleVisitDetailWidget({

View File

@ -3,6 +3,7 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:flutter/material.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class UpArrowLinkedLocalsComponentModel
extends FlutterFlowModel<UpArrowLinkedLocalsComponentWidget> {
@ -17,10 +18,10 @@ class UpArrowLinkedLocalsComponentModel
}
Future<void> initDB() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
cliName = SQLiteStorageHelper().cliName;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
cliName = StorageUtil().cliName;
}
@override

View File

@ -7,7 +7,6 @@ import 'package:hub/components/organism_components/up_arrow_linked_locals_compon
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:provider/provider.dart';
class UpArrowLinkedLocalsComponentWidget extends StatefulWidget {
const UpArrowLinkedLocalsComponentWidget({super.key});

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_util.dart';
@ -32,9 +33,9 @@ class AccessNotificationModalTemplateComponentModel
}
Future<void> initDB() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -3,7 +3,6 @@ import '/flutter_flow/flutter_flow_util.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'access_notification_modal_template_component_model.dart';
export 'access_notification_modal_template_component_model.dart';

View File

@ -13,12 +13,12 @@ export 'card_item_template_component_model.dart';
class CardItemTemplateComponentWidget extends StatefulWidget {
const CardItemTemplateComponentWidget({
Key? key,
super.key,
required this.labelsHashMap,
required this.statusHashMap,
required this.imagePath,
required this.onTapCardItemAction,
}) : super(key: key);
});
final Map<String, String>? labelsHashMap;
final List<Map<String, Color>?> statusHashMap;

View File

@ -26,10 +26,12 @@ class PassKeyTemplateComponentModel
ptText: 'Este campo é obrigatório',
);
}
if ( val.length < 4 ) return FFLocalizations.of(context).getVariableText(
if ( val.length < 4 ) {
return FFLocalizations.of(context).getVariableText(
enText: 'This field must have at least 4 characters',
ptText: 'Este campo deve ter pelo menos 4 caracteres',
);
}
return null;
}

View File

@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
@ -130,7 +131,7 @@ class _PassKeyTemplateWidgetState extends State<PassKeyTemplateWidget> {
child: Text(
FFLocalizations.of(context).getVariableText(
enText: 'INSERT PASSWORD',
ptText: SecureStorageHelper().accessPass != ''
ptText: StorageUtil().accessPass != ''
? 'ALTERAR SENHA'
: 'ADICIONAR SENHA',
),
@ -317,10 +318,10 @@ class _PassKeyTemplateWidgetState extends State<PassKeyTemplateWidget> {
context.pop(true);
},
text: FFLocalizations.of(context).getVariableText(
ptText: SecureStorageHelper().accessPass != ''
ptText: StorageUtil().accessPass != ''
? 'Alterar'
: 'Adicionar',
enText: SecureStorageHelper().accessPass != ''
enText: StorageUtil().accessPass != ''
? 'Change'
: 'Add',
),

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/utils/dialog_util.dart';
@ -6,7 +5,6 @@ import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
import '/backend/api_requests/api_calls.dart';
import '/components/molecular_components/throw_exception/throw_exception_widget.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart';

View File

@ -1,10 +1,8 @@
import 'package:flutter/material.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class LiberationHistoryItemDetailsTemplateComponentModel
extends FlutterFlowModel<
@ -30,9 +28,9 @@ class LiberationHistoryItemDetailsTemplateComponentModel
void initState(BuildContext context) {}
Future<void> initDatabase() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -1,12 +1,9 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/app_state.dart';
import 'package:hub/components/templates_components/liberation_history_item_details_template_component/liberation_history_item_details_template_component_model.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:provider/provider.dart';
class LiberationHistoryItemDetailsTemplateComponentWidget
extends StatefulWidget {

View File

@ -1,9 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
class MessageNotificationModalTemplateComponentModel
extends FlutterFlowModel<MessageNotificationModalTemplateComponentWidget> {

View File

@ -3,7 +3,6 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_model.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:provider/provider.dart';
class MessageNotificationModalTemplateComponentWidget extends StatefulWidget {
const MessageNotificationModalTemplateComponentWidget({

View File

@ -3,7 +3,7 @@ import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:sqflite/sqflite.dart';
import 'package:hub/shared/utils/storage_util.dart';
class ScheduleProvisionalVisitPageModel
extends FlutterFlowModel<ScheduleProvisionalVisitPageWidget> {
@ -124,11 +124,11 @@ class ScheduleProvisionalVisitPageModel
}
Future<void> init() async {
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliName = SQLiteStorageHelper().cliName;
ownerUUID = SQLiteStorageHelper().ownerUUID;
cliUUID = StorageUtil().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliName = StorageUtil().cliName;
ownerUUID = StorageUtil().ownerUUID;
setState?.call();
}

View File

@ -4,10 +4,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:provider/provider.dart';
import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_theme.dart';

View File

@ -21,10 +21,12 @@ class QrCodePassKeyTemplateComponentModel
ptText: 'Este campo é obrigatório',
);
}
if (val.length < 4) return FFLocalizations.of(context).getVariableText(
if (val.length < 4) {
return FFLocalizations.of(context).getVariableText(
enText: 'This field must be at least 4 characters',
ptText: 'Este campo deve ter pelo menos 4 caracteres',
);
}
return null;
}

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
import '/backend/api_requests/api_calls.dart';
@ -134,9 +135,9 @@ class RegisiterVistorTemplateComponentModel
}
Future<void> initializeDatabase() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -68,7 +68,7 @@ class _RegisiterVistorTemplateComponentWidgetState
_model.textController4 ??= TextEditingController();
_model.textFieldFocusNode4 ??= FocusNode();
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_model.textController2.text = widget.doc ?? '';
});
}

View File

@ -1,13 +1,12 @@
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/flutter_flow/random_data_util.dart';
import 'package:hub/pages/home_page/home_page_model.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/device_util.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'sign_in_template_component_widget.dart'
@ -88,7 +87,7 @@ class SignInTemplateComponentModel
try {
final ApiCallResponse? response;
final LoginCall callback = PhpGroup.loginCall;
SecureStorageHelper().deviceDescription = randomString(
StorageUtil().deviceDescription = randomString(
10,
10,
true,
@ -111,27 +110,27 @@ class SignInTemplateComponentModel
devUUID = await DeviceUtil.getDevUUID();
if ((email != '') && (passwd != '')) {
SecureStorageHelper().email = email;
SecureStorageHelper().passwd = passwd;
StorageUtil().email = email;
StorageUtil().passwd = passwd;
StorageUtil().devUUID = devUUID!;
response = await callback.call();
if (response.jsonBody['error'] == false) {
userUUID = response.jsonBody['uid'];
userUUID = response.jsonBody['uid'];
status = response.jsonBody['user']['status'];
userDevUUID = response.jsonBody['user']['dev_id'];
userName = response.jsonBody['user']['name'];
SQLiteStorageHelper().devUUID = devUUID!;
SQLiteStorageHelper().userUUID = userUUID;
SQLiteStorageHelper().userDevUUID = userDevUUID;
SQLiteStorageHelper().status = status;
SQLiteStorageHelper().userName = userName;
StorageUtil().userUUID = userUUID;
StorageUtil().userDevUUID = userDevUUID;
StorageUtil().status = status;
StorageUtil().userName = userName;
isLogged = true;
await checkLocals(context: context, model: model).then((value) {
SecureStorageHelper().haveLocal = value;
SecureStorageHelper().isLogged = isLogged;
StorageUtil().haveLocal = value;
StorageUtil().isLogged = isLogged;
toggleApp(context);
});
} else {
@ -153,7 +152,7 @@ class SignInTemplateComponentModel
}
Future toggleApp(BuildContext context) async {
final haveLocal = SecureStorageHelper().haveLocal;
final haveLocal = StorageUtil().haveLocal;
if (haveLocal == true) {
context.go('/homePage');
} else if (haveLocal == false) {

View File

@ -1,5 +1,4 @@
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/flutter_flow/random_data_util.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';

View File

@ -5,6 +5,7 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.dart';
import 'package:hub/shared/components/atoms/atom_terms_of_use.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
import 'package:provider/provider.dart';
@ -105,7 +106,7 @@ class _SignUpTemplateComponentWidgetState
final double screenWidth = mediaQuery.size.width;
final double screenHeight = mediaQuery.size.height;
bool _isFormInvalid() {
bool isFormInvalid() {
if (_model.nameRegisterFormTextController.text == '' ||
_model.emailRegisterFormTextController.text == '' ||
_model.passwordRegisterFormTextController.text == '') {
@ -684,7 +685,7 @@ class _SignUpTemplateComponentWidgetState
padding: const EdgeInsetsDirectional
.fromSTEB(0.0, 0.0, 0.0, 16.0),
child: FFButtonWidget(
onPressed: _isFormInvalid()
onPressed: isFormInvalid()
? null
: () async {
var shouldSetState = false;
@ -701,7 +702,7 @@ class _SignUpTemplateComponentWidgetState
.emailRegisterFormTextController
.text,
device:
SecureStorageHelper()
StorageUtil()
.deviceType,
);
shouldSetState = true;

View File

@ -1,4 +1,5 @@
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_util.dart';
@ -36,9 +37,9 @@ class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> {
}
Future<void> initializeDatabase() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';
import '/backend/api_requests/api_calls.dart';

View File

@ -1,4 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart';

View File

@ -4,6 +4,7 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:flutter/material.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class VisitorSearchModalTemplateComponentModel
extends FlutterFlowModel<VisitorSearchModalTemplateComponentWidget> {
@ -39,9 +40,9 @@ class VisitorSearchModalTemplateComponentModel
}
Future<void> initDatabase() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -179,7 +179,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
],
),
),
if (_model.visitors.isNotEmpty && _model.visitors.length > 0)
if (_model.visitors.isNotEmpty && _model.visitors.isNotEmpty)
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,

View File

@ -6,7 +6,6 @@ import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:google_fonts/google_fonts.dart';
import 'welcome_template_component_model.dart';
export 'welcome_template_component_model.dart';

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'form_field_controller.dart';
import 'package:flutter/material.dart';
class FlutterFlowDropDown<T> extends StatefulWidget {
const FlutterFlowDropDown({

View File

@ -11,6 +11,7 @@ import 'package:hub/pages/provisional_schedule_page/provisional_schedule_widget.
import 'package:hub/pages/reception_page/reception_page_widget.dart';
import 'package:hub/pages/reservation_page/reservation_page_widget.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart';
import '/backend/schema/structs/index.dart';
@ -73,8 +74,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
FFRoute(
name: '_initialize',
path: '/',
builder: (context, _) => SecureStorageHelper().isLogged
? SecureStorageHelper().haveLocal == true
builder: (context, _) => StorageUtil().isLogged
? StorageUtil().haveLocal == true
? const HomePageWidget()
: const ReceptionPageWidget()
: const WelcomePageWidget(),

View File

@ -1,5 +1,4 @@
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';

View File

@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:permission_handler/permission_handler.dart';
const kPermissionStateToBool = {

View File

@ -12,12 +12,10 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:hub/backend/notifications/notification_service.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/shared_preferences_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:responsive_framework/responsive_framework.dart';
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
@ -43,19 +41,13 @@ Future<void> _initializeApp() async {
Future<void> _initializeStorageHelpers() async {
final SharedPreferencesStorageHelper sharedPreferencesHelper = SharedPreferencesStorageHelper();
final SecureStorageHelper secureStorageHelper = SecureStorageHelper();
final SQLiteStorageHelper sqLiteStorageHelper = SQLiteStorageHelper();
await StorageUtil().ensureInitialization();
await sqLiteStorageHelper.ensureInitialization();
await sharedPreferencesHelper.ensureInitialization();
await secureStorageHelper.ensureInitialization();
if (sharedPreferencesHelper.isFirstRun) {
sharedPreferencesHelper.isFirstRun = false;
secureStorageHelper.purge();
}
}
Future<void> _initializeTracking() async {
@ -95,8 +87,8 @@ Future<void> _initializeFlutterFlow() async {
Future<void> _foregroundHandleMessage(RemoteMessage message) async {
if (message.data['click_action'] == 'enroll_cond') {
SecureStorageHelper().haveLocal = true;
SecureStorageHelper().context?.go('/homePage');
StorageUtil().haveLocal = true;
StorageUtil().context?.go('/homePage');
}
if (!Platform.isIOS) {
NotificationService.show(
@ -108,8 +100,8 @@ Future<void> _foregroundHandleMessage(RemoteMessage message) async {
Future<void> _backgroundHandleMessage(RemoteMessage message) async {
if (message.data['click_action'] == 'enroll_cond') {
SecureStorageHelper().set('haveLocal', 'true');
SecureStorageHelper().context?.go('/homePage');
StorageUtil().haveLocal = true;
StorageUtil().context?.go('/homePage');
}
}

View File

@ -5,6 +5,7 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/request_manager.dart';
import 'package:hub/pages/acess_history_page/acess_history_page_widget.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {
late final String devUUID;
@ -33,9 +34,9 @@ class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {
}
Future<void> initDatabase() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -199,7 +199,7 @@ class _AccessHistoryState extends State<AccessHistoryScreen> {
return personTypeMatches;
}).toList();
if (filteredAccess != null && filteredAccess.isNotEmpty) {
if (filteredAccess.isNotEmpty) {
setState(() {
_accessWrap.addAll(filteredAccess);
_hasData = true;
@ -221,6 +221,7 @@ class _AccessHistoryState extends State<AccessHistoryScreen> {
_loading = false;
});
}
return null;
}
void _showNoMoreDataSnackbar(BuildContext context) {

View File

@ -1,11 +1,9 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart';
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:provider/provider.dart';
import '/flutter_flow/flutter_flow_util.dart';

View File

@ -7,11 +7,14 @@ import 'package:hub/app_state.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/webview_util.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:webview_flutter/webview_flutter.dart';
class FastPassPageWidget extends StatefulWidget {
const FastPassPageWidget({super.key});
@override
_FastPassPageWidgetState createState() => _FastPassPageWidgetState();
}
@ -21,19 +24,14 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
late WebViewController _controllerAll;
Future<Map<String, String>> initVariables() async {
final email = SecureStorageHelper().email;
final name = SQLiteStorageHelper().userName;
final userUUID = SQLiteStorageHelper().userUUID;
final devUUID = SQLiteStorageHelper().devUUID;
final cliUUID = SQLiteStorageHelper().cliUUID;
final createdAt = '0000-00-00 00:00:00';
final email = StorageUtil().email;
final name = StorageUtil().userName;
final userUUID = StorageUtil().userUUID;
final devUUID = StorageUtil().devUUID;
final cliUUID = StorageUtil().cliUUID;
const createdAt = '0000-00-00 00:00:00';
final url = 'https://hub.freaccess.com.br/hub/fast-pass/$cliUUID';
final freUserData = "{\"name\": \"$name\", " +
"\"email\": \"$email\"," +
"\"dev_id\": \"$devUUID\"," +
"\"created_at\":\"$createdAt\"," +
"\"updated_at\": \"0000-00-00 00:00:00\"," +
"\"status\": \"A\" }";
final freUserData = "{\"name\": \"$name\", \"email\": \"$email\",\"dev_id\": \"$devUUID\",\"created_at\":\"$createdAt\",\"updated_at\": \"0000-00-00 00:00:00\",\"status\": \"A\" }";
return {
'url': url,
@ -55,7 +53,7 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
future: initVariables(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator());
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else if (snapshot.hasData) {
@ -143,7 +141,7 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
..loadRequest(Uri.parse(url)),
);
} else {
return Center(child: Text('Unexpected error'));
return const Center(child: Text('Unexpected error'));
}
},
),

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:hub/app_state.dart';
import 'package:hub/components/organism_components/local_profile_component/local_profile_component_model.dart';
import 'package:hub/components/organism_components/menu_component/menu_component_model.dart';
import 'package:hub/components/organism_components/message_well_component/message_well_component_model.dart';
@ -7,6 +6,7 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/pages/home_page/home_page_widget.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class HomePageModel extends FlutterFlowModel<HomePageWidget> {
bool isGrid = false;
@ -25,11 +25,11 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
late MessageWellComponentModel messageWellComponentModel;
Future<void> _initVariable() async {
devUUID = SQLiteStorageHelper().devUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
userUUID = SQLiteStorageHelper().userUUID;
userName = SQLiteStorageHelper().cliName;
userEmail = SecureStorageHelper().email;
devUUID = StorageUtil().devUUID;
cliUUID = StorageUtil().cliUUID;
userUUID = StorageUtil().userUUID;
userName = StorageUtil().cliName;
userEmail = StorageUtil().email;
}
@override

View File

@ -13,10 +13,11 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/pages/home_page/home_page_model.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart';
class HomePageWidget extends StatefulWidget {
const HomePageWidget({Key? key}) : super(key: key);
const HomePageWidget({super.key});
@override
State<HomePageWidget> createState() => _HomePageWidgetState();
@ -52,7 +53,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
@override
Widget build(BuildContext context) {
SecureStorageHelper().context = context;
StorageUtil().context = context;
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode)

View File

@ -1,11 +1,11 @@
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/request_manager.dart';
import 'package:flutter/material.dart';
import 'package:hub/pages/liberation_history/liberation_history_widget.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
late final String devUUID;
@ -38,9 +38,9 @@ class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
}
Future<void> init() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliName;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliName;
}
Future answersRequest(

View File

@ -331,7 +331,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
final List<dynamic> requests = response.jsonBody['solicitacoes'] ?? [];
if (requests != null && requests.isNotEmpty) {
if (requests.isNotEmpty) {
setState(() {
_requestWrap.addAll(requests);
_hasData = true;
@ -358,6 +358,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
_loading = false;
});
}
return null;
}
void _showNoMoreDataSnackBar(BuildContext context) {

View File

@ -1,4 +1,3 @@
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/request_manager.dart';
@ -6,6 +5,7 @@ import 'package:hub/flutter_flow/request_manager.dart';
import 'package:flutter/material.dart';
import 'package:hub/pages/message_history_page/message_history_page_widget.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
class MessageHistoryPageModel
extends FlutterFlowModel<MessageHistoryPageWidget> {
@ -43,9 +43,9 @@ class MessageHistoryPageModel
}
Future<void> init() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override

View File

@ -105,7 +105,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
final List<dynamic> messages = response.jsonBody['mensagens'] ?? [];
if (messages != null && messages.isNotEmpty) {
if (messages.isNotEmpty) {
setState(() {
_messageWrap.addAll(messages);
_hasData = true;
@ -131,6 +131,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
_loading = false;
});
}
return null;
}
void _loadMore() {

View File

@ -12,6 +12,7 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
import 'package:rxdart/rxdart.dart';
@ -63,7 +64,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
}
Future<void> initDatabase() async {
cliUUID = SQLiteStorageHelper().cliUUID;
cliUUID = StorageUtil().cliUUID;
}
@override
@ -99,7 +100,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
final List<dynamic> orders = response.jsonBody['value']['list'] ?? [];
if (orders != null && orders.isNotEmpty) {
if (orders.isNotEmpty) {
setState(() {
_orderList.addAll(orders);
_hasData = true;
@ -125,6 +126,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
_loading = false;
});
}
return null;
}
void _loadMoreOrders() {
@ -413,7 +415,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
FlutterFlowTheme.of(context).primary,
}),
],
buttons: [],
buttons: const [],
),
);
});

View File

@ -8,7 +8,6 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/people_on_the_property_page/people_on_the_property_page_model.dart';
import 'package:provider/provider.dart';
import '../../shared/utils/log_util.dart';

View File

@ -9,10 +9,11 @@ import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_p
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
class PetsHistoryScreen extends StatefulWidget {
PetsHistoryScreen({Key? key, required this.model}) : super(key: key);
const PetsHistoryScreen({super.key, required this.model});
final PetsPageModel model;
@ -66,7 +67,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
final List<dynamic> pets = response.jsonBody['pets']['list'] ?? [];
safeSetState(() => count = response.jsonBody['pets']['count'] ?? 0);
if (pets != null && pets.isNotEmpty) {
if (pets.isNotEmpty) {
setState(() {
_petsWrap.addAll(pets);
_hasData = true;
@ -93,6 +94,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
_loading = false;
});
}
return null;
}
void _loadMore() {
@ -150,7 +152,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
if (index == 0) {
// Add your item here
return Padding(
padding: EdgeInsets.only(right: 30, top: 10),
padding: const EdgeInsets.only(right: 30, top: 10),
child: Text(
widget.model.petAmountRegister == '0'
? FFLocalizations.of(context).getVariableText(
@ -232,21 +234,21 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
if (uItem['gender'] == "MAC")
{
FFLocalizations.of(context).getVariableText(
ptText: 'Macho', enText: 'Male'): Color(0xFF094CB0),
ptText: 'Macho', enText: 'Male'): const Color(0xFF094CB0),
},
if (uItem['gender'] == "FEM")
{
FFLocalizations.of(context).getVariableText(
ptText: 'Femêa',
enText: 'Female',
): Color(0xFFE463E7),
): const Color(0xFFE463E7),
}
],
onTapCardItemAction: () async {
final cliUUID = SQLiteStorageHelper().cliUUID;
final cliName = SQLiteStorageHelper().cliName;
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = StorageUtil().cliUUID;
final cliName = StorageUtil().cliName;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
await showDialog(
useSafeArea: true,
context: context,

View File

@ -16,6 +16,7 @@ import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/image_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
@ -102,10 +103,10 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
String? Function(BuildContext, String?)? textControllerObservationValidator;
Future<void> initAsync() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
petAmountRegister = SQLiteStorageHelper().petAmountRegister.toString();
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
petAmountRegister = StorageUtil().petAmountRegister.toString();
safeSetState?.call();
}
@ -266,7 +267,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
img = "base64;jpeg,$img";
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(
petID: petId,
image: imgBase64,
@ -547,15 +548,15 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
item['notes'] ?? '',
}),
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&userUUID=${userUUID}&cliID=${cliUUID}&atividade=consultaFotoPet&petId=${item['id'] ?? ''}',
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=${item['id'] ?? ''}',
statusHashMap: [
if (item['gender'] == "MAC")
Map<String, Color>.from({
item['name']: Color(0xFF094CB0),
item['name']: const Color(0xFF094CB0),
}),
if (item['gender'] == "FEM")
Map<String, Color>.from({
item['name']: Color(0xFFE463E7),
item['name']: const Color(0xFFE463E7),
}),
],
);

View File

@ -1,18 +1,12 @@
import 'dart:convert';
import 'dart:developer';
import 'package:easy_debounce/easy_debounce.dart';
import 'package:flutter/material.dart';
import 'package:crypto/crypto.dart' as crypto;
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:http/http.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/appbar.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/custom_datepicker.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/custom_input.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/custom_select.dart';
import 'package:hub/components/atomic_components/shared_components_atoms/media_upload_button.dart';
@ -21,19 +15,14 @@ import 'package:hub/components/atomic_components/shared_components_atoms/tabview
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/form_field_controller.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/flutter_flow/upload_data.dart';
import 'package:hub/pages/pets_page/pets_history_screen.dart';
import 'package:hub/pages/pets_page/pets_page_model.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/image_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
import 'package:material_symbols_icons/symbols.dart';
import 'package:sqflite/sqflite.dart';
class PetsPageWidget extends StatefulWidget {
dynamic pet;

View File

@ -4,13 +4,11 @@ import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:share_plus/share_plus.dart';
import 'package:sqflite/sqflite.dart';
class PreferencesPageModel with ChangeNotifier {
final unfocusNode = FocusNode();
@ -25,7 +23,7 @@ class PreferencesPageModel with ChangeNotifier {
}
Future<void> enablePerson(BuildContext context) async {
final String userDevUUID = SQLiteStorageHelper().userDevUUID;
final String userDevUUID = StorageUtil().userDevUUID;
notifyListeners();
Share.share(
FFLocalizations.of(context).getVariableText(
@ -70,7 +68,7 @@ class PreferencesPageModel with ChangeNotifier {
Future<void> toggleAccess(BuildContext context) async {
onChange(String key) async {
SecureStorageHelper().accessPass = key;
StorageUtil().accessPass = key;
await PhpGroup.changePass
.call(
newSenha: key,
@ -106,10 +104,10 @@ class PreferencesPageModel with ChangeNotifier {
Future<void> togglePanic(BuildContext context) async {
onChange(String key) async {
SecureStorageHelper().panicPass = key;
StorageUtil().panicPass = key;
await PhpGroup.changePanic
.call(
newSenhaPanico: SecureStorageHelper().panicPass,
newSenhaPanico: StorageUtil().panicPass,
)
.then((value) async {
final String content;
@ -147,7 +145,7 @@ class PreferencesPageModel with ChangeNotifier {
);
onChange(String? key) async {
if (!fingerprint) SecureStorageHelper().fingerprintPass = key ?? '';
if (!fingerprint) StorageUtil().fingerprintPass = key ?? '';
if (fingerprint) SecureStorageHelper().delete('fingerprintPass');
fingerprint = await _toggleBoolInDb('fingerprint');
@ -178,7 +176,7 @@ class PreferencesPageModel with ChangeNotifier {
ptText: 'Conta deletada com sucesso',
);
StorageManager.purge();
StorageUtil.purge();
context.pop();
context.go(
@ -224,7 +222,7 @@ class PreferencesPageModel with ChangeNotifier {
ptText: 'Tem certeza que deseja sair?',
);
onConfirm() async {
StorageManager.purge();
StorageUtil.purge();
context.go(
'/welcomePage',
@ -260,9 +258,9 @@ class PreferencesPageModel with ChangeNotifier {
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) {
if (value.jsonBody['error'] == false) {
SQLiteStorageHelper().cliName = '';
SQLiteStorageHelper().cliUUID = '';
SQLiteStorageHelper().ownerUUID = '';
StorageUtil().cliName = '';
StorageUtil().cliUUID = '';
StorageUtil().ownerUUID = '';
context.pop();

View File

@ -11,7 +11,7 @@ import 'package:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart';
class PreferencesPageWidget extends StatefulWidget {
PreferencesPageWidget();
const PreferencesPageWidget({super.key});
@override
_PreferencesPageWidgetState createState() => _PreferencesPageWidgetState();
@ -210,7 +210,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
: FlutterFlowTheme.of(context).primary,
),
),
SizedBox(width: 8.0),
const SizedBox(width: 8.0),
Expanded(
child: Text(
content,
@ -239,7 +239,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
enText: 'Are you sure you want to logout?',
ptText: 'Tem certeza',
), () async {
StorageManager.purge();
StorageUtil.purge();
// setState(() {});
context.go(

View File

@ -1,11 +1,9 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_schedule_template_model.dart';
import 'package:hub/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:provider/provider.dart';
import '/flutter_flow/flutter_flow_util.dart';

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/pages/qr_code_page/qr_code_page_widget.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:qr_flutter/qr_flutter.dart';
class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
@ -11,7 +12,7 @@ class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
bool isAccess = false;
String? key = null;
String? key;
DateTime? time;
late final bool isFingerprint;
@ -27,8 +28,8 @@ class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
}
Future<void> initVariable() async {
isFingerprint = SQLiteStorageHelper().fingerprint;
userDevUUID = SQLiteStorageHelper().userDevUUID;
isFingerprint = StorageUtil().fingerprint;
userDevUUID = StorageUtil().userDevUUID;
}
@override

View File

@ -18,6 +18,7 @@ import 'package:hub/pages/qr_code_page/qr_code_page_model.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/biometric_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
// import 'package:percent_indicator/percent_indicator.dart';
@ -307,11 +308,11 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
builder: (context, snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return CircularProgressIndicator();
return const CircularProgressIndicator();
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else if (!snapshot.hasData) {
return Text('No data');
return const Text('No data');
} else {
final progress = snapshot.data!;
return CircularPercentIndicator(
@ -372,7 +373,7 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
.reverse();
}
_model.isAccess = !_model.isAccess;
_model.key = SecureStorageHelper().fingerprintPass;
_model.key = StorageUtil().fingerprintPass;
});
}))
.onError((error, StackTrace) {

View File

@ -2,17 +2,18 @@ import 'package:flutter/material.dart';
import 'package:hub/app_state.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:share_plus/share_plus.dart';
class ReceptionPageModel with ChangeNotifier {
Future<void> getIdenfifier(BuildContext context) async {
final String userDevUUID = SQLiteStorageHelper().userDevUUID;
final String userDevUUID = StorageUtil().userDevUUID;
notifyListeners();
Share.share(
FFLocalizations.of(context).getVariableText(
ptText: 'Este é o meu identificador de acesso: ${userDevUUID}',
enText: 'This is my access identifier: ${userDevUUID}',
ptText: 'Este é o meu identificador de acesso: $userDevUUID',
enText: 'This is my access identifier: $userDevUUID',
),
);
}

View File

@ -9,7 +9,6 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/reception_page/reception_page_model.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:provider/provider.dart';
@ -29,7 +28,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> {
@override
Widget build(BuildContext context) {
SecureStorageHelper().context = context;
StorageUtil().context = context;
return ChangeNotifierProvider(
create: (context) => ReceptionPageModel(),
child: Scaffold(
@ -155,7 +154,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> {
onPressed: () async {
PhpGroup.unregisterDevice();
StorageManager.purge();
StorageUtil.purge();
setState(() {});
context.go(

View File

@ -1,8 +1,6 @@
import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart';
import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/form_field_controller.dart';
import 'register_visitor_page_widget.dart' show RegisterVisitorPageWidget;
import 'package:flutter/material.dart';

View File

@ -4,7 +4,6 @@ import 'package:hub/components/templates_components/regisiter_vistor_template_co
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:provider/provider.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'register_visitor_page_model.dart';

View File

@ -8,12 +8,15 @@ import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/webview_util.dart';
import 'package:sqflite/sqflite.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:webview_flutter/webview_flutter.dart';
class ReservationPageWidget extends StatefulWidget {
const ReservationPageWidget({super.key});
@override
_ReservationPageWidgetState createState() => _ReservationPageWidgetState();
}
@ -23,21 +26,16 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
late WebViewController _controllerAll;
Future<Map<String, String>> initVariables() async {
final email = SecureStorageHelper().email;
final name = SQLiteStorageHelper().cliName;
final userUUID = SQLiteStorageHelper().userUUID;
final devUUID = SQLiteStorageHelper().devUUID;
final createdAt = SQLiteStorageHelper().createdAt;
final clientId = SQLiteStorageHelper().cliUUID;
final email = StorageUtil().email;
final name = StorageUtil().cliName;
final userUUID = StorageUtil().userUUID;
final devUUID = StorageUtil().devUUID;
final createdAt = StorageUtil().createdAt;
final clientId = StorageUtil().cliUUID;
final url = 'https://hub.freaccess.com.br/hub/reservation/$clientId';
final freUserData = "{\"name\": \"$name\", " +
"\"email\": \"$email\"," +
"\"dev_id\": \"$devUUID\"," +
"\"created_at\": \"0000-00-00 00:00:00\"," +
"\"updated_at\": \"0000-00-00 00:00:00\"," +
"\"status\": \"A\" }";
final freUserData = "{\"name\": \"$name\", \"email\": \"$email\",\"dev_id\": \"$devUUID\",\"created_at\": \"0000-00-00 00:00:00\",\"updated_at\": \"0000-00-00 00:00:00\",\"status\": \"A\" }";
return {
'url': url,
@ -59,7 +57,7 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
future: initVariables(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator());
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError ||
snapshot.hasData == false ||
snapshot.data!.isEmpty) {
@ -151,7 +149,7 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
..loadRequest(Uri.parse(url)),
);
} else {
return Center(child: Text('Unexpected error'));
return const Center(child: Text('Unexpected error'));
}
},
),

View File

@ -15,6 +15,7 @@ import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_p
import 'package:hub/pages/schedule_complete_visit_page/visit_history_page_widget.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/mixins/status_mixin.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
import 'package:intl/intl.dart';
import 'package:share_plus/share_plus.dart';
@ -181,9 +182,9 @@ class ScheduleCompleteVisitPageModel
}
Future<void> _initVariables() async {
devUUID = SQLiteStorageHelper().devUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
userUUID = SQLiteStorageHelper().userUUID;
devUUID = StorageUtil().devUUID;
cliUUID = StorageUtil().cliUUID;
userUUID = StorageUtil().userUUID;
}
@override
@ -409,7 +410,7 @@ class ScheduleCompleteVisitPageModel
enText: 'Are you sure you want to block this visit?',
), () async {
await changeStatusAction
?.call(
.call(
context,
int.parse(item['VAW_DESTINO']),
int.parse(item['VAW_ID']),
@ -511,13 +512,13 @@ class ScheduleCompleteVisitPageModel
icon: const Icon(Icons.share),
onPressed: () async {
Share.share('''
Olá, \*${item['VTE_NOME']}\*! Você foi convidado para \*${cliName}\*.
Olá, \*${item['VTE_NOME']}\*! Você foi convidado para \*$cliName\*.
\*Validade do Convite\*:
- Início: ${item['VAW_DTINICIO']}
- Fim: ${item['VAW_DTFIM']}
URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/${cliUUID}/${item['VAW_CHAVE']}
URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/$cliUUID/${item['VAW_CHAVE']}
''');
},
options: FFButtonOptions(
@ -551,7 +552,7 @@ URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/${cliUUID}/${i
: '',
}),
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${cliUUID}&atividade=getFoto&Documento=${item['VTE_DOCUMENTO'] ?? ''}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?cliID=$cliUUID&atividade=getFoto&Documento=${item['VTE_DOCUMENTO'] ?? ''}&tipo=E',
statusHashMap: [
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.active)
Map<String, Color>.from({

View File

@ -26,7 +26,7 @@ import 'package:hub/shared/utils/share_util.dart';
import 'package:provider/provider.dart';
class ScheduleComplete extends StatefulWidget {
const ScheduleComplete({Key? key}) : super(key: key);
const ScheduleComplete({super.key});
@override
State<StatefulWidget> createState() {
@ -35,7 +35,7 @@ class ScheduleComplete extends StatefulWidget {
}
class ScheduleCompleteVisitPageWidget extends ScheduleComplete {
const ScheduleCompleteVisitPageWidget();
const ScheduleCompleteVisitPageWidget({super.key});
@override
State<ScheduleCompleteVisitPageWidget> createState() =>
@ -48,8 +48,8 @@ class _ScheduleCompleteVisitPageWidgetState
late ScheduleCompleteVisitPageModel _model;
int _visitHistoryLoadingIdx = 0;
final int _visitHistoryLoadingCount = 10;
List<dynamic> _visitHistoryList = [];
ScrollController _visitHistoryController = ScrollController();
final List<dynamic> _visitHistoryList = [];
final ScrollController _visitHistoryController = ScrollController();
final scaffoldKey = GlobalKey<ScaffoldState>();
@ -162,7 +162,7 @@ PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
}
Widget bodyScheduleCompleteVisit(BuildContext context,
ScheduleCompleteVisitPageModel _model, Function safeSetState) {
ScheduleCompleteVisitPageModel model, Function safeSetState) {
return SafeArea(
top: true,
child: Column(
@ -194,7 +194,7 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
),
),
],
controller: _model.tabBarController,
controller: model.tabBarController,
onTap: (i) async {
[() async {}, () async {}][i]();
},
@ -202,12 +202,12 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
),
Expanded(
child: TabBarView(
controller: _model.tabBarController,
controller: model.tabBarController,
children: [
scheduleVisit(context, _model, safeSetState),
scheduleVisit(context, model, safeSetState),
wrapWithModel(
model: _model,
child: VisitHistoryWidget(),
model: model,
child: const VisitHistoryWidget(),
updateCallback: () {
safeSetState(() {});
},
@ -221,7 +221,7 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
}
Widget scheduleVisit(BuildContext context,
ScheduleCompleteVisitPageModel _model, Function safeSetState) {
ScheduleCompleteVisitPageModel model, Function safeSetState) {
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
@ -266,9 +266,9 @@ Widget scheduleVisit(BuildContext context,
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController1,
controller: model.textController1,
readOnly: true,
focusNode: _model.textFieldFocusNode1,
focusNode: model.textFieldFocusNode1,
autovalidateMode:
AutovalidateMode.onUserInteraction,
autofocus: false,
@ -353,7 +353,7 @@ Widget scheduleVisit(BuildContext context,
lineHeight: 1.8,
),
textAlign: TextAlign.start,
validator: _model.textController1Validator
validator: model.textController1Validator
.asValidator(context)),
),
Padding(
@ -468,7 +468,7 @@ Widget scheduleVisit(BuildContext context,
if (datePicked1Date != null &&
datePicked1Time != null) {
safeSetState(() {
_model.datePicked1 = DateTime(
model.datePicked1 = DateTime(
datePicked1Date.year,
datePicked1Date.month,
datePicked1Date.day,
@ -478,15 +478,15 @@ Widget scheduleVisit(BuildContext context,
});
}
safeSetState(() {
_model.textController1?.text = dateTimeFormat(
model.textController1?.text = dateTimeFormat(
'dd/MM/yyyy HH:mm:ss',
_model.datePicked1,
model.datePicked1,
locale: FFLocalizations.of(context)
.languageCode,
);
_model.textController1?.selection =
model.textController1?.selection =
TextSelection.collapsed(
offset: _model
offset: model
.textController1!.text.length);
});
},
@ -517,8 +517,8 @@ Widget scheduleVisit(BuildContext context,
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
readOnly: true,
controller: _model.textController2,
focusNode: _model.textFieldFocusNode2,
controller: model.textController2,
focusNode: model.textFieldFocusNode2,
autovalidateMode:
AutovalidateMode.onUserInteraction,
autofocus: false,
@ -601,7 +601,7 @@ Widget scheduleVisit(BuildContext context,
lineHeight: 1.8,
),
textAlign: TextAlign.start,
validator: _model.textController2Validator
validator: model.textController2Validator
.asValidator(context),
),
),
@ -717,7 +717,7 @@ Widget scheduleVisit(BuildContext context,
if (datePicked2Date != null &&
datePicked2Time != null) {
safeSetState(() {
_model.datePicked2 = DateTime(
model.datePicked2 = DateTime(
datePicked2Date.year,
datePicked2Date.month,
datePicked2Date.day,
@ -727,15 +727,15 @@ Widget scheduleVisit(BuildContext context,
});
}
safeSetState(() {
_model.textController2?.text = dateTimeFormat(
model.textController2?.text = dateTimeFormat(
'dd/MM/yyyy HH:mm:ss',
_model.datePicked2,
model.datePicked2,
locale: FFLocalizations.of(context)
.languageCode,
);
_model.textController2?.selection =
model.textController2?.selection =
TextSelection.collapsed(
offset: _model
offset: model
.textController2!.text.length);
});
},
@ -779,11 +779,11 @@ Widget scheduleVisit(BuildContext context,
),
),
),
if (_model.visitorJsonList.isNotEmpty)
if (model.visitorJsonList.isNotEmpty)
Builder(
builder: (context) {
final visitorListView =
_model.visitorJsonList.map((e) => e).toList();
model.visitorJsonList.map((e) => e).toList();
return ListView.separated(
padding: const EdgeInsets.fromLTRB(
0,
@ -826,7 +826,7 @@ Widget scheduleVisit(BuildContext context,
fadeOutDuration:
const Duration(milliseconds: 500),
imageUrl:
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${_model.devUUID}&userUUID=${_model.userUUID}&cliID=${_model.cliUUID}&atividade=getFoto&Documento=${getJsonField(visitorListViewItem, r'''$.VTE_DOCUMENTO''').toString()}&tipo=E",
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${model.devUUID}&userUUID=${model.userUUID}&cliID=${model.cliUUID}&atividade=getFoto&Documento=${getJsonField(visitorListViewItem, r'''$.VTE_DOCUMENTO''').toString()}&tipo=E",
fit: BoxFit.cover,
),
),
@ -858,7 +858,7 @@ Widget scheduleVisit(BuildContext context,
),
IconButton(
onPressed: () async {
_model.removeFromVisitorJsonList(
model.removeFromVisitorJsonList(
visitorListViewItem);
safeSetState(() {});
},
@ -890,10 +890,10 @@ Widget scheduleVisit(BuildContext context,
context: context,
builder: (context) {
return GestureDetector(
onTap: () => _model
onTap: () => model
.unfocusNode.canRequestFocus
? FocusScope.of(context)
.requestFocus(_model.unfocusNode)
.requestFocus(model.unfocusNode)
: FocusScope.of(context).unfocus(),
child: SizedBox(
height:
@ -906,14 +906,14 @@ Widget scheduleVisit(BuildContext context,
child:
VisitorSearchModalTemplateComponentWidget(
getVisitors: (visitorsParam) async {
_model.visitorJsonList =
model.visitorJsonList =
visitorsParam!
.toList()
.cast<dynamic>();
safeSetState(() {});
},
getDocs: (docsParam) async {
_model.visitorStrList =
model.visitorStrList =
strListToStr(
docsParam!.toList());
safeSetState(() {});
@ -1063,17 +1063,17 @@ Widget scheduleVisit(BuildContext context,
.reasonsMotDescStrList(
snapshot.data!.jsonBody);
_model.processDropDown1(reasonsJsonList!);
model.processDropDown1(reasonsJsonList!);
return FlutterFlowDropDown<String>(
fillColor: FlutterFlowTheme.of(context)
.primaryBackground,
controller:
_model.dropDownValueController1,
options: _model.reasonsDropDown1,
model.dropDownValueController1,
options: model.reasonsDropDown1,
optionLabels: reasonsOptionLabels,
onChanged: (val) => safeSetState(
() => _model.dropDownValue1 = val),
() => model.dropDownValue1 = val),
width: double.infinity,
height: double.infinity,
textStyle: FlutterFlowTheme.of(context)
@ -1118,7 +1118,7 @@ Widget scheduleVisit(BuildContext context,
),
],
),
if (_model.dropDownValue1 == '')
if (model.dropDownValue1 == '')
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
@ -1176,15 +1176,15 @@ Widget scheduleVisit(BuildContext context,
.getDadosCall
.levelNACDescricaoStrList(
snapshot.data!.jsonBody);
_model.processDropDown2(lavelsJsonList!);
model.processDropDown2(lavelsJsonList!);
return FlutterFlowDropDown<String>(
controller:
_model.dropDownValueController2,
options: _model.lavelsDropDown2,
model.dropDownValueController2,
options: model.lavelsDropDown2,
optionLabels: lavelsOptionLabels,
onChanged: (val) => safeSetState(
() => _model.dropDownValue2 = val),
() => model.dropDownValue2 = val),
width: double.infinity,
height: double.infinity,
textStyle: FlutterFlowTheme.of(context)
@ -1231,7 +1231,7 @@ Widget scheduleVisit(BuildContext context,
),
],
),
if (_model.dropDownValue2 == '')
if (model.dropDownValue2 == '')
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
@ -1312,9 +1312,9 @@ Widget scheduleVisit(BuildContext context,
),
),
Switch(
value: _model.switchValue!,
value: model.switchValue!,
onChanged: (newValue) async {
safeSetState(() => _model.switchValue = newValue);
safeSetState(() => model.switchValue = newValue);
},
focusColor: FlutterFlowTheme.of(context).primary,
trackColor: WidgetStateProperty.resolveWith(
@ -1389,8 +1389,8 @@ Widget scheduleVisit(BuildContext context,
child: SizedBox(
width: double.infinity,
child: TextFormField(
controller: _model.textController3,
focusNode: _model.textFieldFocusNode3,
controller: model.textController3,
focusNode: model.textFieldFocusNode3,
autofocus: false,
cursorColor: FlutterFlowTheme.of(context).primary,
textInputAction: TextInputAction.next,
@ -1470,7 +1470,7 @@ Widget scheduleVisit(BuildContext context,
textAlign: TextAlign.start,
maxLines: null,
maxLength: 80,
validator: _model.textController3Validator
validator: model.textController3Validator
.asValidator(context),
),
),
@ -1490,21 +1490,21 @@ Widget scheduleVisit(BuildContext context,
enText: 'Schedule',
ptText: 'Agendar',
),
onPressed: _model.isValid()
onPressed: model.isValid()
? () async {
Future<void> scheduleVisit() async {
await PhpGroup.postScheduleVisitCall
.call(
devDesc: _model.textController3.text,
idVisitante: _model.visitorStrList,
dtInicio: _model
.convertDateFormat(_model.textController1.text ?? ''),
dtFim: _model
.convertDateFormat(_model.textController2.text ?? ''),
unica: _model.switchValue == true ? 'Sim' : 'Não',
idMotivo: extractIdToStr(_model.dropDownValue1!),
idNAC: extractIdToStr(_model.dropDownValue2!),
obs: _model.textController3.text,
devDesc: model.textController3.text,
idVisitante: model.visitorStrList,
dtInicio: model
.convertDateFormat(model.textController1.text ?? ''),
dtFim: model
.convertDateFormat(model.textController2.text ?? ''),
unica: model.switchValue == true ? 'Sim' : 'Não',
idMotivo: extractIdToStr(model.dropDownValue1!),
idNAC: extractIdToStr(model.dropDownValue2!),
obs: model.textController3.text,
)
.catchError((e) async {
await DialogUtil.errorDefault(context);
@ -1515,14 +1515,14 @@ Widget scheduleVisit(BuildContext context,
false) {
context.pop();
_model.dropDownValue1 = null;
_model.dropDownValue2 = null;
_model.dropDownValueController1 =
model.dropDownValue1 = null;
model.dropDownValue2 = null;
model.dropDownValueController1 =
FormFieldController<String>('');
_model.dropDownValueController2 =
model.dropDownValueController2 =
FormFieldController<String>('');
_model.visitorStrList = '';
_model.visitorJsonList = [];
model.visitorStrList = '';
model.visitorJsonList = [];
ToastUtil.showToast(
message: FFLocalizations.of(context)
@ -1543,16 +1543,16 @@ Widget scheduleVisit(BuildContext context,
safeSetState(() {});
}
if (_model.visitorJsonList.length > 1) {
if (model.visitorJsonList.length > 1) {
final title = FFLocalizations.of(context).getVariableText(
ptText: 'Cadastrar Múltiplos Visitantes',
enText: 'Register Multiple Visitors',
);
final content = FFLocalizations.of(context).getVariableText(
ptText:
'Você deseja agendar uma visita para ${_model.visitorJsonList.length} visitantes?',
'Você deseja agendar uma visita para ${model.visitorJsonList.length} visitantes?',
enText:
'Do you want to schedule a visit for ${_model.visitorJsonList.length} visitors?',
'Do you want to schedule a visit for ${model.visitorJsonList.length} visitors?',
);
showAlertDialog(context, title, content, scheduleVisit);
@ -1561,9 +1561,9 @@ Widget scheduleVisit(BuildContext context,
context: context,
builder: (context) {
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
onTap: () => model.unfocusNode.canRequestFocus
? FocusScope.of(context)
.requestFocus(_model.unfocusNode)
.requestFocus(model.unfocusNode)
: FocusScope.of(context).unfocus(),
child: Dialog(
alignment: Alignment.topCenter,
@ -1597,28 +1597,28 @@ Widget scheduleVisit(BuildContext context,
),
],
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${_model.cliUUID}&atividade=getFoto&Documento=${_model.visitorJsonList[0]['VTE_DOCUMENTO'] ?? ''}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${model.cliUUID}&atividade=getFoto&Documento=${model.visitorJsonList[0]['VTE_DOCUMENTO'] ?? ''}&tipo=E',
labelsHashMap: {
'Nome': _model.visitorJsonList[0]['VTE_NOME'],
'Start': _model.textController1.text,
'End': _model.textController2.text ?? '',
'Nome': model.visitorJsonList[0]['VTE_NOME'],
'Start': model.textController1.text,
'End': model.textController2.text ?? '',
'Reason': (RegExp(r'MOT_DESCRICAO:\s*([^,]+)')
.firstMatch(
_model.dropDownValue1.toString())
model.dropDownValue1.toString())
?.group(1)
.toString()) ??
'',
'Level': (RegExp(r'NAC_DESCRICAO:\s*([^,]+)')
.firstMatch(
_model.dropDownValue2.toString())
model.dropDownValue2.toString())
?.group(1)
.toString()) ??
'',
'Single Visit': _model.switchValue == true
'Single Visit': model.switchValue == true
? 'Sim'
: 'Não',
if (_model.textController3.text.isNotEmpty)
'Observation': _model.textController3.text,
if (model.textController3.text.isNotEmpty)
'Observation': model.textController3.text,
},
statusHashMap: [
Map<String, Color>.from({

View File

@ -9,10 +9,11 @@ import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/mixins/status_mixin.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/validator_util.dart';
class VisitHistoryWidget extends ScheduleComplete {
const VisitHistoryWidget();
const VisitHistoryWidget({super.key});
@override
_VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
@ -34,9 +35,9 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
List<dynamic> _visitWrap = [];
Future<void> _initVariables() async {
devUUID = SQLiteStorageHelper().devUUID;
userUUID = SQLiteStorageHelper().userUUID;
cliUUID = SQLiteStorageHelper().cliUUID;
devUUID = StorageUtil().devUUID;
userUUID = StorageUtil().userUUID;
cliUUID = StorageUtil().cliUUID;
}
@override
@ -75,7 +76,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
final List<dynamic> visits = response.jsonBody['visitas'] ?? [];
if (visits != null && visits.isNotEmpty) {
if (visits.isNotEmpty) {
setState(() {
_visitWrap.addAll(visits);
_hasData = true;
@ -102,6 +103,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
_loading = false;
});
}
return null;
}
void _loadMore() {
@ -245,10 +247,10 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
},
],
onTapCardItemAction: () async {
final cliUUID = SQLiteStorageHelper().cliUUID;
final cliName = SQLiteStorageHelper().cliName;
final devUUID = SQLiteStorageHelper().devUUID;
final userUUID = SQLiteStorageHelper().userUUID;
final cliUUID = StorageUtil().cliUUID;
final cliName = StorageUtil().cliName;
final devUUID = StorageUtil().devUUID;
final userUUID = StorageUtil().userUUID;
await showDialog(
useSafeArea: true,

View File

@ -1,12 +1,12 @@
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/mixins/switcher_mixin.dart';
import 'package:hub/shared/utils/storage_util.dart';
import '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:provider/provider.dart';
import 'welcome_page_model.dart';
export 'welcome_page_model.dart';
@ -30,13 +30,13 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
// On page load action.
SchedulerBinding.instance.addPostFrameCallback((_) async {
if (isAndroid == true) {
SecureStorageHelper().deviceType = 'Android';
StorageUtil().deviceType = 'Android';
setState(() {});
} else if (isiOS == true) {
SecureStorageHelper().deviceType = 'iOS';
StorageUtil().deviceType = 'iOS';
setState(() {});
} else {
SecureStorageHelper().deviceType = 'Web';
StorageUtil().deviceType = 'Web';
setState(() {});
}
});

View File

@ -1,15 +1,12 @@
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:hub/shared/utils/cache_util.dart';
import 'package:synchronized/synchronized.dart';
class SecureStorageHelper extends ChangeNotifier implements Storage {
static final SecureStorageHelper _instance = SecureStorageHelper._internal();
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
static final _lock = Lock();
factory SecureStorageHelper() => _instance;
@ -17,166 +14,81 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
static SecureStorageHelper get instance => _instance;
String? _deviceDescription;
String get deviceDescription => _deviceDescription ?? '';
set deviceDescription(String value) => _setAndCacheString('deviceDescription', value, (v) => _deviceDescription = v);
BuildContext? _context;
BuildContext? get context => _context;
set context(BuildContext? value) => _setAndCacheObject('ff_context', value.toString(), (v) => _context = value);
bool? _haveLocal;
bool? get haveLocal => _haveLocal;
set haveLocal(bool? value) => _setAndCacheBool('ff_have_local', value ?? false, (v) => _haveLocal = value);
String? _fingerprintPass;
String get fingerprintPass => _fingerprintPass ?? '';
set fingerprintPass(String value) => _setAndCacheString('fingerprintPass', value, (v) => _fingerprintPass = v);
String? _accessPass;
String get accessPass => _accessPass ?? '';
set accessPass(String value) => _setAndCacheString('accessPass', value, (v) => _accessPass = v);
String? _panicPass;
String get panicPass => _panicPass ?? '';
set panicPass(String value) => _setAndCacheString('panicPass', value, (v) => _panicPass = v);
String? _tokenAPNS;
String? get tokenAPNS => _tokenAPNS;
set tokenAPNS(String? value) => _setAndCacheString('ff_tokenAPNS', value ?? '', (v) => _tokenAPNS = v);
String? _email;
String get email => _email ?? '';
set email(String value) => _setAndCacheString('ff_email', value, (v) => _email = v);
String? _passwd;
String get passwd => _passwd ?? '';
set passwd(String value) => _setAndCacheString('ff_passwd', value, (v) => _passwd = v);
String? _deviceType;
String get deviceType => _deviceType ?? '';
set deviceType(String value) => _setAndCacheString('ff_deviceType', value, (v) => _deviceType = v);
bool? _isLogged;
bool get isLogged => _isLogged ?? false;
set isLogged(bool value) => _setAndCacheBool('ff_isLogged', value, (v) => _isLogged = v);
String? _token;
String get token => _token ?? '';
set token(String value) => _setAndCacheString('ff_token', value, (v) => _token = v);
Future<void> ensureInitialization() async {
log('SecureStorageHelper: Starting initialization');
await _lock.synchronized(() async {
try {
log('SecureStorageHelper: Calling initFunction');
_email = await _getString('ff_email');
log('SecureStorageHelper: _email = $_email');
_passwd = await _getString('ff_passwd');
log('SecureStorageHelper: _passwd = $_passwd');
_deviceType = await _getString('ff_deviceType');
log('SecureStorageHelper: _deviceType = $_deviceType');
_isLogged = await _getBool('ff_isLogged');
log('SecureStorageHelper: _isLogged = $_isLogged');
_tokenAPNS = await _getString('ff_tokenAPNS');
log('SecureStorageHelper: _tokenAPNS = $_tokenAPNS');
_accessPass = await _getString('accessPass');
log('SecureStorageHelper: _accessPass = $_accessPass');
_panicPass = await _getString('panicPass');
log('SecureStorageHelper: _panicPass = $_panicPass');
_fingerprintPass = await _getString('fingerprintPass');
log('SecureStorageHelper: _fingerprintPass = $_fingerprintPass');
_context = await _getObject('ff_context');
log('SecureStorageHelper: _context = $_context');
_haveLocal = await _getBool('ff_have_local');
log('SecureStorageHelper: _haveLocal = $_haveLocal');
_deviceDescription = await _getString('deviceDescription');
log('SecureStorageHelper: _deviceDescription = $_deviceDescription');
log('SecureStorageHelper: initFunction completed successfully');
} catch (e) {
log('SecureStorageHelper: Error during initialization: $e');
}
});
log('SecureStorageHelper: Initialization complete');
}
Future<void> _setAndCacheString(String key, String value, Function(String) cacheSetter) async {
await _lock.synchronized(() async {
Future<void> setAndCacheString(String key, String value, Function(String) cacheSetter) async {
log('setAndCacheString value for key: $key to $value');
await _secureStorage.write(key: key, value: value);
CacheUtil.instance.set(key, value);
cacheSetter(value);
});
}
Future<void> _setAndCacheBool(String key, bool value, Function(bool) cacheSetter) async {
await _lock.synchronized(() async {
Future<void> setAndCacheBool(String key, bool value, Function(bool) cacheSetter) async {
log('setAndCacheBool value for key: $key to $value');
await _secureStorage.write(key: key, value: value.toString());
CacheUtil.instance.set(key, value);
cacheSetter(value);
});
}
Future<void> _setAndCacheObject(String key, String value, Function(String) cacheSetter) async {
await _lock.synchronized(() async {
Future<void> setAndCacheObject(String key, String value, Function(String) cacheSetter) async {
log('setAndCacheObject value for key: $key to $value');
await _secureStorage.write(key: key, value: value);
CacheUtil.instance.set(key, value);
cacheSetter(value);
});
}
Future<String?> _getString(String key) async {
return await _lock.synchronized(() async {
Future<String?> getString(String key) async {
log('getString value for key: $key');
var value = CacheUtil.instance.get(key);
if (value == null) {
value = await _secureStorage.read(key: key);
CacheUtil.instance.set(key, value);
}
return value;
});
}
Future<bool?> _getBool(String key) async {
return await _lock.synchronized(() async {
Future<bool?> getBool(String key) async {
log('getBool value for key: $key');
var value = CacheUtil.instance.get(key);
if (value == null) {
value = await _secureStorage.read(key: key);
CacheUtil.instance.set(key, value == 'true');
}
return value == 'true';
});
}
Future<BuildContext?> _getObject(String key) async {
return await _lock.synchronized(() async {
Future<BuildContext?> getObject(String key) async {
log('getObject value for key: $key');
var value = CacheUtil.instance.get(key);
if (value == null) {
value = await _secureStorage.read(key: key);
CacheUtil.instance.set(key, value);
}
return value as BuildContext?;
});
}
@override
Future<void> set(String key, dynamic value) async {
Future<void> set(String key, dynamic value, Function(dynamic) cacheSetter) async {
if (value is String) {
await _setAndCacheString(key, value, (v) {});
await setAndCacheString(key, value, cacheSetter);
} else if (value is bool) {
await _setAndCacheBool(key, value, (v) {});
await setAndCacheBool(key, value, cacheSetter);
} else if (value is BuildContext) {
await _setAndCacheObject(key, value.toString(), (v) {});
await setAndCacheObject(key, value.toString(), cacheSetter);
}
}
@override
Future<dynamic> get(String key) async {
var stringValue = await _getString(key);
log('get value for key: $key');
var stringValue = await getString(key);
if (stringValue != null) return stringValue;
var boolValue = await _getBool(key);
var boolValue = await getBool(key);
if (boolValue != null) return boolValue;
var objectValue = await _getObject(key);
var objectValue = await getObject(key);
if (objectValue != null) return objectValue;
return null;
@ -184,16 +96,16 @@ class SecureStorageHelper extends ChangeNotifier implements Storage {
@override
Future<void> delete(String key) async {
await _lock.synchronized(() async {
log('delete value for key: $key');
await _secureStorage.delete(key: key);
CacheUtil.instance.delete(key);
});
}
Future<void> purge() async {
await _lock.synchronized(() async {
log('purge values');
await _secureStorage.deleteAll();
CacheUtil.instance.clear();
});
}
}

View File

@ -1,12 +1,14 @@
import 'dart:developer';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:hub/shared/utils/cache_util.dart';
import 'package:synchronized/synchronized.dart';
class SharedPreferencesStorageHelper implements Storage {
static final SharedPreferencesStorageHelper _instance = SharedPreferencesStorageHelper._internal();
static final _lock = Lock();
SharedPreferences? _prefs;
SharedPreferences? get prefs => _prefs;
set prefs(SharedPreferences? value) => _prefs = value;
factory SharedPreferencesStorageHelper() => _instance;
@ -18,46 +20,43 @@ class SharedPreferencesStorageHelper implements Storage {
bool get isFirstRun => _isFirstRun;
set isFirstRun(bool value) => _setAndCacheBool('first_run', value, (v) => _isFirstRun = v);
Future<void> ensureInitialization() async {
await _lock.synchronized(() async {
if (_prefs == null) {
_prefs = await SharedPreferences.getInstance();
_isFirstRun = _prefs?.getBool('first_run') ?? true;
}
});
}
Future<void> _setAndCache<T>(String key, T value, Function(T) cacheSetter, Future<void> Function(String, T) setFunc) async {
await _lock.synchronized(() async {
log('setAndCache value for key: $key to $value');
await setFunc(key, value);
CacheUtil.instance.set(key, value);
cacheSetter(value);
});
}
Future<void> _setAndCacheString(String key, String value, Function(String) cacheSetter) async {
log('setAndCacheString value for key: $key to $value');
await _setAndCache(key, value, cacheSetter, _prefs!.setString);
}
Future<void> _setAndCacheBool(String key, bool value, Function(bool) cacheSetter) async {
log('setAndCacheBool value for key: $key to $value');
await _setAndCache(key, value, cacheSetter, _prefs!.setBool);
}
Future<void> _setAndCacheInt(String key, int value, Function(int) cacheSetter) async {
log('setAndCacheInt value for key: $key to $value');
await _setAndCache(key, value, cacheSetter, _prefs!.setInt);
}
Future<void> _setAndCacheDouble(String key, double value, Function(double) cacheSetter) async {
log('setAndCacheDouble value for key: $key to $value');
await _setAndCache(key, value, cacheSetter, _prefs!.setDouble);
}
Future<void> _setAndCacheStringList(String key, List<String> value, Function(List<String>) cacheSetter) async {
log('setAndCacheStringList value for key: $key to $value');
await _setAndCache(key, value, cacheSetter, _prefs!.setStringList);
}
@override
Future<void> set(String key, dynamic value) async {
await _lock.synchronized(() async {
Future<void> set(String key, dynamic value, Function(dynamic) cacheSetter) async {
if (value is bool) {
await _prefs?.setBool(key, value);
} else if (value is String) {
@ -70,34 +69,31 @@ class SharedPreferencesStorageHelper implements Storage {
await _prefs?.setStringList(key, value);
}
CacheUtil.instance.set(key, value);
});
}
@override
Future<dynamic> get(String key) async {
return await _lock.synchronized(() async {
log('Getting value for key: $key');
var value = CacheUtil.instance.get(key);
if (value == null) {
value = _prefs?.get(key);
CacheUtil.instance.set(key, value);
}
return value;
});
}
@override
Future<void> delete(String key) async {
await _lock.synchronized(() async {
log('Deleting value for key: $key');
await _prefs?.remove(key);
CacheUtil.instance.delete(key);
});
}
@override
Future<void> purge() async {
await _lock.synchronized(() async {
log('Purging shared preferences');
await _prefs?.clear();
CacheUtil.instance.clear();
await ensureInitialization();
});
}
}

View File

@ -1,4 +1,5 @@
import 'package:hub/shared/utils/cache_util.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:sqflite/sqflite.dart';
import 'dart:developer';
import 'package:path/path.dart';
@ -38,7 +39,7 @@ class DatabaseConfig {
];
}
class SQLiteStorageHelper {
class SQLiteStorageHelper implements Storage {
static final SQLiteStorageHelper _instance = SQLiteStorageHelper._internal();
static Database? _database;
static String? _databasePath;
@ -51,7 +52,7 @@ class SQLiteStorageHelper {
Future<Database> ensureInitialization() async {
Future<Database> get database async {
log('Getting database instance');
if (_database != null) return _database!;
_database = await _initDatabase();
@ -140,220 +141,6 @@ class SQLiteStorageHelper {
}
}
String _devUUID = '';
String _userUUID = '';
String _userDevUUID = '';
String _status = '';
String _userName = '';
String _cliUUID = '';
String _ownerUUID = '';
String _cliName = '';
String _petAmountRegister = '';
bool _whatsapp = false;
bool _provisional = false;
bool _pets = false;
bool _local = false;
bool _notify = false;
bool _fingerprint = false;
bool _access = false;
bool _panic = false;
bool _person = false;
bool _requestOSnotification = false;
String get createdAt {
log('Getting createdAt');
return '0000-00-00 00:00:00';
}
String get devUUID {
log('Getting devUUID');
return _devUUID;
}
String get userUUID {
log('Getting userUUID');
return _userUUID;
}
String get userDevUUID {
log('Getting userDevUUID');
return _userDevUUID;
}
String get status {
log('Getting status');
return _status;
}
String get userName {
log('Getting userName');
return _userName;
}
String get cliUUID {
log('Getting cliUUID');
return _cliUUID;
}
String get ownerUUID {
log('Getting ownerUUID');
return _ownerUUID;
}
String get cliName {
log('Getting cliName');
return _cliName;
}
String get petAmountRegister {
log('Getting petAmountRegister');
return _petAmountRegister;
}
bool get whatsapp {
log('Getting whatsapp');
return _whatsapp;
}
bool get provisional {
log('Getting provisional');
return _provisional;
}
bool get pets {
log('Getting pets');
return _pets;
}
bool get local {
log('Getting local');
return _local;
}
bool get notify {
log('Getting notify');
return _notify;
}
bool get fingerprint {
log('Getting fingerprint');
return _fingerprint;
}
bool get access {
log('Getting access');
return _access;
}
bool get panic {
log('Getting panic');
return _panic;
}
bool get person {
log('Getting person');
return _person;
}
bool get requestOSnotification {
log('Getting requestOSnotification');
return _requestOSnotification;
}
set devUUID(String value) {
log('Setting devUUID to $value');
set('devUUID', value);
}
set userUUID(String value) {
log('Setting userUUID to $value');
set('userUUID', value);
}
set userDevUUID(String value) {
log('Setting userDevUUID to $value');
set('userDevUUID', value);
}
set status(String value) {
log('Setting status to $value');
set('status', value);
}
set userName(String value) {
log('Setting userName to $value');
set('userName', value);
}
set cliUUID(String value) {
log('Setting cliUUID to $value');
set('cliUUID', value);
}
set ownerUUID(String value) {
log('Setting ownerUUID to $value');
set('ownerUUID', value);
}
set cliName(String value) {
log('Setting cliName to $value');
set('cliName', value);
}
set petAmountRegister(String value) {
log('Setting petAmountRegister to $value');
set('petAmountRegister', value);
}
set whatsapp(bool value) {
log('Setting whatsapp to $value');
set('whatsapp', value);
}
set provisional(bool value) {
log('Setting provisional to $value');
set('provisional', value);
}
set pets(bool value) {
log('Setting pets to $value');
set('pets', value);
}
set local(bool value) {
log('Setting local to $value');
set('local', value);
}
set notify(bool value) {
log('Setting notify to $value');
set('notify', value);
}
set fingerprint(bool value) {
log('Setting fingerprint to $value');
set('fingerprint', value);
}
set access(bool value) {
log('Setting access to $value');
set('access', value);
}
set panic(bool value) {
log('Setting panic to $value');
set('panic', value);
}
set person(bool value) {
log('Setting person to $value');
set('person', value);
}
set requestOSnotification(bool value) {
log('Setting requestOSnotification to $value');
set('requestOSnotification', value);
}
Future<void> setupLocalVariables() async {
log('Setting up local variables');
@ -403,6 +190,9 @@ class SQLiteStorageHelper {
return value == 'true';
}
@override
Future<dynamic> get(String key) async {
log('Getting value for key: $key');
final cachedValue = CacheUtil().get(key);
@ -412,7 +202,7 @@ class SQLiteStorageHelper {
}
try {
final db = await ensureInitialization();
final db = await database;
final result = await db.query(
DatabaseConfig.tableKeychain,
columns: [DatabaseConfig.columnValue],
@ -434,10 +224,11 @@ class SQLiteStorageHelper {
}
}
Future<int> set(String key, dynamic value) async {
@override
Future<int> set(String key, dynamic value, Function(dynamic) cacheSetter) async {
log('Setting value for key: $key to $value');
CacheUtil().set(key, value);
final db = await ensureInitialization();
final db = await database;
final data = {
DatabaseConfig.columnKey: key,
DatabaseConfig.columnValue: value.toString(),
@ -450,13 +241,14 @@ class SQLiteStorageHelper {
data,
conflictAlgorithm: ConflictAlgorithm.replace,
);
log('Value set for key: $key');
log('Value $value set for key: $key');
return result;
}
@override
Future<int> delete(String key) async {
log('Deleting value for key: $key');
final db = await ensureInitialization();
final db = await database;
final result = await db.transaction((txn) async {
return await txn.delete(
DatabaseConfig.tableKeychain,
@ -468,10 +260,11 @@ class SQLiteStorageHelper {
return result;
}
@override
Future<void> purge() async {
log('Purging database');
await deleteDatabaseDB();
await ensureInitialization();
await database;
log('Database purged');
}
@ -482,9 +275,12 @@ class SQLiteStorageHelper {
log('Database deleted');
_database = null;
}
}
class SqliteStorageDelegate {}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:local_auth/local_auth.dart';
class BiometricHelper {

View File

@ -19,6 +19,7 @@ class DeviceUtil {
var androidDeviceInfo = await deviceInfo.androidInfo;
return androidDeviceInfo.id; // unique ID on Android
}
return null;
}
static Future<String?> getSerialNumber() async {
@ -31,5 +32,6 @@ class DeviceUtil {
var androidDeviceInfo = await deviceInfo.androidInfo;
return androidDeviceInfo.serialNumber; // unique ID on Android
}
return null;
}
}

View File

@ -17,6 +17,7 @@ class ImageUtils {
String base64Image = base64Encode(imageBytes);
return base64Image;
}
return null;
}
static Future<FFUploadedFile> convertToUploadFile(String img) async {

View File

@ -1,6 +1,5 @@
import 'dart:developer';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:hub/backend/api_requests/api_calls.dart';
class LogUtil {

View File

@ -1,10 +1,11 @@
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/storage_util.dart';
import 'package:share_plus/share_plus.dart';
class ShareUtil {
static Future<void> showShare(payload) async {
final cliName = SQLiteStorageHelper().cliName;
final cliUUID = SQLiteStorageHelper().cliUUID;
final cliName = StorageUtil().cliName;
final cliUUID = StorageUtil().cliUUID;
for (var i = 0; i < payload['convites'].length; i++) {
await Share.share('''

View File

@ -1,14 +1,19 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hub/shared/helpers/secure_storage_helper.dart';
import 'package:hub/shared/helpers/shared_preferences_storage_helper.dart';
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
import 'package:hub/shared/utils/cache_util.dart';
import 'package:shared_preferences/shared_preferences.dart';
enum StorageType { SecureStorage, SharedPreferences, SQLite3 }
abstract class Storage {
Future<void> set(String key, dynamic value);
Future<void> set(String key, dynamic value, Function(dynamic) cacheSetter);
Future<dynamic> get(String key);
Future<void> delete(String key);
Future<void> purge();
}
class StorageData {
@ -19,25 +24,30 @@ class StorageData {
StorageData(this.key, this.value, this.type);
}
enum StorageType { SecureStorage, SharedPreferences, SQLite3 }
class StorageUtil {
static final StorageUtil _instance = StorageUtil._internal();
class StorageManager {
static final SecureStorageHelper _secureStorage = SecureStorageHelper();
static final SharedPreferencesStorageHelper _sharedPreferences = SharedPreferencesStorageHelper();
static final SQLiteStorageHelper _sqliteStorage = SQLiteStorageHelper();
factory StorageUtil() {
return _instance;
}
StorageUtil._internal();
final SQLiteStorageHelper _sqliteStorage = SQLiteStorageHelper();
final SecureStorageHelper _secureStorage = SecureStorageHelper();
final SharedPreferencesStorageHelper _sharedPreferences = SharedPreferencesStorageHelper();
static Future<void> set(StorageData data) async {
try {
switch (data.type) {
case StorageType.SecureStorage:
await _secureStorage.set(data.key, data.value);
await SecureStorageHelper().set(data.key, data.value, (v){});
break;
case StorageType.SharedPreferences:
await _sharedPreferences.set(data.key, data.value);
await SharedPreferencesStorageHelper().set(data.key, data.value, (v){});
break;
case StorageType.SQLite3:
await _sqliteStorage.set(data.key, data.value);
await SQLiteStorageHelper().set(data.key, data.value, (v){});
break;
}
} catch (e) {
@ -51,13 +61,13 @@ class StorageManager {
if (value == null) {
switch (data.type) {
case StorageType.SecureStorage:
value = await _secureStorage.get(data.key);
value = await SecureStorageHelper().get(data.key);
break;
case StorageType.SharedPreferences:
value = await _sharedPreferences.get(data.key);
value = await SharedPreferencesStorageHelper().get(data.key);
break;
case StorageType.SQLite3:
value = await _sqliteStorage.get(data.key);
value = await SQLiteStorageHelper().get(data.key);
break;
}
CacheUtil().set(data.key, value);
@ -71,16 +81,16 @@ class StorageManager {
static Future<void> delete(StorageData data) async {
try {
CacheUtil().delete(data.key);
switch (data.type) {
case StorageType.SecureStorage:
CacheUtil().delete(data.key);
await _secureStorage.delete(data.key);
await SecureStorageHelper().delete(data.key);
break;
case StorageType.SharedPreferences:
await _sharedPreferences.delete(data.key);
await SharedPreferencesStorageHelper().delete(data.key);
break;
case StorageType.SQLite3:
await _sqliteStorage.delete(data.key);
await SQLiteStorageHelper().delete(data.key);
break;
}
} catch (e) {
@ -90,13 +100,191 @@ class StorageManager {
static Future<void> purge() async {
try {
await _secureStorage.purge();
await _sharedPreferences.purge();
await _sqliteStorage.purge();
await SecureStorageHelper().purge();
await SharedPreferencesStorageHelper().purge();
await SQLiteStorageHelper().purge();
} catch (e) {
log('Error purging data: $e');
}
}
Future<void> ensureInitialization() async {
await initSharedPreferences();
await initSecureStorage();
await initSQLiteStorage();
}
class StorageUtil {}
Future<void> initSharedPreferences() async {
if (_sharedPreferences.prefs == null) {
_sharedPreferences.prefs = await SharedPreferences.getInstance();
_sharedPreferences.isFirstRun = _sharedPreferences.prefs?.getBool('first_run') ?? true;
}
if (_sharedPreferences.isFirstRun) {
_sharedPreferences.isFirstRun = false;
_sharedPreferences.purge();
}
}
Future<void> initSecureStorage() async {
log('SecureStorageHelper: Starting initialization');
try {
_email = await _secureStorage.getString('ff_email');
_passwd = await _secureStorage.getString('ff_passwd');
_deviceType = await _secureStorage.getString('ff_deviceType');
_isLogged = await _secureStorage.getBool('ff_isLogged');
_tokenAPNS = await _secureStorage.getString('ff_tokenAPNS');
_accessPass = await _secureStorage.getString('accessPass');
_panicPass = await _secureStorage.getString('panicPass');
_fingerprintPass = await _secureStorage.getString('fingerprintPass');
_haveLocal = await _secureStorage.getBool('ff_have_local');
_deviceDescription = await _secureStorage.getString('deviceDescription');
} catch (e) {
log('SecureStorageHelper: Error during initialization: $e');
}
log('SecureStorageHelper: Initialization complete');
}
Future<void> initSQLiteStorage() async {
log('SQLiteStorageHelper: Starting initialization');
try {
await _sqliteStorage.database;
} catch (e) {
log('SQLiteStorageHelper: Error during initialization: $e');
}
log('SQLiteStorageHelper: Initialization complete');
}
bool _isFirstRun = true;
bool get isFirstRun => _isFirstRun;
set isFirstRun(bool value) {
_isFirstRun = value;
_sharedPreferences.set('first_run', value, (v){});
}
String? _deviceDescription;
String get deviceDescription => _deviceDescription ?? '';
set deviceDescription(String value) => _secureStorage.set('deviceDescription', value, (v) => _deviceDescription = v);
BuildContext? _context;
BuildContext? get context => _context;
set context(BuildContext? value) => _secureStorage.set('ff_context', value.toString(), (v) => _context = value);
bool? _haveLocal;
bool? get haveLocal => _haveLocal;
set haveLocal(bool? value) => _secureStorage.set('ff_have_local', value ?? false, (v) => _haveLocal = value);
String? _fingerprintPass;
String get fingerprintPass => _fingerprintPass ?? '';
set fingerprintPass(String value) => _secureStorage.set('fingerprintPass', value, (v) => _fingerprintPass = v);
String? _accessPass;
String get accessPass => _accessPass ?? '';
set accessPass(String value) => _secureStorage.set('accessPass', value, (v) => _accessPass = v);
String? _panicPass;
String get panicPass => _panicPass ?? '';
set panicPass(String value) => _secureStorage.set('panicPass', value, (v) => _panicPass = v);
String? _tokenAPNS;
String? get tokenAPNS => _tokenAPNS;
set tokenAPNS(String? value) => _secureStorage.set('ff_tokenAPNS', value ?? '', (v) => _tokenAPNS = v);
String? _email;
String get email => _email ?? '';
set email(String value) => _secureStorage.set('ff_email', value, (v) => _email = v);
String? _passwd;
String get passwd => _passwd ?? '';
set passwd(String value) => _secureStorage.set('ff_passwd', value, (v) => _passwd = v);
String? _deviceType;
String get deviceType => _deviceType ?? '';
set deviceType(String value) => _secureStorage.set('ff_deviceType', value, (v) => _deviceType = v);
bool? _isLogged;
bool get isLogged => _isLogged ?? false;
set isLogged(bool value) => _secureStorage.set('ff_isLogged', value, (v) => _isLogged = v);
String? _token;
String get token => _token ?? '';
set token(String value) => _secureStorage.set('ff_token', value, (v) => _token = v);
final String _devUUID = '';
String get devUUID => _devUUID;
set devUUID(String value) => _sqliteStorage.set('devUUID', value, (v){});
final String _userUUID = '';
String get userUUID => _userUUID;
set userUUID(String value) => _sqliteStorage.set('userUUID', value, (v){});
final String _userDevUUID = '';
String get userDevUUID => _userDevUUID;
set userDevUUID(String value) => _sqliteStorage.set('userDevUUID', value, (v){});
final String _status = '';
String get status => _status;
set status(String value) => _sqliteStorage.set('status', value, (v){});
final String _userName = '';
String get userName => _userName;
set userName(String value) => _sqliteStorage.set('userName', value, (v){});
final String _cliUUID = '';
String get cliUUID => _cliUUID;
set cliUUID(String value) => _sqliteStorage.set('cliUUID', value, (v){});
final String _ownerUUID = '';
String get ownerUUID => _ownerUUID;
set ownerUUID(String value) => _sqliteStorage.set('ownerUUID', value, (v){});
final String _cliName = '';
String get cliName => _cliName;
set cliName(String value) => _sqliteStorage.set('cliName', value, (v){});
final String _petAmountRegister = '';
String get petAmountRegister => _petAmountRegister;
set petAmountRegister(String value) => _sqliteStorage.set('petAmountRegister', value, (v){});
final bool _whatsapp = false;
bool get whatsapp => _whatsapp;
set whatsapp(bool value) => _sqliteStorage.set('whatsapp', value, (v){});
final bool _provisional = false;
bool get provisional => _provisional;
set provisional(bool value) => _sqliteStorage.set('provisional', value, (v){});
final bool _pets = false;
bool get pets => _pets;
set pets(bool value) => _sqliteStorage.set('pets', value, (v){});
final bool _local = false;
bool get local => _local;
set local(bool value) => _sqliteStorage.set('local', value, (v){});
final bool _notify = false;
bool get notify => _notify;
set notify(bool value) => _sqliteStorage.set('notify', value, (v){});
final bool _fingerprint = false;
bool get fingerprint => _fingerprint;
set fingerprint(bool value) => _sqliteStorage.set('fingerprint', value, (v){});
final bool _access = false;
bool get access => _access;
set access(bool value) => _sqliteStorage.set('access', value, (v){});
final bool _panic = false;
bool get panic => _panic;
set panic(bool value) => _sqliteStorage.set('panic', value, (v){});
final bool _person = false;
bool get person => _person;
set person(bool value) => _sqliteStorage.set('person', value, (v){});
final bool _requestOSnotification = false;
bool get requestOSnotification => _requestOSnotification;
set requestOSnotification(bool value) => _sqliteStorage.set('requestOSnotification', value, (v){});
String get createdAt => '0000-00-00 00:00:00';
}

View File

@ -23,14 +23,14 @@ class ValidatorUtil {
DateFormat dateFormat = DateFormat(format);
DateTime dateTime = dateFormat.parse(value);
return dateTime.toIso8601String() + 'Z';
return '${dateTime.toIso8601String()}Z';
}
static String toISO8601USA(String format, String value) {
DateFormat dateFormat = DateFormat(format);
DateTime dateTime = dateFormat.parse(value);
String date = dateTime.toIso8601String() + 'Z';
date = date.substring(0, 11) + '03:00:00.000Z';
String date = '${dateTime.toIso8601String()}Z';
date = '${date.substring(0, 11)}03:00:00.000Z';
return date;
}

View File

@ -52,7 +52,7 @@ class CustomDrawer extends StatelessWidget {
width: 50.0,
height: 50.0,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
decoration: const BoxDecoration(
shape: BoxShape.circle,
),
child: CachedNetworkImage(