Merge pull request #44 from FRE-Informatica/fix/fd-826
Fix/fd 826 - [CACHE PT. 2] Helpers e Utils para Cache
This commit is contained in:
commit
ddbb3c54df
|
@ -1,373 +1 @@
|
||||||
// import 'dart:ffi';
|
|
||||||
|
|
||||||
import 'package:csv/csv.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
||||||
import 'package:local_auth/local_auth.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
import 'package:synchronized/synchronized.dart';
|
|
||||||
|
|
||||||
class AppState extends ChangeNotifier {
|
|
||||||
// Adiciona a variável para controle de autenticação biométrica
|
|
||||||
bool _isBiometricAuthenticated = false;
|
|
||||||
bool get isBiometricAuthenticated => _isBiometricAuthenticated;
|
|
||||||
|
|
||||||
// Instância do LocalAuthentication
|
|
||||||
final LocalAuthentication auth = LocalAuthentication();
|
|
||||||
|
|
||||||
// Verifica suporte biométrico
|
|
||||||
Future<bool> checkBiometrics() async {
|
|
||||||
try {
|
|
||||||
return await auth.canCheckBiometrics;
|
|
||||||
} catch (e) {
|
|
||||||
clearBiometricAuthentication();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Solicita autenticação biométrica
|
|
||||||
Future<void> authenticateBiometric() async {
|
|
||||||
bool authenticated = false;
|
|
||||||
try {
|
|
||||||
authenticated = await auth.authenticate(
|
|
||||||
localizedReason: 'Scan your fingerprint to authenticate',
|
|
||||||
options: const AuthenticationOptions(
|
|
||||||
biometricOnly: true,
|
|
||||||
stickyAuth: true,
|
|
||||||
useErrorDialogs: true,
|
|
||||||
sensitiveTransaction: true,
|
|
||||||
));
|
|
||||||
if (authenticated) {
|
|
||||||
_isBiometricAuthenticated = true;
|
|
||||||
notifyListeners();
|
|
||||||
return Future.value();
|
|
||||||
// Salvar o estado de autenticação biométrica, se necessário
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
clearBiometricAuthentication();
|
|
||||||
return Future.error(e);
|
|
||||||
}
|
|
||||||
return Future.error(
|
|
||||||
''); // Add this line to ensure a value is always returned
|
|
||||||
}
|
|
||||||
|
|
||||||
// Função para limpar o estado de autenticação biométrica
|
|
||||||
void clearBiometricAuthentication() {
|
|
||||||
_isBiometricAuthenticated = false;
|
|
||||||
notifyListeners();
|
|
||||||
// Limpar a informação salva, se necessário
|
|
||||||
}
|
|
||||||
|
|
||||||
static AppState _instance = AppState._internal();
|
|
||||||
|
|
||||||
factory AppState() {
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
AppState._internal();
|
|
||||||
|
|
||||||
static void reset() {
|
|
||||||
_instance = AppState._internal();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future initializePersistedState() async {
|
|
||||||
secureStorage = const FlutterSecureStorage();
|
|
||||||
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_email = await secureStorage.getString('ff_email') ?? _email;
|
|
||||||
});
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_passwd = await secureStorage.getString('ff_passwd') ?? _passwd;
|
|
||||||
});
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_deviceType =
|
|
||||||
await secureStorage.getString('ff_deviceType') ?? _deviceType;
|
|
||||||
});
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_isLogged = await secureStorage.getBool('ff_isLogged') ?? _isLogged;
|
|
||||||
});
|
|
||||||
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_tokenAPNS = await secureStorage.getString('ff_tokenAPNS') ?? _tokenAPNS;
|
|
||||||
});
|
|
||||||
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_accessPass = await secureStorage.getString('accessPass') ?? _accessPass;
|
|
||||||
});
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_panicPass = await secureStorage.getString('panicPass') ?? _panicPass;
|
|
||||||
});
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_fingerprintPass =
|
|
||||||
await secureStorage.getString('fingerprintPass') ?? _fingerprintPass;
|
|
||||||
});
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_context = await secureStorage.getObject('ff_context') ?? _context;
|
|
||||||
});
|
|
||||||
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_haveLocal = await secureStorage.getBool('ff_have_local') ?? _haveLocal;
|
|
||||||
});
|
|
||||||
|
|
||||||
await _safeInitAsync(() async {
|
|
||||||
_deviceDescription = await secureStorage.getString('deviceDescription') ??
|
|
||||||
_deviceDescription;
|
|
||||||
});
|
|
||||||
await loadFirstRun();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _firstRun = true;
|
|
||||||
bool get firstRun => _firstRun;
|
|
||||||
|
|
||||||
Future<void> loadFirstRun() async {
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
_firstRun = prefs.getBool('first_run') ?? true;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> setFirstRun(bool value) async {
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
_firstRun = value;
|
|
||||||
await prefs.setBool('first_run', value);
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deleteFirstRun() async {
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
|
||||||
_firstRun = true;
|
|
||||||
await prefs.remove('first_run');
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
void update(VoidCallback callback) {
|
|
||||||
callback();
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
late FlutterSecureStorage secureStorage;
|
|
||||||
|
|
||||||
String _deviceDescription = '';
|
|
||||||
String get deviceDescription => _deviceDescription;
|
|
||||||
set deviceDescription(String value) {
|
|
||||||
_deviceDescription = value;
|
|
||||||
secureStorage.setString('deviceDescription', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteDeviceDescription() {
|
|
||||||
secureStorage.delete(key: 'deviceDescription');
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildContext? _context;
|
|
||||||
BuildContext? get context => _context;
|
|
||||||
set context(BuildContext? value) {
|
|
||||||
_context = value;
|
|
||||||
secureStorage.setString('ff_context', value.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteContext() {
|
|
||||||
secureStorage.delete(key: 'ff_context');
|
|
||||||
}
|
|
||||||
|
|
||||||
bool? _haveLocal = null;
|
|
||||||
bool? get haveLocal => _haveLocal;
|
|
||||||
set haveLocal(bool? value) {
|
|
||||||
_haveLocal = value;
|
|
||||||
secureStorage.setBool('ff_have_local', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteHaveLocal() {
|
|
||||||
secureStorage.delete(key: 'ff_have_local');
|
|
||||||
}
|
|
||||||
|
|
||||||
String _fingerprintPass = '';
|
|
||||||
String get fingerprintPass => _fingerprintPass;
|
|
||||||
set fingerprintPass(String value) {
|
|
||||||
_fingerprintPass = value;
|
|
||||||
secureStorage.setString('fingerprintPass', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteFingerprintPass() {
|
|
||||||
secureStorage.delete(key: 'fingerprintPass');
|
|
||||||
}
|
|
||||||
|
|
||||||
String _accessPass = '';
|
|
||||||
String get accessPass => _accessPass;
|
|
||||||
set accessPass(String value) {
|
|
||||||
_accessPass = value;
|
|
||||||
secureStorage.setString('accessPass', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteAccessPass() {
|
|
||||||
secureStorage.delete(key: 'accessPass');
|
|
||||||
}
|
|
||||||
|
|
||||||
String _panicPass = '';
|
|
||||||
String get panicPass => _panicPass;
|
|
||||||
set panicPass(String value) {
|
|
||||||
_panicPass = value;
|
|
||||||
secureStorage.setString('panicPass', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deletePanicPass() {
|
|
||||||
secureStorage.delete(key: 'panicPass');
|
|
||||||
}
|
|
||||||
|
|
||||||
String? _tokenAPNS = '';
|
|
||||||
String? get tokenAPNS => _tokenAPNS;
|
|
||||||
|
|
||||||
set tokenAPNS(String? value) {
|
|
||||||
_tokenAPNS = value;
|
|
||||||
if (value != null) {
|
|
||||||
secureStorage.setString('ff_tokenAPNS', value);
|
|
||||||
} else {
|
|
||||||
secureStorage.delete(key: 'ff_tokenAPNS');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteTokenAPNS() {
|
|
||||||
secureStorage.delete(key: 'ff_tokenAPNS');
|
|
||||||
AppState().tokenAPNS = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
String _email = '';
|
|
||||||
String get email => _email;
|
|
||||||
set email(String value) {
|
|
||||||
_email = value;
|
|
||||||
secureStorage.setString('ff_email', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteEmail() {
|
|
||||||
secureStorage.delete(key: 'ff_email');
|
|
||||||
AppState().email = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
String _passwd = '';
|
|
||||||
String get passwd => _passwd;
|
|
||||||
set passwd(String value) {
|
|
||||||
_passwd = value;
|
|
||||||
secureStorage.setString('ff_passwd', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deletePasswd() {
|
|
||||||
secureStorage.delete(key: 'ff_passwd');
|
|
||||||
AppState().passwd = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
String _deviceType = '';
|
|
||||||
String get deviceType => _deviceType;
|
|
||||||
set deviceType(String value) {
|
|
||||||
_deviceType = value;
|
|
||||||
secureStorage.setString('ff_deviceType', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteDevice() {
|
|
||||||
secureStorage.delete(key: 'ff_deviceType');
|
|
||||||
AppState().deviceType = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _isLogged = false;
|
|
||||||
bool get isLogged => _isLogged;
|
|
||||||
set isLogged(bool value) {
|
|
||||||
_isLogged = value;
|
|
||||||
secureStorage.setBool('ff_isLogged', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteIsLogged() {
|
|
||||||
secureStorage.delete(key: 'ff_isLogged');
|
|
||||||
}
|
|
||||||
|
|
||||||
String _token = '';
|
|
||||||
String get token => _token;
|
|
||||||
set token(String value) {
|
|
||||||
_token = value;
|
|
||||||
secureStorage.setString('ff_token', value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteToken() {
|
|
||||||
secureStorage.delete(key: 'ff_token');
|
|
||||||
AppState().token = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteAll() {
|
|
||||||
AppState().deleteAccessPass();
|
|
||||||
AppState().deleteDevice();
|
|
||||||
AppState().deleteEmail();
|
|
||||||
AppState().deleteFingerprintPass();
|
|
||||||
AppState().deleteIsLogged();
|
|
||||||
AppState().deletePasswd();
|
|
||||||
AppState().deletePanicPass();
|
|
||||||
AppState().deleteToken();
|
|
||||||
AppState().deleteTokenAPNS();
|
|
||||||
AppState().deleteContext();
|
|
||||||
secureStorage.deleteAll();
|
|
||||||
|
|
||||||
AppState().isLogged = false;
|
|
||||||
AppState().setFirstRun(false);
|
|
||||||
|
|
||||||
AppState().update(() {});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _safeInit(Function() initializeField) {
|
|
||||||
try {
|
|
||||||
initializeField();
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future _safeInitAsync(Function() initializeField) async {
|
|
||||||
try {
|
|
||||||
await initializeField();
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension FlutterSecureStorageExtensions on FlutterSecureStorage {
|
|
||||||
static final _lock = Lock();
|
|
||||||
|
|
||||||
Future<void> writeSync({required String key, String? value}) async =>
|
|
||||||
await _lock.synchronized(() async {
|
|
||||||
await write(key: key, value: value);
|
|
||||||
});
|
|
||||||
|
|
||||||
void remove(String key) => delete(key: key);
|
|
||||||
|
|
||||||
Future<String?> getString(String key) async => await read(key: key);
|
|
||||||
Future<void> setString(String key, String value) async =>
|
|
||||||
await writeSync(key: key, value: value);
|
|
||||||
|
|
||||||
Future<bool?> getBool(String key) async => (await read(key: key)) == 'true';
|
|
||||||
Future<void> setBool(String key, bool? value) async =>
|
|
||||||
await writeSync(key: key, value: value.toString());
|
|
||||||
|
|
||||||
Future<int?> getInt(String key) async =>
|
|
||||||
int.tryParse(await read(key: key) ?? '');
|
|
||||||
Future<void> setInt(String key, int value) async =>
|
|
||||||
await writeSync(key: key, value: value.toString());
|
|
||||||
|
|
||||||
Future<double?> getDouble(String key) async =>
|
|
||||||
double.tryParse(await read(key: key) ?? '');
|
|
||||||
Future<void> setDouble(String key, double value) async =>
|
|
||||||
await writeSync(key: key, value: value.toString());
|
|
||||||
|
|
||||||
Future<BuildContext?> getObject(String key) async {
|
|
||||||
final value = await read(key: key);
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return value as BuildContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<List<String>?> getStringList(String key) async =>
|
|
||||||
await read(key: key).then((result) {
|
|
||||||
if (result == null || result.isEmpty) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return const CsvToListConverter()
|
|
||||||
.convert(result)
|
|
||||||
.first
|
|
||||||
.map((e) => e.toString())
|
|
||||||
.toList();
|
|
||||||
});
|
|
||||||
Future<void> setStringList(String key, List<String> value) async =>
|
|
||||||
await writeSync(
|
|
||||||
key: key, value: const ListToCsvConverter().convert([value]));
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
|
import 'package:hub/backend/notifications/firebase_messaging_service.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -59,13 +60,9 @@ class PhpGroup {
|
||||||
class UnregisterDevice {
|
class UnregisterDevice {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'unregisterDevice',
|
callName: 'unregisterDevice',
|
||||||
|
@ -94,16 +91,10 @@ class DeletePet {
|
||||||
int? petID = 0,
|
int? petID = 0,
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'excluirPet';
|
const atividade = 'excluirPet';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -145,16 +136,10 @@ class UpdatePet {
|
||||||
String? notes = '',
|
String? notes = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'atualizarPet';
|
const atividade = 'atualizarPet';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -199,16 +184,10 @@ class GetPets {
|
||||||
int? pageSize = 0,
|
int? pageSize = 0,
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'consultaPets';
|
const atividade = 'consultaPets';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -241,16 +220,10 @@ class GetPetPhoto {
|
||||||
int? petId = 0,
|
int? petId = 0,
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'consultaFotoPet';
|
const atividade = 'consultaFotoPet';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -290,16 +263,10 @@ class RegisterPet {
|
||||||
String? notes = '',
|
String? notes = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'cadastrarPet';
|
const atividade = 'cadastrarPet';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -344,16 +311,9 @@ class BuscaEnconcomendas {
|
||||||
String? adresseeType = '',
|
String? adresseeType = '',
|
||||||
String? status = '',
|
String? status = '',
|
||||||
}) async {
|
}) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final devUUID = StorageUtil().devUUID;
|
||||||
final devUUID = await db
|
final userUUID = StorageUtil().userUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final cliID = StorageUtil().cliUUID;
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getEncomendas';
|
const atividade = 'getEncomendas';
|
||||||
|
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
|
@ -394,17 +354,11 @@ class CancelaVisita {
|
||||||
String? DevDesc = '',
|
String? DevDesc = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
final devUUID = StorageUtil().devUUID;
|
||||||
|
final userUUID = StorageUtil().userUUID;
|
||||||
|
final cliID = StorageUtil().cliUUID;
|
||||||
const atividade = 'cancelaVisita';
|
const atividade = 'cancelaVisita';
|
||||||
final devUUID = await db
|
|
||||||
.get(key: 'devUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'cancelaVisita',
|
callName: 'cancelaVisita',
|
||||||
|
@ -435,13 +389,9 @@ class CancelaVisita {
|
||||||
|
|
||||||
class DeleteAccount {
|
class DeleteAccount {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final devUUID = StorageUtil().devUUID;
|
||||||
final devUUID = await db
|
final userUUID = StorageUtil().userUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'deleteAccount',
|
callName: 'deleteAccount',
|
||||||
|
@ -470,17 +420,10 @@ class ChangePanic {
|
||||||
String? newSenhaPanico = '',
|
String? newSenhaPanico = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'updVisitado';
|
const atividade = 'updVisitado';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -513,16 +456,10 @@ class ChangePass {
|
||||||
String? newSenha = '',
|
String? newSenha = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'updVisitado';
|
const atividade = 'updVisitado';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -556,13 +493,9 @@ class RespondeVinculo {
|
||||||
String? cliID = '',
|
String? cliID = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'respondeVinculo',
|
callName: 'respondeVinculo',
|
||||||
|
@ -593,16 +526,10 @@ class ChangeNotifica {
|
||||||
String? notifica = '',
|
String? notifica = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'updVisitado';
|
const atividade = 'updVisitado';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -633,14 +560,10 @@ class ChangeNotifica {
|
||||||
class UpdToken {
|
class UpdToken {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final token = StorageUtil().token;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final token = AppState().token;
|
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'updToken',
|
callName: 'updToken',
|
||||||
|
@ -667,14 +590,11 @@ class UpdToken {
|
||||||
class LoginCall {
|
class LoginCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final devUUID = StorageUtil().devUUID;
|
||||||
final devUUID = await db
|
final email = StorageUtil().email;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final password = StorageUtil().passwd;
|
||||||
.then((value) => value.toString());
|
final type = StorageUtil().deviceType;
|
||||||
final email = AppState().email;
|
final description = StorageUtil().deviceDescription;
|
||||||
final password = AppState().passwd;
|
|
||||||
final type = AppState().deviceType;
|
|
||||||
final description = AppState().deviceDescription;
|
|
||||||
final token = FirebaseMessagingService.getToken();
|
final token = FirebaseMessagingService.getToken();
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -772,13 +692,9 @@ class ForgotPasswordCall {
|
||||||
class GetLocalsCall {
|
class GetLocalsCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'getLocals',
|
callName: 'getLocals',
|
||||||
|
@ -816,16 +732,10 @@ class PostScheduleVisitorCall {
|
||||||
String? foto = '',
|
String? foto = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'putVisitante';
|
const atividade = 'putVisitante';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -877,16 +787,10 @@ class PostScheduleVisitCall {
|
||||||
String? obs = '',
|
String? obs = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'putVisita';
|
const atividade = 'putVisita';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -937,16 +841,10 @@ class GetScheduleVisitCall {
|
||||||
String? chaveBusca = '',
|
String? chaveBusca = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getVisitas';
|
const atividade = 'getVisitas';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -1217,16 +1115,10 @@ class GetScheduleVisitCall {
|
||||||
class GetDadosCall {
|
class GetDadosCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getDados';
|
const atividade = 'getDados';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -1466,16 +1358,10 @@ class GetVisitorByDocCall {
|
||||||
String? documento = '',
|
String? documento = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getVisitante';
|
const atividade = 'getVisitante';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -1526,16 +1412,10 @@ class GetFotoVisitanteCall {
|
||||||
String? tipo = '',
|
String? tipo = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getFotoVisitante';
|
const atividade = 'getFotoVisitante';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -1571,16 +1451,10 @@ class PostProvVisitSchedulingCall {
|
||||||
String? proID = '',
|
String? proID = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'putAgendamentoProv';
|
const atividade = 'putAgendamentoProv';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -1626,16 +1500,10 @@ class GetVisitsCall {
|
||||||
int? pageNumber,
|
int? pageNumber,
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getVisitas';
|
const atividade = 'getVisitas';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -1895,16 +1763,10 @@ class DeleteVisitCall {
|
||||||
String? idVisita = '',
|
String? idVisita = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'cancelaVisita';
|
const atividade = 'cancelaVisita';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -1944,19 +1806,11 @@ class DeleteVisitCall {
|
||||||
class GetPessoasLocalCall {
|
class GetPessoasLocalCall {
|
||||||
Future<ApiCallResponse> call() async {
|
Future<ApiCallResponse> call() async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final ownerUUID = StorageUtil().ownerUUID;
|
||||||
.then((value) => value.toString());
|
final userUUID = StorageUtil().userUUID;
|
||||||
final ownerUUID = await db
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
.get(key: 'ownerUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
callName: 'getPessoasLocal',
|
callName: 'getPessoasLocal',
|
||||||
|
@ -2018,16 +1872,10 @@ class RespondeSolicitacaoCall {
|
||||||
String? idVisitante = '',
|
String? idVisitante = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'respondeSolicitacao';
|
const atividade = 'respondeSolicitacao';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -2074,16 +1922,10 @@ class GetAccessCall {
|
||||||
String? pesTipo = '',
|
String? pesTipo = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getAcessos';
|
const atividade = 'getAcessos';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
@ -2328,19 +2170,13 @@ class GetLiberationsCall {
|
||||||
Stream<ApiCallResponse> call() {
|
Stream<ApiCallResponse> call() {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final StreamController<ApiCallResponse> controller = StreamController();
|
final StreamController<ApiCallResponse> controller = StreamController();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
Future.microtask(() async {
|
Future.microtask(() async {
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getSolicitacoes';
|
const atividade = 'getSolicitacoes';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final response = await ApiManager.instance.makeApiCall(
|
final response = await ApiManager.instance.makeApiCall(
|
||||||
callName: 'getLiberations',
|
callName: 'getLiberations',
|
||||||
|
@ -2527,16 +2363,10 @@ class GetMessagesCall {
|
||||||
String? tipoDestino = '',
|
String? tipoDestino = '',
|
||||||
}) async {
|
}) async {
|
||||||
final baseUrl = PhpGroup.getBaseUrl();
|
final baseUrl = PhpGroup.getBaseUrl();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
const atividade = 'getMensagens';
|
const atividade = 'getMensagens';
|
||||||
|
|
||||||
return ApiManager.instance.makeApiCall(
|
return ApiManager.instance.makeApiCall(
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// ignore_for_file: constant_identifier_names, depend_on_referenced_packages, prefer_final_fields
|
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:core';
|
import 'dart:core';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
@ -107,11 +105,8 @@ class ApiCallResponse {
|
||||||
final http.Response? response;
|
final http.Response? response;
|
||||||
final http.StreamedResponse? streamedResponse;
|
final http.StreamedResponse? streamedResponse;
|
||||||
final Object? exception;
|
final Object? exception;
|
||||||
// Whether we received a 2xx status (which generally marks success).
|
|
||||||
bool get succeeded => statusCode >= 200 && statusCode < 300;
|
bool get succeeded => statusCode >= 200 && statusCode < 300;
|
||||||
String getHeader(String headerName) => headers[headerName] ?? '';
|
String getHeader(String headerName) => headers[headerName] ?? '';
|
||||||
// Return the raw body from the response, or if this came from a cloud call
|
|
||||||
// and the body is not a string, then the json encoded body.
|
|
||||||
String get bodyText =>
|
String get bodyText =>
|
||||||
response?.body ??
|
response?.body ??
|
||||||
(jsonBody is String ? jsonBody as String : jsonEncode(jsonBody));
|
(jsonBody is String ? jsonBody as String : jsonEncode(jsonBody));
|
||||||
|
@ -126,7 +121,7 @@ class ApiCallResponse {
|
||||||
dynamic jsonBody;
|
dynamic jsonBody;
|
||||||
try {
|
try {
|
||||||
if (bodyType == BodyType.BLOB) {
|
if (bodyType == BodyType.BLOB) {
|
||||||
jsonBody = response.bodyBytes; // Armazenar os bytes diretamente
|
jsonBody = response.bodyBytes;
|
||||||
} else {
|
} else {
|
||||||
final responseBody = decodeUtf8 && returnBody
|
final responseBody = decodeUtf8 && returnBody
|
||||||
? const Utf8Decoder().convert(response.bodyBytes)
|
? const Utf8Decoder().convert(response.bodyBytes)
|
||||||
|
@ -153,19 +148,13 @@ class ApiCallResponse {
|
||||||
class ApiManager {
|
class ApiManager {
|
||||||
ApiManager._();
|
ApiManager._();
|
||||||
|
|
||||||
// Cache that will ensure identical calls are not repeatedly made.
|
static final Map<ApiCallOptions, ApiCallResponse> _apiCache = {};
|
||||||
static Map<ApiCallOptions, ApiCallResponse> _apiCache = {};
|
|
||||||
|
|
||||||
static ApiManager? _instance;
|
static ApiManager? _instance;
|
||||||
static ApiManager get instance => _instance ??= ApiManager._();
|
static ApiManager get instance => _instance ??= ApiManager._();
|
||||||
|
|
||||||
// If your API calls need authentication, populate this field once
|
|
||||||
// the user has authenticated. Alter this as needed.
|
|
||||||
static String? _accessToken;
|
static String? _accessToken;
|
||||||
|
|
||||||
// You may want to call this if, for example, you make a change to the
|
|
||||||
// database and no longer want the cached result of a call that may
|
|
||||||
// have changed.
|
|
||||||
static void clearCache(String callName) => _apiCache.keys
|
static void clearCache(String callName) => _apiCache.keys
|
||||||
.toSet()
|
.toSet()
|
||||||
.forEach((k) => k.callName == callName ? _apiCache.remove(k) : null);
|
.forEach((k) => k.callName == callName ? _apiCache.remove(k) : null);
|
||||||
|
@ -187,7 +176,7 @@ class ApiManager {
|
||||||
bool decodeUtf8,
|
bool decodeUtf8,
|
||||||
bool isStreamingApi, {
|
bool isStreamingApi, {
|
||||||
http.Client? client,
|
http.Client? client,
|
||||||
BodyType? bodyType, // Adicionado para verificar o tipo de corpo
|
BodyType? bodyType,
|
||||||
}) async {
|
}) async {
|
||||||
if (params.isNotEmpty) {
|
if (params.isNotEmpty) {
|
||||||
final specifier =
|
final specifier =
|
||||||
|
@ -213,7 +202,7 @@ class ApiManager {
|
||||||
final response =
|
final response =
|
||||||
await makeRequest(Uri.parse(apiUrl), headers: toStringMap(headers));
|
await makeRequest(Uri.parse(apiUrl), headers: toStringMap(headers));
|
||||||
return ApiCallResponse.fromHttpResponse(
|
return ApiCallResponse.fromHttpResponse(
|
||||||
response, returnBody, decodeUtf8, bodyType); // Passar bodyType
|
response, returnBody, decodeUtf8, bodyType);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<ApiCallResponse> requestWithBody(
|
static Future<ApiCallResponse> requestWithBody(
|
||||||
|
@ -368,7 +357,6 @@ class ApiManager {
|
||||||
case null:
|
case null:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Set "Content-Type" header if it was previously unset.
|
|
||||||
if (contentType != null &&
|
if (contentType != null &&
|
||||||
!headers.keys.any((h) => h.toLowerCase() == 'content-type')) {
|
!headers.keys.any((h) => h.toLowerCase() == 'content-type')) {
|
||||||
headers['Content-Type'] = contentType;
|
headers['Content-Type'] = contentType;
|
||||||
|
@ -428,7 +416,6 @@ class ApiManager {
|
||||||
cache: cache,
|
cache: cache,
|
||||||
isStreamingApi: isStreamingApi,
|
isStreamingApi: isStreamingApi,
|
||||||
);
|
);
|
||||||
// Modify for your specific needs if this differs from your API.
|
|
||||||
if (_accessToken != null) {
|
if (_accessToken != null) {
|
||||||
headers[HttpHeaders.authorizationHeader] = 'Bearer $_accessToken';
|
headers[HttpHeaders.authorizationHeader] = 'Bearer $_accessToken';
|
||||||
}
|
}
|
||||||
|
@ -436,8 +423,6 @@ class ApiManager {
|
||||||
apiUrl = 'https://$apiUrl';
|
apiUrl = 'https://$apiUrl';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we've already made this exact call before and caching is on,
|
|
||||||
// return the cached result.
|
|
||||||
if (cache && _apiCache.containsKey(callOptions)) {
|
if (cache && _apiCache.containsKey(callOptions)) {
|
||||||
return _apiCache[callOptions]!;
|
return _apiCache[callOptions]!;
|
||||||
}
|
}
|
||||||
|
@ -504,7 +489,6 @@ class ApiManager {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If caching is on, cache the result (if present).
|
|
||||||
if (cache) {
|
if (cache) {
|
||||||
_apiCache[callOptions] = result;
|
_apiCache[callOptions] = result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
|
||||||
import 'package:firebase_messaging/firebase_messaging.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/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/secure_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
import 'notification_service.dart';
|
import 'notification_service.dart';
|
||||||
|
|
||||||
|
@ -36,24 +35,6 @@ class FirebaseMessagingService {
|
||||||
|
|
||||||
_firebaseMessaging.setAutoInitEnabled(false);
|
_firebaseMessaging.setAutoInitEnabled(false);
|
||||||
_firebaseMessaging.pluginConstants;
|
_firebaseMessaging.pluginConstants;
|
||||||
|
|
||||||
// FirebaseMessaging.onBackgroundMessage(handleMessage);
|
|
||||||
|
|
||||||
// FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
|
||||||
// handleMessage(message);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
|
||||||
// log('A Message was opened: $message');
|
|
||||||
// });
|
|
||||||
|
|
||||||
// FirebaseMessaging.instance
|
|
||||||
// .getInitialMessage()
|
|
||||||
// .then((RemoteMessage? message) {
|
|
||||||
// if (message != null) {
|
|
||||||
// log('A Message was opened: $message');
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<String> getToken() async =>
|
static Future<String> getToken() async =>
|
||||||
|
@ -64,7 +45,7 @@ class FirebaseMessagingService {
|
||||||
final String? deviceToken = await _firebaseMessaging.getToken();
|
final String? deviceToken = await _firebaseMessaging.getToken();
|
||||||
|
|
||||||
if (deviceToken != null) {
|
if (deviceToken != null) {
|
||||||
AppState().token = deviceToken;
|
StorageUtil().token = deviceToken;
|
||||||
final ApiCallResponse? response;
|
final ApiCallResponse? response;
|
||||||
|
|
||||||
response = await PhpGroup.updToken.call();
|
response = await PhpGroup.updToken.call();
|
||||||
|
|
|
@ -13,17 +13,17 @@ 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_util.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
|
||||||
Future<void> onMessageReceived(
|
Future<void> onMessageReceived(
|
||||||
Map<String, dynamic> payload, String? extra, String? handleClick) async {
|
Map<String, dynamic> payload, String? extra, String? handleClick) async {
|
||||||
final localId = jsonDecode(payload['local']!)['CLI_ID'];
|
final localId = jsonDecode(payload['local']!)['CLI_ID'];
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final cliUUID = await db
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
answersRequest(
|
answersRequest(
|
||||||
{required BuildContext context,
|
{required BuildContext context,
|
||||||
required String? ref,
|
required String? ref,
|
||||||
|
@ -50,7 +50,7 @@ Future<void> onMessageReceived(
|
||||||
switch (handleClick) {
|
switch (handleClick) {
|
||||||
case 'visit_request':
|
case 'visit_request':
|
||||||
showDialog(
|
showDialog(
|
||||||
context: AppState().context!,
|
context: StorageUtil().context!,
|
||||||
barrierColor: Colors.transparent,
|
barrierColor: Colors.transparent,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -173,7 +173,7 @@ Future<void> onMessageReceived(
|
||||||
break;
|
break;
|
||||||
case 'access':
|
case 'access':
|
||||||
showDialog(
|
showDialog(
|
||||||
context: AppState().context!,
|
context: StorageUtil().context!,
|
||||||
barrierColor: Colors.transparent,
|
barrierColor: Colors.transparent,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -225,14 +225,14 @@ Future<void> onMessageReceived(
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// onTapCardItemAction: () {},
|
// onTapCardItemAction: () {},
|
||||||
buttons: [],
|
buttons: const [],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'mensagem':
|
case 'mensagem':
|
||||||
showDialog(
|
showDialog(
|
||||||
context: AppState().context!,
|
context: StorageUtil().context!,
|
||||||
barrierColor: Colors.transparent,
|
barrierColor: Colors.transparent,
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -255,8 +255,8 @@ Future<void> onMessageReceived(
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'enroll_cond':
|
case 'enroll_cond':
|
||||||
AppState().haveLocal = true;
|
StorageUtil().haveLocal = true;
|
||||||
AppState().context!.go('/homePage');
|
StorageUtil().context!.go('/homePage');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -292,14 +292,12 @@ class NotificationService {
|
||||||
await AwesomeNotifications()
|
await AwesomeNotifications()
|
||||||
.isNotificationAllowed()
|
.isNotificationAllowed()
|
||||||
.then((isAllowed) async {
|
.then((isAllowed) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final bool requestOSnotification =
|
||||||
final bool requestOSnotification = await db
|
StorageUtil().requestOSnotification;
|
||||||
.get(key: 'requestOSnotification', field: 'value')
|
|
||||||
.then((value) => value.toString() == 'true');
|
|
||||||
|
|
||||||
if (!requestOSnotification) {
|
if (!requestOSnotification) {
|
||||||
if (!isAllowed) {
|
if (!isAllowed) {
|
||||||
await db.update('requestOSnotification', 'true', 'util');
|
StorageUtil().requestOSnotification = true;
|
||||||
await AwesomeNotifications().requestPermissionToSendNotifications();
|
await AwesomeNotifications().requestPermissionToSendNotifications();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,25 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
import '../../../app_state.dart';
|
import '../../../app_state.dart';
|
||||||
|
|
||||||
class MenuButtonWidget extends MenuEntry {
|
class MenuButtonWidget extends MenuEntry {
|
||||||
const MenuButtonWidget({
|
const MenuButtonWidget({
|
||||||
Key? key,
|
super.key,
|
||||||
this.action,
|
this.action,
|
||||||
this.title,
|
this.title,
|
||||||
this.icon,
|
this.icon,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
final Function()? action;
|
final Function()? action;
|
||||||
|
@override
|
||||||
final String? title;
|
final String? title;
|
||||||
|
@override
|
||||||
final IconData? icon;
|
final IconData? icon;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -34,10 +38,7 @@ class _MenuButtonWidgetState extends State<MenuButtonWidget> {
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
if (cliUUID.isEmpty) {
|
if (cliUUID.isEmpty) {
|
||||||
return DialogUtil.warningDefault(context);
|
return DialogUtil.warningDefault(context);
|
||||||
|
|
|
@ -5,14 +5,17 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
|
||||||
class MenuCardItem extends MenuEntry {
|
class MenuCardItem extends MenuEntry {
|
||||||
const MenuCardItem({
|
const MenuCardItem({
|
||||||
Key? key,
|
super.key,
|
||||||
this.action,
|
this.action,
|
||||||
this.title,
|
this.title,
|
||||||
this.icon,
|
this.icon,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
final Function()? action;
|
final Function()? action;
|
||||||
|
@override
|
||||||
final String? title;
|
final String? title;
|
||||||
|
@override
|
||||||
final IconData? icon;
|
final IconData? icon;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -9,11 +9,11 @@ class AppBarUtil extends StatelessWidget implements PreferredSizeWidget {
|
||||||
final Widget? actionButton;
|
final Widget? actionButton;
|
||||||
|
|
||||||
const AppBarUtil({
|
const AppBarUtil({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.title,
|
required this.title,
|
||||||
this.onBackButtonPressed,
|
this.onBackButtonPressed,
|
||||||
this.actionButton,
|
this.actionButton,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class CustomDatePickerUtil extends StatefulWidget {
|
||||||
final FormFieldValidator<String>? validator;
|
final FormFieldValidator<String>? validator;
|
||||||
|
|
||||||
CustomDatePickerUtil({
|
CustomDatePickerUtil({
|
||||||
Key? key,
|
super.key,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.focusNode,
|
this.focusNode,
|
||||||
required this.hintText,
|
required this.hintText,
|
||||||
|
@ -29,7 +29,7 @@ class CustomDatePickerUtil extends StatefulWidget {
|
||||||
required this.firstDate,
|
required this.firstDate,
|
||||||
this.lastDate,
|
this.lastDate,
|
||||||
this.validator,
|
this.validator,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CustomDatePickerState createState() => _CustomDatePickerState();
|
_CustomDatePickerState createState() => _CustomDatePickerState();
|
||||||
|
|
|
@ -22,7 +22,7 @@ class CustomInputUtil extends StatefulWidget {
|
||||||
final void Function(String)? onChanged;
|
final void Function(String)? onChanged;
|
||||||
|
|
||||||
CustomInputUtil(
|
CustomInputUtil(
|
||||||
{Key? key,
|
{super.key,
|
||||||
this.controller,
|
this.controller,
|
||||||
required this.labelText,
|
required this.labelText,
|
||||||
required this.hintText,
|
required this.hintText,
|
||||||
|
@ -35,8 +35,7 @@ class CustomInputUtil extends StatefulWidget {
|
||||||
this.maxLength = 80,
|
this.maxLength = 80,
|
||||||
this.validator,
|
this.validator,
|
||||||
this.obscureText,
|
this.obscureText,
|
||||||
required this.haveMaxLength})
|
required this.haveMaxLength});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CustomInputUtil> createState() => _CustomInputUtilState();
|
State<CustomInputUtil> createState() => _CustomInputUtilState();
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CustomSelect extends StatefulWidget {
|
||||||
bool isRequired;
|
bool isRequired;
|
||||||
|
|
||||||
CustomSelect({
|
CustomSelect({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.options,
|
required this.options,
|
||||||
required this.optionsLabel,
|
required this.optionsLabel,
|
||||||
required this.hintText,
|
required this.hintText,
|
||||||
|
@ -30,7 +30,7 @@ class CustomSelect extends StatefulWidget {
|
||||||
this.isRequired = false,
|
this.isRequired = false,
|
||||||
this.dropDownValue,
|
this.dropDownValue,
|
||||||
this.isMultiSelect = false,
|
this.isMultiSelect = false,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CustomSelectState createState() => _CustomSelectState();
|
_CustomSelectState createState() => _CustomSelectState();
|
||||||
|
|
|
@ -15,12 +15,12 @@ class MediaUploadButtonUtil extends StatefulWidget {
|
||||||
FFUploadedFile? uploadedFiles;
|
FFUploadedFile? uploadedFiles;
|
||||||
|
|
||||||
MediaUploadButtonUtil({
|
MediaUploadButtonUtil({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.onUploadComplete,
|
required this.onUploadComplete,
|
||||||
required this.isUploading,
|
required this.isUploading,
|
||||||
required this.labelText,
|
required this.labelText,
|
||||||
this.uploadedFiles,
|
this.uploadedFiles,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MediaUploadButtonUtil> createState() => _MediaUploadButtonUtilState();
|
State<MediaUploadButtonUtil> createState() => _MediaUploadButtonUtilState();
|
||||||
|
|
|
@ -9,7 +9,7 @@ class SubmitButtonUtil extends StatelessWidget {
|
||||||
final String labelText;
|
final String labelText;
|
||||||
Future Function()? onPressed;
|
Future Function()? onPressed;
|
||||||
|
|
||||||
SubmitButtonUtil({
|
SubmitButtonUtil({super.key,
|
||||||
required this.labelText,
|
required this.labelText,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
|
@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
abstract class MenuEntry extends StatefulWidget {
|
abstract class MenuEntry extends StatefulWidget {
|
||||||
const MenuEntry({
|
const MenuEntry({
|
||||||
Key? key,
|
super.key,
|
||||||
this.action,
|
this.action,
|
||||||
this.title,
|
this.title,
|
||||||
this.icon,
|
this.icon,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final Function()? action;
|
final Function()? action;
|
||||||
final String? title;
|
final String? title;
|
||||||
|
|
|
@ -10,10 +10,10 @@ class OptModalWidget extends StatefulWidget {
|
||||||
final String defaultAccessType;
|
final String defaultAccessType;
|
||||||
|
|
||||||
const OptModalWidget({
|
const OptModalWidget({
|
||||||
Key? key,
|
super.key,
|
||||||
this.defaultPersonType = '.*',
|
this.defaultPersonType = '.*',
|
||||||
this.defaultAccessType = '.*',
|
this.defaultAccessType = '.*',
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_OptModalWidgetState createState() => _OptModalWidgetState();
|
_OptModalWidgetState createState() => _OptModalWidgetState();
|
||||||
|
|
|
@ -11,10 +11,10 @@ class OptModalWidget extends StatefulWidget {
|
||||||
final String defaultAccessType;
|
final String defaultAccessType;
|
||||||
|
|
||||||
const OptModalWidget({
|
const OptModalWidget({
|
||||||
Key? key,
|
super.key,
|
||||||
this.defaultPersonType = '.*',
|
this.defaultPersonType = '.*',
|
||||||
this.defaultAccessType = '.*',
|
this.defaultAccessType = '.*',
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_OptModalWidgetState createState() => _OptModalWidgetState();
|
_OptModalWidgetState createState() => _OptModalWidgetState();
|
||||||
|
@ -315,12 +315,12 @@ class _OptModalWidgetState extends State<OptModalWidget> {
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: _applyFilter,
|
onPressed: _applyFilter,
|
||||||
child:
|
|
||||||
Text(FFLocalizations.of(context).getText('88kshkph')),
|
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: FlutterFlowTheme.of(context).info,
|
foregroundColor: FlutterFlowTheme.of(context).info,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
),
|
),
|
||||||
|
child:
|
||||||
|
Text(FFLocalizations.of(context).getText('88kshkph')),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,16 +4,18 @@ import 'package:hub/components/molecular_components/order_filter_modal/order_fil
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.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 {
|
class OrderFilterModalWidget extends StatefulWidget {
|
||||||
final String defaultAdresseeType;
|
final String defaultAdresseeType;
|
||||||
final String defaultStatus;
|
final String defaultStatus;
|
||||||
|
|
||||||
const OrderFilterModalWidget({
|
const OrderFilterModalWidget({
|
||||||
Key? key,
|
super.key,
|
||||||
this.defaultAdresseeType = '.*',
|
this.defaultAdresseeType = '.*',
|
||||||
this.defaultStatus = '.*',
|
this.defaultStatus = '.*',
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_OrderFilterModalWidgetState createState() => _OrderFilterModalWidgetState();
|
_OrderFilterModalWidgetState createState() => _OrderFilterModalWidgetState();
|
||||||
|
@ -25,24 +27,25 @@ class _OrderFilterModalWidgetState extends State<OrderFilterModalWidget> {
|
||||||
late Map<String, dynamic> selected;
|
late Map<String, dynamic> selected;
|
||||||
final List<Map<String, String>> adresseeTypeOptions = [
|
final List<Map<String, String>> adresseeTypeOptions = [
|
||||||
{
|
{
|
||||||
'title': FFLocalizations.of(AppState().context!)
|
'title': FFLocalizations.of(StorageUtil().context!)
|
||||||
.getVariableText(enText: 'Resident', ptText: 'Morador'),
|
.getVariableText(enText: 'Resident', ptText: 'Morador'),
|
||||||
'value': 'MOR'
|
'value': 'MOR'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'title': FFLocalizations.of(AppState().context!)
|
'title': FFLocalizations.of(StorageUtil().context!)
|
||||||
.getVariableText(enText: 'Property', ptText: 'Propriedade'),
|
.getVariableText(enText: 'Property', ptText: 'Propriedade'),
|
||||||
'value': 'PRO'
|
'value': 'PRO'
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
final List<Map<String, String>> statusOptions = [
|
final List<Map<String, String>> statusOptions = [
|
||||||
{
|
{
|
||||||
'title': FFLocalizations.of(AppState().context!).getVariableText(
|
'title': FFLocalizations.of(StorageUtil().context!)
|
||||||
ptText: 'Aguardando Retirada', enText: 'Waiting for Pickup'),
|
.getVariableText(
|
||||||
|
ptText: 'Aguardando Retirada', enText: 'Waiting for Pickup'),
|
||||||
'value': 'notPickedUp'
|
'value': 'notPickedUp'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'title': FFLocalizations.of(AppState().context!)
|
'title': FFLocalizations.of(StorageUtil().context!)
|
||||||
.getVariableText(ptText: 'Retirado', enText: 'Picked Up'),
|
.getVariableText(ptText: 'Retirado', enText: 'Picked Up'),
|
||||||
'value': 'pickedUp'
|
'value': 'pickedUp'
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
|
|
||||||
class VisitorNotFoundComponentWidget extends StatefulWidget {
|
class VisitorNotFoundComponentWidget extends StatefulWidget {
|
||||||
const VisitorNotFoundComponentWidget({this.doc, Key? key}) : super(key: key);
|
const VisitorNotFoundComponentWidget({this.doc, super.key});
|
||||||
|
|
||||||
final String? doc;
|
final String? doc;
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -3,9 +3,10 @@ import 'package:hub/components/organism_components/bottom_arrow_linked_locals_co
|
||||||
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '/backend/api_requests/api_calls.dart';
|
import '/backend/api_requests/api_calls.dart';
|
||||||
|
@ -65,16 +66,12 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
|
|
||||||
Future<ApiCallResponse?> _fetchLocals() async {
|
Future<ApiCallResponse?> _fetchLocals() async {
|
||||||
try {
|
try {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final devUUID = await db.get(key: 'devUUID', field: 'value');
|
|
||||||
final userUUID = await db.get(key: 'userUUID', field: 'value');
|
|
||||||
|
|
||||||
setState(() => _loading = true);
|
setState(() => _loading = true);
|
||||||
var response = await PhpGroup.getLocalsCall.call();
|
var response = await PhpGroup.getLocalsCall.call();
|
||||||
|
|
||||||
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||||
|
|
||||||
if (locals != null && locals.isNotEmpty) {
|
if (locals.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_localsWrap.addAll(locals);
|
_localsWrap.addAll(locals);
|
||||||
_hasData = true;
|
_hasData = true;
|
||||||
|
@ -84,9 +81,9 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
// Verifica se há apenas um local e se o status é 'A'
|
// Verifica se há apenas um local e se o status é 'A'
|
||||||
if (locals.length == 1 && locals[0]['CLU_STATUS'] == 'A') {
|
if (locals.length == 1 && locals[0]['CLU_STATUS'] == 'A') {
|
||||||
final local = locals[0];
|
final local = locals[0];
|
||||||
db.update('cliUUID', local['CLI_ID'], 'local');
|
StorageUtil().cliName = local['CLI_NOME'];
|
||||||
db.update('cliName', local['CLI_NOME'], 'local');
|
StorageUtil().cliUUID = local['CLI_ID'];
|
||||||
db.update('ownerUUID', local['CLU_OWNER_ID'], 'local');
|
StorageUtil().ownerUUID = local['CLU_OWNER_ID'];
|
||||||
|
|
||||||
context.pop();
|
context.pop();
|
||||||
}
|
}
|
||||||
|
@ -108,6 +105,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<dynamic> _fetchResponseLink(String status, String cliID) async {
|
Future<dynamic> _fetchResponseLink(String status, String cliID) async {
|
||||||
|
@ -173,12 +171,10 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
labelsHashMap: _labelsHashMap(local),
|
labelsHashMap: _labelsHashMap(local),
|
||||||
statusHashMap: [_statusHashMap(local)],
|
statusHashMap: [_statusHashMap(local)],
|
||||||
onTapCardItemAction: () async {
|
onTapCardItemAction: () async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
if (local['CLU_STATUS'] == 'A') {
|
if (local['CLU_STATUS'] == 'A') {
|
||||||
db.update('cliUUID', local['CLI_ID'], 'local');
|
StorageUtil().cliUUID = local['CLI_ID'];
|
||||||
db.update('cliName', local['CLI_NOME'], 'local');
|
StorageUtil().cliName = local['CLI_NOME'];
|
||||||
db.update('ownerUUID', local['CLU_OWNER_ID'], 'local');
|
StorageUtil().ownerUUID = local['CLU_OWNER_ID'];
|
||||||
|
|
||||||
context.pop();
|
context.pop();
|
||||||
} else if (local['CLU_STATUS'] == 'B') {
|
} else if (local['CLU_STATUS'] == 'B') {
|
||||||
|
@ -247,8 +243,6 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
double height = MediaQuery.sizeOf(context).height;
|
double height = MediaQuery.sizeOf(context).height;
|
||||||
|
|
||||||
return Align(
|
return Align(
|
||||||
|
@ -300,7 +294,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Escolha um local', enText: 'Choose a location'),
|
ptText: 'Escolha um local', enText: 'Choose a location'),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
)))),
|
)))),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:ffi';
|
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
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 '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'local_profile_component_widget.dart' show LocalProfileComponentWidget;
|
import 'local_profile_component_widget.dart' show LocalProfileComponentWidget;
|
||||||
|
@ -11,7 +10,6 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class LocalProfileComponentModel
|
class LocalProfileComponentModel
|
||||||
extends FlutterFlowModel<LocalProfileComponentWidget> {
|
extends FlutterFlowModel<LocalProfileComponentWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
String cliName = '';
|
String cliName = '';
|
||||||
String cliUUID = '';
|
String cliUUID = '';
|
||||||
VoidCallback? setStateCallback;
|
VoidCallback? setStateCallback;
|
||||||
|
@ -22,12 +20,8 @@ class LocalProfileComponentModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getData() async {
|
Future<void> getData() async {
|
||||||
cliName = await db
|
cliName = StorageUtil().cliName;
|
||||||
.get(key: 'cliName', field: 'value')
|
cliUUID = StorageUtil().cliUUID;
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
setStateCallback?.call();
|
setStateCallback?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,9 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
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/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '/flutter_flow/custom_functions.dart' as functions;
|
import '/flutter_flow/custom_functions.dart' as functions;
|
||||||
|
@ -16,10 +17,8 @@ import 'local_profile_component_model.dart';
|
||||||
|
|
||||||
export 'local_profile_component_model.dart';
|
export 'local_profile_component_model.dart';
|
||||||
|
|
||||||
////
|
|
||||||
|
|
||||||
class LocalProfileComponentWidget extends StatefulWidget {
|
class LocalProfileComponentWidget extends StatefulWidget {
|
||||||
LocalProfileComponentWidget({Key? key}) : super(key: key);
|
const LocalProfileComponentWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<LocalProfileComponentWidget> createState() =>
|
State<LocalProfileComponentWidget> createState() =>
|
||||||
|
@ -29,7 +28,6 @@ class LocalProfileComponentWidget extends StatefulWidget {
|
||||||
class _LocalProfileComponentWidgetState
|
class _LocalProfileComponentWidgetState
|
||||||
extends State<LocalProfileComponentWidget> {
|
extends State<LocalProfileComponentWidget> {
|
||||||
late LocalProfileComponentModel _model;
|
late LocalProfileComponentModel _model;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback callback) {
|
void setState(VoidCallback callback) {
|
||||||
|
@ -45,9 +43,7 @@ class _LocalProfileComponentWidgetState
|
||||||
_model.setStateCallback = () => safeSetState(() {});
|
_model.setStateCallback = () => safeSetState(() {});
|
||||||
|
|
||||||
() async {
|
() async {
|
||||||
_model.cliUUID = await db
|
_model.cliUUID = StorageUtil().cliUUID;
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
if (_model.cliUUID.isEmpty) {
|
if (_model.cliUUID.isEmpty) {
|
||||||
await processLocals();
|
await processLocals();
|
||||||
|
@ -72,26 +68,31 @@ class _LocalProfileComponentWidgetState
|
||||||
// final errorMsg = response.jsonBody['error_msg'];
|
// final errorMsg = response.jsonBody['error_msg'];
|
||||||
|
|
||||||
if (error == false) {
|
if (error == false) {
|
||||||
final whatsapp = response.jsonBody['whatsapp'] ?? false;
|
final bool whatsapp = response.jsonBody['whatsapp'] ?? false;
|
||||||
final provisional = response.jsonBody['provisional'] ?? false;
|
final bool provisional = response.jsonBody['provisional'] ?? false;
|
||||||
final pets = response.jsonBody['pet'] ?? false;
|
final bool pets = response.jsonBody['pet'] ?? false;
|
||||||
final petAmountRegister = response.jsonBody['petAmountRegister'] ?? '0';
|
final String petAmountRegister =
|
||||||
final name = response.jsonBody['visitado']['VDO_NOME'];
|
response.jsonBody['petAmountRegister'].toString().isEmpty
|
||||||
|
? '0'
|
||||||
|
: response.jsonBody['petAmountRegister'].toString();
|
||||||
|
final String name = response.jsonBody['visitado']['VDO_NOME'];
|
||||||
|
|
||||||
await db.update('whatsapp', whatsapp.toString(), 'local');
|
StorageUtil().whatsapp = whatsapp;
|
||||||
await db.update('provisional', provisional.toString(), 'local');
|
StorageUtil().provisional = provisional;
|
||||||
await db.update('pets', pets.toString(), 'local');
|
StorageUtil().pets = pets;
|
||||||
await db.update('petAmountRegister', petAmountRegister, 'local');
|
StorageUtil().petAmountRegister = petAmountRegister;
|
||||||
await db.update('name', name, 'local');
|
StorageUtil().userName = name;
|
||||||
|
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
return;
|
return;
|
||||||
|
} else if (error == true) {
|
||||||
|
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
|
||||||
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
|
|
||||||
safeSetState(() {});
|
|
||||||
return;
|
return;
|
||||||
} catch (e, s) {
|
} catch (e) {
|
||||||
|
log('() => error: $e'); // Add this line to log the error
|
||||||
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
|
DialogUtil.warningDefault(context).whenComplete(() => processLocals());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,9 +101,7 @@ class _LocalProfileComponentWidgetState
|
||||||
try {
|
try {
|
||||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||||
|
|
||||||
final cliUUID = await db
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
var response = await callback.call();
|
var response = await callback.call();
|
||||||
|
|
||||||
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||||
|
@ -146,8 +145,6 @@ class _LocalProfileComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: const BoxDecoration(),
|
decoration: const BoxDecoration(),
|
||||||
child: Align(
|
child: Align(
|
||||||
|
|
|
@ -3,7 +3,9 @@ import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart';
|
import 'package:hub/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_model.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/extensions/dialog_extensions.dart';
|
import 'package:hub/shared/extensions/dialog_extensions.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
|
||||||
import '/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
|
import '/components/molecular_components/option_selection_modal/option_selection_modal_widget.dart';
|
||||||
|
@ -70,11 +72,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future deliverySchedule(BuildContext context) async {
|
Future deliverySchedule(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final bool isProvisional = StorageUtil().provisional;
|
||||||
|
|
||||||
final bool isProvisional = await db
|
|
||||||
.get(key: 'provisional', field: 'value')
|
|
||||||
.then((value) => value.toString() == 'true') as bool;
|
|
||||||
|
|
||||||
if (isProvisional == true) {
|
if (isProvisional == true) {
|
||||||
context.push(
|
context.push(
|
||||||
|
@ -93,11 +91,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future provisionalSchedule(BuildContext context) async {
|
Future provisionalSchedule(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final isProvisional = StorageUtil().provisional;
|
||||||
|
|
||||||
final isProvisional = await db
|
|
||||||
.get(key: 'provisional', field: 'value')
|
|
||||||
.then((value) => value.toString() == 'true') as bool;
|
|
||||||
if (isProvisional == true) {
|
if (isProvisional == true) {
|
||||||
context.push(
|
context.push(
|
||||||
'/provisionalSchedule',
|
'/provisionalSchedule',
|
||||||
|
@ -115,10 +109,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future fastPassAction(BuildContext context) async {
|
Future fastPassAction(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final isWpp = StorageUtil().whatsapp;
|
||||||
final isWpp = await db.get(key: 'whatsapp', field: 'value').then((value) {
|
|
||||||
return value.toString() == 'true';
|
|
||||||
}) as bool;
|
|
||||||
if (isWpp) {
|
if (isWpp) {
|
||||||
context.push(
|
context.push(
|
||||||
'/fastPassPage',
|
'/fastPassPage',
|
||||||
|
@ -202,8 +193,6 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> signOut(BuildContext context) async {
|
Future<void> signOut(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
showAlertDialog(
|
showAlertDialog(
|
||||||
context,
|
context,
|
||||||
'Logout',
|
'Logout',
|
||||||
|
@ -212,7 +201,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
ptText: 'Tem certeza',
|
ptText: 'Tem certeza',
|
||||||
), () async {
|
), () async {
|
||||||
PhpGroup.unregisterDevice.call();
|
PhpGroup.unregisterDevice.call();
|
||||||
AppState().deleteAll();
|
StorageUtil.purge();
|
||||||
|
|
||||||
context.go(
|
context.go(
|
||||||
'/welcomePage',
|
'/welcomePage',
|
||||||
|
@ -224,7 +213,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
await db.purge();
|
await SQLiteStorageHelper().purge();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,10 +231,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future packageOrder(BuildContext context) async {
|
Future packageOrder(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final isWpp = StorageUtil().whatsapp;
|
||||||
final isWpp = await db.get(key: 'whatsapp', field: 'value').then((value) {
|
|
||||||
return value.toString() == 'true';
|
|
||||||
}) as bool;
|
|
||||||
|
|
||||||
if (isWpp) {
|
if (isWpp) {
|
||||||
context.push(
|
context.push(
|
||||||
|
@ -264,10 +250,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future reservation(BuildContext context) async {
|
Future reservation(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final isWpp = StorageUtil().whatsapp;
|
||||||
final isWpp = await db.get(key: 'whatsapp', field: 'value').then((value) {
|
|
||||||
return value.toString() == 'true';
|
|
||||||
}) as bool;
|
|
||||||
if (isWpp) {
|
if (isWpp) {
|
||||||
context.push(
|
context.push(
|
||||||
'/reservation',
|
'/reservation',
|
||||||
|
@ -294,13 +277,13 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: MediaQuery.viewInsetsOf(context),
|
padding: MediaQuery.viewInsetsOf(context),
|
||||||
child: OptionSelectionModalWidget(
|
child: OptionSelectionModalWidget(
|
||||||
routesListStr: <String>[
|
routesListStr: const <String>[
|
||||||
'liberationHistory',
|
'liberationHistory',
|
||||||
'acessHistoryPage',
|
'acessHistoryPage',
|
||||||
'scheduleCompleteVisitPage',
|
'scheduleCompleteVisitPage',
|
||||||
'messageHistoryPage'
|
'messageHistoryPage'
|
||||||
],
|
],
|
||||||
iconsListIcon: <IconData>[
|
iconsListIcon: const <IconData>[
|
||||||
Icons.history_rounded,
|
Icons.history_rounded,
|
||||||
Icons.history_rounded,
|
Icons.history_rounded,
|
||||||
Icons.history_rounded,
|
Icons.history_rounded,
|
||||||
|
@ -383,10 +366,7 @@ class MenuComponentModel extends FlutterFlowModel<MenuComponentWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future petsAction(BuildContext context) async {
|
Future petsAction(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
bool isPet = StorageUtil().pets;
|
||||||
bool isPet = await db.get(key: 'pets', field: 'value').then((value) {
|
|
||||||
return value.toString() == 'true';
|
|
||||||
}) as bool;
|
|
||||||
if (isPet) {
|
if (isPet) {
|
||||||
context.push(
|
context.push(
|
||||||
'/petsPage',
|
'/petsPage',
|
||||||
|
|
|
@ -3,7 +3,7 @@ import 'package:hub/backend/schema/enums/enums.dart';
|
||||||
import 'package:hub/components/atomic_components/menu_button_item/menu_button_item_widget.dart';
|
import 'package:hub/components/atomic_components/menu_button_item/menu_button_item_widget.dart';
|
||||||
import 'package:hub/components/atomic_components/menu_card_item/menu_card_item.dart';
|
import 'package:hub/components/atomic_components/menu_card_item/menu_card_item.dart';
|
||||||
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
import 'package:hub/components/molecular_components/menu_item/menu_item.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
|
||||||
import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart';
|
import '/components/organism_components/menu_list_view_component/menu_list_view_component_widget.dart';
|
||||||
import '/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart';
|
import '/components/organism_components/menu_staggered_view_component/menu_staggered_view_component_widget.dart';
|
||||||
|
|
|
@ -6,9 +6,6 @@ import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'message_well_component_widget.dart' show MessageWellComponentWidget;
|
import 'message_well_component_widget.dart' show MessageWellComponentWidget;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
///
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class MessageWellComponentModel
|
class MessageWellComponentModel
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.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_util.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class _MessageWellComponentWidgetState
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
context.read<MessageWellNotifier>().fetchMessages();
|
context.read<MessageWellNotifier>().fetchMessages();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -339,7 +339,6 @@ class MessageWellState {
|
||||||
class MessageWellNotifier extends StateNotifier<MessageWellState> {
|
class MessageWellNotifier extends StateNotifier<MessageWellState> {
|
||||||
var _totalPageNumber = 1;
|
var _totalPageNumber = 1;
|
||||||
int get totalPageNumber => _totalPageNumber;
|
int get totalPageNumber => _totalPageNumber;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
set totalPageNumber(int value) {
|
set totalPageNumber(int value) {
|
||||||
_totalPageNumber = value;
|
_totalPageNumber = value;
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.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/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class ScheduleVisitDetailModel
|
class ScheduleVisitDetailModel
|
||||||
extends FlutterFlowModel<ScheduleVisitDetailWidget> {
|
extends FlutterFlowModel<ScheduleVisitDetailWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -60,9 +59,9 @@ class ScheduleVisitDetailModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initDB() async {
|
Future<void> initDB() async {
|
||||||
devUUID = await db.get(key: 'devUUID', field: 'value');
|
devUUID = StorageUtil().devUUID;
|
||||||
userUUID = await db.get(key: 'userUUID', field: 'value');
|
userUUID = StorageUtil().userUUID;
|
||||||
cliUUID = await db.get(key: 'cliUUID', field: 'value');
|
cliUUID = StorageUtil().cliUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class ScheduleVisitDetailWidget extends StatefulWidget {
|
class ScheduleVisitDetailWidget extends StatefulWidget {
|
||||||
const ScheduleVisitDetailWidget({
|
const ScheduleVisitDetailWidget({
|
||||||
|
@ -94,7 +93,6 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
final visitorsData = widget.visitorJsonList!.toList().take(2).toList();
|
final visitorsData = widget.visitorJsonList!.toList().take(2).toList();
|
||||||
final visitorsDataItem = visitorsData[0];
|
final visitorsDataItem = visitorsData[0];
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ import 'package:hub/components/organism_components/up_arrow_linked_locals_compon
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
class UpArrowLinkedLocalsComponentModel
|
class UpArrowLinkedLocalsComponentModel
|
||||||
extends FlutterFlowModel<UpArrowLinkedLocalsComponentWidget> {
|
extends FlutterFlowModel<UpArrowLinkedLocalsComponentWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -18,18 +18,10 @@ class UpArrowLinkedLocalsComponentModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initDB() async {
|
Future<void> initDB() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
cliName = StorageUtil().cliName;
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliName = await db
|
|
||||||
.get(key: 'cliName', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class UpArrowLinkedLocalsComponentWidget extends StatefulWidget {
|
class UpArrowLinkedLocalsComponentWidget extends StatefulWidget {
|
||||||
const UpArrowLinkedLocalsComponentWidget({super.key});
|
const UpArrowLinkedLocalsComponentWidget({super.key});
|
||||||
|
@ -42,8 +41,6 @@ class _UpArrowLinkedLocalsComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Align(
|
return Align(
|
||||||
alignment: const AlignmentDirectional(0.0, -1.0),
|
alignment: const AlignmentDirectional(0.0, -1.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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 '/backend/api_requests/api_calls.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -9,7 +10,6 @@ import 'access_notification_modal_template_component_widget.dart'
|
||||||
|
|
||||||
class AccessNotificationModalTemplateComponentModel
|
class AccessNotificationModalTemplateComponentModel
|
||||||
extends FlutterFlowModel<AccessNotificationModalTemplateComponentWidget> {
|
extends FlutterFlowModel<AccessNotificationModalTemplateComponentWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -33,15 +33,9 @@ class AccessNotificationModalTemplateComponentModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initDB() async {
|
Future<void> initDB() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -3,7 +3,6 @@ import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'access_notification_modal_template_component_model.dart';
|
import 'access_notification_modal_template_component_model.dart';
|
||||||
export 'access_notification_modal_template_component_model.dart';
|
export 'access_notification_modal_template_component_model.dart';
|
||||||
|
|
||||||
|
@ -67,8 +66,6 @@ class _AccessNotificationModalTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
String labelTypeResident = FFLocalizations.of(context)
|
String labelTypeResident = FFLocalizations.of(context)
|
||||||
.getVariableText(enText: 'Resident', ptText: 'Morador');
|
.getVariableText(enText: 'Resident', ptText: 'Morador');
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,12 @@ export 'card_item_template_component_model.dart';
|
||||||
|
|
||||||
class CardItemTemplateComponentWidget extends StatefulWidget {
|
class CardItemTemplateComponentWidget extends StatefulWidget {
|
||||||
const CardItemTemplateComponentWidget({
|
const CardItemTemplateComponentWidget({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.labelsHashMap,
|
required this.labelsHashMap,
|
||||||
required this.statusHashMap,
|
required this.statusHashMap,
|
||||||
required this.imagePath,
|
required this.imagePath,
|
||||||
required this.onTapCardItemAction,
|
required this.onTapCardItemAction,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final Map<String, String>? labelsHashMap;
|
final Map<String, String>? labelsHashMap;
|
||||||
final List<Map<String, Color>?> statusHashMap;
|
final List<Map<String, Color>?> statusHashMap;
|
||||||
|
@ -208,8 +208,6 @@ class _CardItemTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
focusColor: Colors.transparent,
|
focusColor: Colors.transparent,
|
||||||
|
|
|
@ -26,10 +26,12 @@ class PassKeyTemplateComponentModel
|
||||||
ptText: 'Este campo é obrigatório',
|
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',
|
enText: 'This field must have at least 4 characters',
|
||||||
ptText: 'Este campo deve ter pelo menos 4 caracteres',
|
ptText: 'Este campo deve ter pelo menos 4 caracteres',
|
||||||
);
|
);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.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_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -129,7 +131,7 @@ class _PassKeyTemplateWidgetState extends State<PassKeyTemplateWidget> {
|
||||||
child: Text(
|
child: Text(
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
enText: 'INSERT PASSWORD',
|
enText: 'INSERT PASSWORD',
|
||||||
ptText: AppState().accessPass != ''
|
ptText: StorageUtil().accessPass != ''
|
||||||
? 'ALTERAR SENHA'
|
? 'ALTERAR SENHA'
|
||||||
: 'ADICIONAR SENHA',
|
: 'ADICIONAR SENHA',
|
||||||
),
|
),
|
||||||
|
@ -316,9 +318,12 @@ class _PassKeyTemplateWidgetState extends State<PassKeyTemplateWidget> {
|
||||||
context.pop(true);
|
context.pop(true);
|
||||||
},
|
},
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
ptText:
|
ptText: StorageUtil().accessPass != ''
|
||||||
AppState().accessPass != '' ? 'Alterar' : 'Adicionar',
|
? 'Alterar'
|
||||||
enText: AppState().accessPass != '' ? 'Change' : 'Add',
|
: 'Adicionar',
|
||||||
|
enText: StorageUtil().accessPass != ''
|
||||||
|
? 'Change'
|
||||||
|
: 'Add',
|
||||||
),
|
),
|
||||||
options: FFButtonOptions(
|
options: FFButtonOptions(
|
||||||
width: 270.0,
|
width: 270.0,
|
||||||
|
|
|
@ -64,7 +64,6 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
// CachedNetworkImage.evictFromCache(widget.imagePath ?? '');
|
// CachedNetworkImage.evictFromCache(widget.imagePath ?? '');
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.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 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
import '/backend/api_requests/api_calls.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_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/flutter_flow/flutter_flow_widgets.dart';
|
import '/flutter_flow/flutter_flow_widgets.dart';
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
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/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/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/helpers/db_helper.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
class LiberationHistoryItemDetailsTemplateComponentModel
|
class LiberationHistoryItemDetailsTemplateComponentModel
|
||||||
extends FlutterFlowModel<
|
extends FlutterFlowModel<
|
||||||
LiberationHistoryItemDetailsTemplateComponentWidget> {
|
LiberationHistoryItemDetailsTemplateComponentWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -31,15 +28,9 @@ class LiberationHistoryItemDetailsTemplateComponentModel
|
||||||
void initState(BuildContext context) {}
|
void initState(BuildContext context) {}
|
||||||
|
|
||||||
Future<void> initDatabase() async {
|
Future<void> initDatabase() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/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/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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class LiberationHistoryItemDetailsTemplateComponentWidget
|
class LiberationHistoryItemDetailsTemplateComponentWidget
|
||||||
extends StatefulWidget {
|
extends StatefulWidget {
|
||||||
|
@ -68,8 +65,6 @@ class _LiberationHistoryItemDetailsTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Align(
|
return Align(
|
||||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
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/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/flutter_flow_model.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
|
||||||
|
|
||||||
class MessageNotificationModalTemplateComponentModel
|
class MessageNotificationModalTemplateComponentModel
|
||||||
extends FlutterFlowModel<MessageNotificationModalTemplateComponentWidget> {
|
extends FlutterFlowModel<MessageNotificationModalTemplateComponentWidget> {
|
||||||
|
|
|
@ -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/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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class MessageNotificationModalTemplateComponentWidget extends StatefulWidget {
|
class MessageNotificationModalTemplateComponentWidget extends StatefulWidget {
|
||||||
const MessageNotificationModalTemplateComponentWidget({
|
const MessageNotificationModalTemplateComponentWidget({
|
||||||
|
@ -59,8 +58,6 @@ class _MessageNotificationModalTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
|
|
|
@ -2,12 +2,11 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
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/components/templates_components/provisional_schedule_template/provisional_shcedule_template_widget.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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
|
class ScheduleProvisionalVisitPageModel
|
||||||
extends FlutterFlowModel<ScheduleProvisionalVisitPageWidget> {
|
extends FlutterFlowModel<ScheduleProvisionalVisitPageWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
String cliUUID = '';
|
String cliUUID = '';
|
||||||
String devUUID = '';
|
String devUUID = '';
|
||||||
String userUUID = '';
|
String userUUID = '';
|
||||||
|
@ -125,11 +124,11 @@ class ScheduleProvisionalVisitPageModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
cliUUID = await db.get(key: 'cliUUID', field: 'value');
|
cliUUID = StorageUtil().cliUUID;
|
||||||
devUUID = await db.get(key: 'devUUID', field: 'value');
|
devUUID = StorageUtil().devUUID;
|
||||||
userUUID = await db.get(key: 'userUUID', field: 'value');
|
userUUID = StorageUtil().userUUID;
|
||||||
cliName = await db.get(key: 'cliName', field: 'value');
|
cliName = StorageUtil().cliName;
|
||||||
ownerUUID = await db.get(key: 'ownerUUID', field: 'value');
|
ownerUUID = StorageUtil().ownerUUID;
|
||||||
setState?.call();
|
setState?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:google_fonts/google_fonts.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_schedule_template_model.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '/backend/api_requests/api_calls.dart';
|
import '/backend/api_requests/api_calls.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
|
@ -42,8 +40,6 @@ class _ScheduleProvisionalVisitPageWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
onTap: () => FocusScope.of(context).unfocus(),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
|
|
@ -21,10 +21,12 @@ class QrCodePassKeyTemplateComponentModel
|
||||||
ptText: 'Este campo é obrigatório',
|
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',
|
enText: 'This field must be at least 4 characters',
|
||||||
ptText: 'Este campo deve ter pelo menos 4 caracteres',
|
ptText: 'Este campo deve ter pelo menos 4 caracteres',
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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 'package:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
import '/backend/api_requests/api_calls.dart';
|
import '/backend/api_requests/api_calls.dart';
|
||||||
|
@ -12,7 +13,6 @@ import 'regisiter_vistor_template_component_widget.dart';
|
||||||
class RegisiterVistorTemplateComponentModel
|
class RegisiterVistorTemplateComponentModel
|
||||||
extends FlutterFlowModel<RegisiterVistorTemplateComponentWidget> {
|
extends FlutterFlowModel<RegisiterVistorTemplateComponentWidget> {
|
||||||
Timer? _debounceTimer;
|
Timer? _debounceTimer;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -135,9 +135,9 @@ class RegisiterVistorTemplateComponentModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initializeDatabase() async {
|
Future<void> initializeDatabase() async {
|
||||||
devUUID = await db.get(key: 'devUUID', field: 'value');
|
devUUID = StorageUtil().devUUID;
|
||||||
userUUID = await db.get(key: 'userUUID', field: 'value');
|
userUUID = StorageUtil().userUUID;
|
||||||
cliUUID = await db.get(key: 'cliUUID', field: 'value');
|
cliUUID = StorageUtil().cliUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -68,7 +68,7 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
_model.textController4 ??= TextEditingController();
|
_model.textController4 ??= TextEditingController();
|
||||||
_model.textFieldFocusNode4 ??= FocusNode();
|
_model.textFieldFocusNode4 ??= FocusNode();
|
||||||
|
|
||||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
_model.textController2.text = widget.doc ?? '';
|
_model.textController2.text = widget.doc ?? '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,6 @@ class _RegisiterVistorTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
return Align(
|
return Align(
|
||||||
alignment: const AlignmentDirectional(0.0, 1.0),
|
alignment: const AlignmentDirectional(0.0, 1.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
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/nav/nav.dart';
|
||||||
import 'package:hub/flutter_flow/random_data_util.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/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/device_util.dart';
|
import 'package:hub/shared/utils/device_util.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_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 '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'sign_in_template_component_widget.dart'
|
import 'sign_in_template_component_widget.dart'
|
||||||
|
@ -86,9 +86,8 @@ class SignInTemplateComponentModel
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final ApiCallResponse? response;
|
final ApiCallResponse? response;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
final LoginCall callback = PhpGroup.loginCall;
|
final LoginCall callback = PhpGroup.loginCall;
|
||||||
AppState().deviceDescription = randomString(
|
StorageUtil().deviceDescription = randomString(
|
||||||
10,
|
10,
|
||||||
10,
|
10,
|
||||||
true,
|
true,
|
||||||
|
@ -111,28 +110,27 @@ class SignInTemplateComponentModel
|
||||||
devUUID = await DeviceUtil.getDevUUID();
|
devUUID = await DeviceUtil.getDevUUID();
|
||||||
|
|
||||||
if ((email != '') && (passwd != '')) {
|
if ((email != '') && (passwd != '')) {
|
||||||
AppState().email = email;
|
StorageUtil().email = email;
|
||||||
AppState().passwd = passwd;
|
StorageUtil().passwd = passwd;
|
||||||
|
StorageUtil().devUUID = devUUID!;
|
||||||
response = await callback.call();
|
response = await callback.call();
|
||||||
|
|
||||||
if (response.jsonBody['error'] == false) {
|
if (response.jsonBody['error'] == false) {
|
||||||
|
|
||||||
userUUID = response.jsonBody['uid'];
|
userUUID = response.jsonBody['uid'];
|
||||||
|
|
||||||
status = response.jsonBody['user']['status'];
|
status = response.jsonBody['user']['status'];
|
||||||
userDevUUID = response.jsonBody['user']['dev_id'];
|
userDevUUID = response.jsonBody['user']['dev_id'];
|
||||||
userName = response.jsonBody['user']['name'];
|
userName = response.jsonBody['user']['name'];
|
||||||
|
|
||||||
db.update('devUUID', devUUID, 'user');
|
StorageUtil().userUUID = userUUID;
|
||||||
db.update('userUUID', userUUID, 'user');
|
StorageUtil().userDevUUID = userDevUUID;
|
||||||
db.update('userDevUUID', userDevUUID, 'user');
|
StorageUtil().status = status;
|
||||||
db.update('status', status, 'user');
|
StorageUtil().userName = userName;
|
||||||
db.update('userName', userName, 'user');
|
|
||||||
|
|
||||||
isLogged = true;
|
isLogged = true;
|
||||||
await checkLocals(context: context, model: model).then((value) {
|
await checkLocals(context: context, model: model).then((value) {
|
||||||
AppState().haveLocal = value;
|
StorageUtil().haveLocal = value;
|
||||||
AppState().isLogged = isLogged;
|
StorageUtil().isLogged = isLogged;
|
||||||
AppState().update(() {});
|
|
||||||
toggleApp(context);
|
toggleApp(context);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -154,7 +152,7 @@ class SignInTemplateComponentModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future toggleApp(BuildContext context) async {
|
Future toggleApp(BuildContext context) async {
|
||||||
final haveLocal = AppState().haveLocal;
|
final haveLocal = StorageUtil().haveLocal;
|
||||||
if (haveLocal == true) {
|
if (haveLocal == true) {
|
||||||
context.go('/homePage');
|
context.go('/homePage');
|
||||||
} else if (haveLocal == false) {
|
} else if (haveLocal == false) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
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/flutter_flow/random_data_util.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_util.dart';
|
import 'package:hub/shared/utils/log_util.dart';
|
||||||
|
|
|
@ -4,6 +4,8 @@ import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/components/atomic_components/shared_components_atoms/atom_image_svg_theme.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/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:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -104,7 +106,7 @@ class _SignUpTemplateComponentWidgetState
|
||||||
final double screenWidth = mediaQuery.size.width;
|
final double screenWidth = mediaQuery.size.width;
|
||||||
final double screenHeight = mediaQuery.size.height;
|
final double screenHeight = mediaQuery.size.height;
|
||||||
|
|
||||||
bool _isFormInvalid() {
|
bool isFormInvalid() {
|
||||||
if (_model.nameRegisterFormTextController.text == '' ||
|
if (_model.nameRegisterFormTextController.text == '' ||
|
||||||
_model.emailRegisterFormTextController.text == '' ||
|
_model.emailRegisterFormTextController.text == '' ||
|
||||||
_model.passwordRegisterFormTextController.text == '') {
|
_model.passwordRegisterFormTextController.text == '') {
|
||||||
|
@ -124,8 +126,6 @@ class _SignUpTemplateComponentWidgetState
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
|
@ -685,7 +685,7 @@ class _SignUpTemplateComponentWidgetState
|
||||||
padding: const EdgeInsetsDirectional
|
padding: const EdgeInsetsDirectional
|
||||||
.fromSTEB(0.0, 0.0, 0.0, 16.0),
|
.fromSTEB(0.0, 0.0, 0.0, 16.0),
|
||||||
child: FFButtonWidget(
|
child: FFButtonWidget(
|
||||||
onPressed: _isFormInvalid()
|
onPressed: isFormInvalid()
|
||||||
? null
|
? null
|
||||||
: () async {
|
: () async {
|
||||||
var shouldSetState = false;
|
var shouldSetState = false;
|
||||||
|
@ -702,7 +702,8 @@ class _SignUpTemplateComponentWidgetState
|
||||||
.emailRegisterFormTextController
|
.emailRegisterFormTextController
|
||||||
.text,
|
.text,
|
||||||
device:
|
device:
|
||||||
AppState().deviceType,
|
StorageUtil()
|
||||||
|
.deviceType,
|
||||||
);
|
);
|
||||||
shouldSetState = true;
|
shouldSetState = true;
|
||||||
if (_model.signUp == true) {
|
if (_model.signUp == true) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:hub/shared/helpers/db_helper.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 '/backend/api_requests/api_calls.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
@ -6,7 +7,6 @@ import 'view_visit_detail_widget.dart' show ViewVisitDetailWidget;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> {
|
class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -37,15 +37,9 @@ class ViewVisitDetailModel extends FlutterFlowModel<ViewVisitDetailWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initializeDatabase() async {
|
Future<void> initializeDatabase() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
import '/backend/api_requests/api_calls.dart';
|
import '/backend/api_requests/api_calls.dart';
|
||||||
|
@ -121,8 +120,6 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
||||||
var filteredVisitorJsonList =
|
var filteredVisitorJsonList =
|
||||||
findVisitorById(widget.visitorJsonList, widget.visitIdStr) ?? 'null';
|
findVisitorById(widget.visitorJsonList, widget.visitIdStr) ?? 'null';
|
||||||
|
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 200.0, 0.0, 0.0),
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 200.0, 0.0, 0.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart';
|
import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart';
|
||||||
|
|
|
@ -3,11 +3,11 @@ import 'package:hub/components/templates_components/visitor_search_modal_templat
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
class VisitorSearchModalTemplateComponentModel
|
class VisitorSearchModalTemplateComponentModel
|
||||||
extends FlutterFlowModel<VisitorSearchModalTemplateComponentWidget> {
|
extends FlutterFlowModel<VisitorSearchModalTemplateComponentWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -40,15 +40,9 @@ class VisitorSearchModalTemplateComponentModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initDatabase() async {
|
Future<void> initDatabase() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -59,8 +59,6 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -181,7 +179,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (_model.visitors.isNotEmpty && _model.visitors.length > 0)
|
if (_model.visitors.isNotEmpty && _model.visitors.isNotEmpty)
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
|
|
@ -6,7 +6,6 @@ import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import '/flutter_flow/flutter_flow_widgets.dart';
|
import '/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_animate/flutter_animate.dart';
|
import 'package:flutter_animate/flutter_animate.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'welcome_template_component_model.dart';
|
import 'welcome_template_component_model.dart';
|
||||||
export 'welcome_template_component_model.dart';
|
export 'welcome_template_component_model.dart';
|
||||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'form_field_controller.dart';
|
import 'form_field_controller.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class FlutterFlowDropDown<T> extends StatefulWidget {
|
class FlutterFlowDropDown<T> extends StatefulWidget {
|
||||||
const FlutterFlowDropDown({
|
const FlutterFlowDropDown({
|
||||||
|
|
|
@ -10,6 +10,8 @@ import 'package:hub/pages/pets_page/pets_page_widget.dart';
|
||||||
import 'package:hub/pages/provisional_schedule_page/provisional_schedule_widget.dart';
|
import 'package:hub/pages/provisional_schedule_page/provisional_schedule_widget.dart';
|
||||||
import 'package:hub/pages/reception_page/reception_page_widget.dart';
|
import 'package:hub/pages/reception_page/reception_page_widget.dart';
|
||||||
import 'package:hub/pages/reservation_page/reservation_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 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '/backend/schema/structs/index.dart';
|
import '/backend/schema/structs/index.dart';
|
||||||
|
@ -72,8 +74,8 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
|
||||||
FFRoute(
|
FFRoute(
|
||||||
name: '_initialize',
|
name: '_initialize',
|
||||||
path: '/',
|
path: '/',
|
||||||
builder: (context, _) => AppState().isLogged
|
builder: (context, _) => StorageUtil().isLogged
|
||||||
? AppState().haveLocal == true
|
? StorageUtil().haveLocal == true
|
||||||
? const HomePageWidget()
|
? const HomePageWidget()
|
||||||
: const ReceptionPageWidget()
|
: const ReceptionPageWidget()
|
||||||
: const WelcomePageWidget(),
|
: const WelcomePageWidget(),
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
const kPermissionStateToBool = {
|
const kPermissionStateToBool = {
|
||||||
|
|
211
lib/main.dart
211
lib/main.dart
|
@ -12,32 +12,61 @@ import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:flutter_web_plugins/url_strategy.dart';
|
import 'package:flutter_web_plugins/url_strategy.dart';
|
||||||
import 'package:hub/backend/notifications/notification_service.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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/secure_storage_helper.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:responsive_framework/responsive_framework.dart';
|
import 'package:responsive_framework/responsive_framework.dart';
|
||||||
|
|
||||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
Future<void> initializeApp() async {
|
|
||||||
|
|
||||||
|
void main() async {
|
||||||
|
await _initializeApp();
|
||||||
|
runApp(const App());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Future<void> _initializeApp() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await DatabaseHelper().database;
|
await _initializeStorageHelpers();
|
||||||
|
await _initializeTracking();
|
||||||
|
await _initializeFirebase();
|
||||||
|
await _initializeNotificationService();
|
||||||
|
_initializeUrlStrategy();
|
||||||
|
_initializeSystemSettings();
|
||||||
|
await _initializeFlutterFlow();
|
||||||
|
}
|
||||||
|
|
||||||
final status = await AppTrackingTransparency.requestTrackingAuthorization();
|
|
||||||
|
|
||||||
final appState = AppState();
|
|
||||||
await appState.initializePersistedState();
|
|
||||||
|
|
||||||
if (AppState().firstRun == true) {
|
|
||||||
AppState().deleteAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
Future<void> _initializeStorageHelpers() async {
|
||||||
|
await StorageUtil().ensureInitialization();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _initializeTracking() async {
|
||||||
|
await AppTrackingTransparency.requestTrackingAuthorization();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _initializeFirebase() async {
|
||||||
await Firebase.initializeApp();
|
await Firebase.initializeApp();
|
||||||
await NotificationService.initialize();
|
}
|
||||||
|
|
||||||
|
Future<void> _initializeNotificationService() async {
|
||||||
|
await NotificationService.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _initializeUrlStrategy() {
|
||||||
setUrlStrategy(const PathUrlStrategy());
|
setUrlStrategy(const PathUrlStrategy());
|
||||||
|
}
|
||||||
|
|
||||||
|
void _initializeSystemSettings() {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
log("Aplicativo em Debug Mode, crashlytics desabilitado!");
|
log("Aplicativo em Debug Mode, crashlytics desabilitado!");
|
||||||
|
@ -47,17 +76,19 @@ Future<void> initializeApp() async {
|
||||||
FlutterError.onError = crashlyticsInstance.recordFlutterError;
|
FlutterError.onError = crashlyticsInstance.recordFlutterError;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _initializeFlutterFlow() async {
|
||||||
await FlutterFlowTheme.initialize();
|
await FlutterFlowTheme.initialize();
|
||||||
await FFLocalizations.initialize();
|
await FFLocalizations.initialize();
|
||||||
GoRouter.optionURLReflectsImperativeAPIs = true;
|
GoRouter.optionURLReflectsImperativeAPIs = true;
|
||||||
usePathUrlStrategy();
|
usePathUrlStrategy();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> foregroundHandleMessage(RemoteMessage message) async {
|
Future<void> _foregroundHandleMessage(RemoteMessage message) async {
|
||||||
if (message.data['click_action'] == 'enroll_cond') {
|
if (message.data['click_action'] == 'enroll_cond') {
|
||||||
AppState().haveLocal = true;
|
StorageUtil().haveLocal = true;
|
||||||
AppState().context!.go('/homePage');
|
StorageUtil().context?.go('/homePage');
|
||||||
}
|
}
|
||||||
if (!Platform.isIOS) {
|
if (!Platform.isIOS) {
|
||||||
NotificationService.show(
|
NotificationService.show(
|
||||||
|
@ -69,20 +100,17 @@ Future<void> foregroundHandleMessage(RemoteMessage message) async {
|
||||||
|
|
||||||
Future<void> _backgroundHandleMessage(RemoteMessage message) async {
|
Future<void> _backgroundHandleMessage(RemoteMessage message) async {
|
||||||
if (message.data['click_action'] == 'enroll_cond') {
|
if (message.data['click_action'] == 'enroll_cond') {
|
||||||
AppState().haveLocal = true;
|
StorageUtil().haveLocal = true;
|
||||||
AppState().context!.go('/homePage');
|
StorageUtil().context?.go('/homePage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() async {
|
|
||||||
await initializeApp();
|
|
||||||
runApp(const App());
|
|
||||||
}
|
|
||||||
|
|
||||||
class App extends StatefulWidget {
|
class App extends StatefulWidget {
|
||||||
const App({super.key});
|
const App({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<App> createState() => _AppState();
|
State<App> createState() => _AppState();
|
||||||
|
|
||||||
static _AppState of(BuildContext context) =>
|
static _AppState of(BuildContext context) =>
|
||||||
context.findAncestorStateOfType<_AppState>()!;
|
context.findAncestorStateOfType<_AppState>()!;
|
||||||
}
|
}
|
||||||
|
@ -94,30 +122,86 @@ class _AppState extends State<App> {
|
||||||
late GoRouter _router;
|
late GoRouter _router;
|
||||||
bool displaySplashImage = true;
|
bool displaySplashImage = true;
|
||||||
|
|
||||||
|
final ThemeData _darkTheme = ThemeData(
|
||||||
|
brightness: Brightness.dark,
|
||||||
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
|
thumbVisibility: WidgetStateProperty.all(false),
|
||||||
|
interactive: false,
|
||||||
|
thumbColor: WidgetStateProperty.resolveWith((states) {
|
||||||
|
if (states.contains(WidgetState.dragged)) {
|
||||||
|
return const Color(0xff1aab5f);
|
||||||
|
}
|
||||||
|
if (states.contains(WidgetState.hovered)) {
|
||||||
|
return const Color(0xff1aab5f);
|
||||||
|
}
|
||||||
|
return const Color(0xff1aab5f);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final ThemeData _theme = ThemeData(
|
||||||
|
brightness: Brightness.light,
|
||||||
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
|
thumbVisibility: WidgetStateProperty.all(false),
|
||||||
|
interactive: false,
|
||||||
|
thumbColor: WidgetStateProperty.resolveWith((states) {
|
||||||
|
if (states.contains(WidgetState.dragged)) {
|
||||||
|
return const Color(0xff1aab5f);
|
||||||
|
}
|
||||||
|
if (states.contains(WidgetState.hovered)) {
|
||||||
|
return const Color(0xff1aab5f);
|
||||||
|
}
|
||||||
|
return const Color(0xff1aab5f);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
final Iterable<LocalizationsDelegate<dynamic>>? localizationsDelegates = const [
|
||||||
|
FFLocalizationsDelegate(),
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
];
|
||||||
|
|
||||||
|
final Iterable<Locale> supportedLocales = const [
|
||||||
|
Locale('pt'),
|
||||||
|
Locale('en'),
|
||||||
|
];
|
||||||
|
|
||||||
|
Widget Function(BuildContext, Widget?)? builder = (context, widget) {
|
||||||
|
final breakpoints = [
|
||||||
|
const Breakpoint(start: 0, end: 450, name: MOBILE),
|
||||||
|
const Breakpoint(start: 451, end: 800, name: TABLET),
|
||||||
|
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
|
||||||
|
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
|
||||||
|
];
|
||||||
|
return ResponsiveBreakpoints.builder(
|
||||||
|
child: BouncingScrollWrapper.builder(context, widget!),
|
||||||
|
breakpoints: breakpoints,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(true);
|
||||||
// WidgetsFlutterBinding.ensureInitialized().addPostFrameCallback((_) => initializeTracking());
|
|
||||||
|
|
||||||
_appStateNotifier = AppStateNotifier.instance;
|
_appStateNotifier = AppStateNotifier.instance;
|
||||||
_router = createRouter(_appStateNotifier);
|
_router = createRouter(_appStateNotifier);
|
||||||
Future.delayed(const Duration(milliseconds: 1000),
|
Future.delayed(const Duration(milliseconds: 1000),
|
||||||
() => setState(() => _appStateNotifier.stopShowingSplashImage()));
|
() => setState(() => _appStateNotifier.stopShowingSplashImage()));
|
||||||
|
FirebaseMessaging.onMessage.listen(_foregroundHandleMessage);
|
||||||
FirebaseMessaging.onMessage.listen(foregroundHandleMessage);
|
|
||||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
||||||
onMessageReceived(message.data, message.notification!.body,
|
onMessageReceived(message.data, message.notification!.body,
|
||||||
message.data['click_action']);
|
message.data['click_action']);
|
||||||
});
|
});
|
||||||
FirebaseMessaging.onBackgroundMessage(_backgroundHandleMessage);
|
FirebaseMessaging.onBackgroundMessage(_backgroundHandleMessage);
|
||||||
|
|
||||||
FirebaseMessaging.instance.getInitialMessage().then((message) {
|
FirebaseMessaging.instance.getInitialMessage().then((message) {
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
_backgroundHandleMessage(message);
|
_backgroundHandleMessage(message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLocale(String language) {
|
void setLocale(String language) {
|
||||||
|
@ -134,67 +218,16 @@ class _AppState extends State<App> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MultiProvider(
|
return MaterialApp.router(
|
||||||
providers: [
|
title: 'FRE ACCESS HUB',
|
||||||
ChangeNotifierProvider(create: (_) => AppState()),
|
builder: builder,
|
||||||
],
|
localizationsDelegates: localizationsDelegates,
|
||||||
child: MaterialApp.router(
|
locale: _locale,
|
||||||
title: 'FRE ACCESS HUB',
|
supportedLocales: supportedLocales,
|
||||||
builder: (context, widget) => ResponsiveBreakpoints.builder(
|
theme: _theme,
|
||||||
child: BouncingScrollWrapper.builder(context, widget!),
|
darkTheme: _darkTheme,
|
||||||
breakpoints: [
|
themeMode: _themeMode,
|
||||||
const Breakpoint(start: 0, end: 450, name: MOBILE),
|
routerConfig: _router,
|
||||||
const Breakpoint(start: 451, end: 800, name: TABLET),
|
|
||||||
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
|
|
||||||
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
localizationsDelegates: const [
|
|
||||||
FFLocalizationsDelegate(),
|
|
||||||
GlobalMaterialLocalizations.delegate,
|
|
||||||
GlobalWidgetsLocalizations.delegate,
|
|
||||||
GlobalCupertinoLocalizations.delegate,
|
|
||||||
],
|
|
||||||
locale: _locale,
|
|
||||||
supportedLocales: const [
|
|
||||||
Locale('pt'),
|
|
||||||
Locale('en'),
|
|
||||||
],
|
|
||||||
theme: ThemeData(
|
|
||||||
brightness: Brightness.light,
|
|
||||||
scrollbarTheme: ScrollbarThemeData(
|
|
||||||
thumbVisibility: WidgetStateProperty.all(false),
|
|
||||||
interactive: false,
|
|
||||||
thumbColor: WidgetStateProperty.resolveWith((states) {
|
|
||||||
if (states.contains(WidgetState.dragged)) {
|
|
||||||
return const Color(0xff1aab5f);
|
|
||||||
}
|
|
||||||
if (states.contains(WidgetState.hovered)) {
|
|
||||||
return const Color(0xff1aab5f);
|
|
||||||
}
|
|
||||||
return const Color(0xff1aab5f);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
darkTheme: ThemeData(
|
|
||||||
brightness: Brightness.dark,
|
|
||||||
scrollbarTheme: ScrollbarThemeData(
|
|
||||||
thumbVisibility: WidgetStateProperty.all(false),
|
|
||||||
interactive: false,
|
|
||||||
thumbColor: WidgetStateProperty.resolveWith((states) {
|
|
||||||
if (states.contains(WidgetState.dragged)) {
|
|
||||||
return const Color(0xff1aab5f);
|
|
||||||
}
|
|
||||||
if (states.contains(WidgetState.hovered)) {
|
|
||||||
return const Color(0xff1aab5f);
|
|
||||||
}
|
|
||||||
return const Color(0xff1aab5f);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
themeMode: _themeMode,
|
|
||||||
routerConfig: _router,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ import 'package:hub/components/molecular_components/message_opt_modal/opt_modal_
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/flutter_flow/request_manager.dart';
|
import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
import 'package:hub/pages/acess_history_page/acess_history_page_widget.dart';
|
import 'package:hub/pages/acess_history_page/acess_history_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {
|
class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -34,15 +34,9 @@ class AcessHistoryPageModel extends FlutterFlowModel<AccessHistoryScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initDatabase() async {
|
Future<void> initDatabase() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -199,7 +199,7 @@ class _AccessHistoryState extends State<AccessHistoryScreen> {
|
||||||
return personTypeMatches;
|
return personTypeMatches;
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
if (filteredAccess != null && filteredAccess.isNotEmpty) {
|
if (filteredAccess.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_accessWrap.addAll(filteredAccess);
|
_accessWrap.addAll(filteredAccess);
|
||||||
_hasData = true;
|
_hasData = true;
|
||||||
|
@ -221,6 +221,7 @@ class _AccessHistoryState extends State<AccessHistoryScreen> {
|
||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showNoMoreDataSnackbar(BuildContext context) {
|
void _showNoMoreDataSnackbar(BuildContext context) {
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/components/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/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_icon_button.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
|
||||||
|
@ -31,7 +29,6 @@ class _DeliveryScheduleState extends State<DeliverySchedule> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
|
|
@ -6,12 +6,16 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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:hub/shared/utils/webview_util.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
class FastPassPageWidget extends StatefulWidget {
|
class FastPassPageWidget extends StatefulWidget {
|
||||||
|
const FastPassPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_FastPassPageWidgetState createState() => _FastPassPageWidgetState();
|
_FastPassPageWidgetState createState() => _FastPassPageWidgetState();
|
||||||
}
|
}
|
||||||
|
@ -19,32 +23,17 @@ class FastPassPageWidget extends StatefulWidget {
|
||||||
class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
||||||
late InAppWebViewController _controllerIOS;
|
late InAppWebViewController _controllerIOS;
|
||||||
late WebViewController _controllerAll;
|
late WebViewController _controllerAll;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
Future<Map<String, String>> initVariables() async {
|
Future<Map<String, String>> initVariables() async {
|
||||||
final email = AppState().email;
|
final email = StorageUtil().email;
|
||||||
final name = await db
|
final name = StorageUtil().userName;
|
||||||
.get(key: 'userName', field: 'value')
|
final userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
final devUUID = StorageUtil().devUUID;
|
||||||
final userUUID = await db
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
.get(key: 'userUUID', field: 'value')
|
const createdAt = '0000-00-00 00:00:00';
|
||||||
.then((value) => value.toString());
|
|
||||||
final devUUID = await db
|
|
||||||
.get(key: 'devUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final createdAt = await db
|
|
||||||
.get(key: 'devUUID', field: 'createdAt')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final url = 'https://hub.freaccess.com.br/hub/fast-pass/$cliUUID';
|
final url = 'https://hub.freaccess.com.br/hub/fast-pass/$cliUUID';
|
||||||
final freUserData = "{\"name\": \"$name\", " +
|
final freUserData =
|
||||||
"\"email\": \"$email\"," +
|
"{\"name\": \"$name\", \"email\": \"$email\",\"dev_id\": \"$devUUID\",\"created_at\":\"$createdAt\",\"updated_at\": \"0000-00-00 00:00:00\",\"status\": \"A\" }";
|
||||||
"\"dev_id\": \"$devUUID\"," +
|
|
||||||
"\"created_at\": \"$createdAt\"," +
|
|
||||||
"\"updated_at\": \"0000-00-00 00:00:00\"," +
|
|
||||||
"\"status\": \"A\" }";
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'url': url,
|
'url': url,
|
||||||
|
@ -158,7 +147,7 @@ class _FastPassPageWidgetState extends State<FastPassPageWidget> {
|
||||||
..loadRequest(Uri.parse(url)),
|
..loadRequest(Uri.parse(url)),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Center(child: Text('Unexpected error'));
|
return const Center(child: Text('Unexpected error'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import 'package:flutter/material.dart';
|
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/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/menu_component/menu_component_model.dart';
|
||||||
import 'package:hub/components/organism_components/message_well_component/message_well_component_model.dart';
|
import 'package:hub/components/organism_components/message_well_component/message_well_component_model.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/pages/home_page/home_page_widget.dart';
|
import 'package:hub/pages/home_page/home_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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> {
|
class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
||||||
bool isGrid = false;
|
bool isGrid = false;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
|
@ -25,19 +25,11 @@ class HomePageModel extends FlutterFlowModel<HomePageWidget> {
|
||||||
late MessageWellComponentModel messageWellComponentModel;
|
late MessageWellComponentModel messageWellComponentModel;
|
||||||
|
|
||||||
Future<void> _initVariable() async {
|
Future<void> _initVariable() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
cliUUID = StorageUtil().cliUUID;
|
||||||
.then((value) => value.toString());
|
userUUID = StorageUtil().userUUID;
|
||||||
cliUUID = await db
|
userName = StorageUtil().cliName;
|
||||||
.get(key: 'cliUUID', field: 'value')
|
userEmail = StorageUtil().email;
|
||||||
.then((value) => value.toString());
|
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
userName = await db
|
|
||||||
.get(key: 'userName', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
userEmail = AppState().email;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -11,11 +11,13 @@ 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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/pages/home_page/home_page_model.dart';
|
import 'package:hub/pages/home_page/home_page_model.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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';
|
import 'package:hub/shared/widgets/drawer_widget/drawer_widget.dart';
|
||||||
|
|
||||||
class HomePageWidget extends StatefulWidget {
|
class HomePageWidget extends StatefulWidget {
|
||||||
const HomePageWidget({Key? key}) : super(key: key);
|
const HomePageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HomePageWidget> createState() => _HomePageWidgetState();
|
State<HomePageWidget> createState() => _HomePageWidgetState();
|
||||||
|
@ -25,7 +27,6 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
late HomePageModel _model;
|
late HomePageModel _model;
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
late LocalProfileComponentWidget _localProfileComponentWidget;
|
late LocalProfileComponentWidget _localProfileComponentWidget;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
_HomePageWidgetState() {
|
_HomePageWidgetState() {
|
||||||
_localProfileComponentWidget = LocalProfileComponentWidget();
|
_localProfileComponentWidget = LocalProfileComponentWidget();
|
||||||
|
@ -52,7 +53,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
AppState().context = context;
|
StorageUtil().context = context;
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
onTap: () => _model.unfocusNode.canRequestFocus
|
||||||
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
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/flutter_flow_model.dart';
|
||||||
import 'package:hub/flutter_flow/request_manager.dart';
|
import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/pages/liberation_history/liberation_history_widget.dart';
|
import 'package:hub/pages/liberation_history/liberation_history_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -39,15 +38,9 @@ class LiberationHistoryModel extends FlutterFlowModel<LiberationHistoryWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliName;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future answersRequest(
|
Future answersRequest(
|
||||||
|
|
|
@ -90,7 +90,6 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
@ -332,7 +331,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
|
|
||||||
final List<dynamic> requests = response.jsonBody['solicitacoes'] ?? [];
|
final List<dynamic> requests = response.jsonBody['solicitacoes'] ?? [];
|
||||||
|
|
||||||
if (requests != null && requests.isNotEmpty) {
|
if (requests.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_requestWrap.addAll(requests);
|
_requestWrap.addAll(requests);
|
||||||
_hasData = true;
|
_hasData = true;
|
||||||
|
@ -359,6 +358,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showNoMoreDataSnackBar(BuildContext context) {
|
void _showNoMoreDataSnackBar(BuildContext context) {
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
||||||
import 'package:hub/flutter_flow/request_manager.dart';
|
import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/pages/message_history_page/message_history_page_widget.dart';
|
import 'package:hub/pages/message_history_page/message_history_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
|
|
||||||
class MessageHistoryPageModel
|
class MessageHistoryPageModel
|
||||||
extends FlutterFlowModel<MessageHistoryPageWidget> {
|
extends FlutterFlowModel<MessageHistoryPageWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -44,15 +43,9 @@ class MessageHistoryPageModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -85,7 +85,6 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
@ -106,7 +105,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
|
||||||
|
|
||||||
final List<dynamic> messages = response.jsonBody['mensagens'] ?? [];
|
final List<dynamic> messages = response.jsonBody['mensagens'] ?? [];
|
||||||
|
|
||||||
if (messages != null && messages.isNotEmpty) {
|
if (messages.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_messageWrap.addAll(messages);
|
_messageWrap.addAll(messages);
|
||||||
_hasData = true;
|
_hasData = true;
|
||||||
|
@ -132,6 +131,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
|
||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadMore() {
|
void _loadMore() {
|
||||||
|
|
|
@ -9,9 +9,10 @@ import 'package:hub/components/templates_components/details_component/details_co
|
||||||
import 'package:hub/flutter_flow/flutter_flow_icon_button.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/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_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:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:rxdart/rxdart.dart';
|
import 'package:rxdart/rxdart.dart';
|
||||||
|
|
||||||
|
@ -28,7 +29,6 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
||||||
final int _pageSize = 10;
|
final int _pageSize = 10;
|
||||||
bool _hasData = false;
|
bool _hasData = false;
|
||||||
bool _loading = false;
|
bool _loading = false;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
|
||||||
late Future<void> _orderFuture;
|
late Future<void> _orderFuture;
|
||||||
|
@ -64,9 +64,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initDatabase() async {
|
Future<void> initDatabase() async {
|
||||||
cliUUID = await db
|
cliUUID = StorageUtil().cliUUID;
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -102,7 +100,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
||||||
|
|
||||||
final List<dynamic> orders = response.jsonBody['value']['list'] ?? [];
|
final List<dynamic> orders = response.jsonBody['value']['list'] ?? [];
|
||||||
|
|
||||||
if (orders != null && orders.isNotEmpty) {
|
if (orders.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_orderList.addAll(orders);
|
_orderList.addAll(orders);
|
||||||
_hasData = true;
|
_hasData = true;
|
||||||
|
@ -128,6 +126,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadMoreOrders() {
|
void _loadMoreOrders() {
|
||||||
|
@ -416,7 +415,7 @@ class _PackageOrderPage extends State<PackageOrderPage> {
|
||||||
FlutterFlowTheme.of(context).primary,
|
FlutterFlowTheme.of(context).primary,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
buttons: [],
|
buttons: const [],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -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/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.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: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';
|
import '../../shared/utils/log_util.dart';
|
||||||
|
|
||||||
|
@ -41,8 +40,6 @@ class _PeopleOnThePropertyPageWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
|
|
@ -6,13 +6,14 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/pages/liberation_history/liberation_history_model.dart';
|
import 'package:hub/pages/liberation_history/liberation_history_model.dart';
|
||||||
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_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:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
class PetsHistoryScreen extends StatefulWidget {
|
class PetsHistoryScreen extends StatefulWidget {
|
||||||
PetsHistoryScreen({Key? key, required this.model}) : super(key: key);
|
const PetsHistoryScreen({super.key, required this.model});
|
||||||
|
|
||||||
final PetsPageModel model;
|
final PetsPageModel model;
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
||||||
final List<dynamic> pets = response.jsonBody['pets']['list'] ?? [];
|
final List<dynamic> pets = response.jsonBody['pets']['list'] ?? [];
|
||||||
safeSetState(() => count = response.jsonBody['pets']['count'] ?? 0);
|
safeSetState(() => count = response.jsonBody['pets']['count'] ?? 0);
|
||||||
|
|
||||||
if (pets != null && pets.isNotEmpty) {
|
if (pets.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_petsWrap.addAll(pets);
|
_petsWrap.addAll(pets);
|
||||||
_hasData = true;
|
_hasData = true;
|
||||||
|
@ -93,6 +94,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadMore() {
|
void _loadMore() {
|
||||||
|
@ -150,7 +152,7 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// Add your item here
|
// Add your item here
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(right: 30, top: 10),
|
padding: const EdgeInsets.only(right: 30, top: 10),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.model.petAmountRegister == '0'
|
widget.model.petAmountRegister == '0'
|
||||||
? FFLocalizations.of(context).getVariableText(
|
? FFLocalizations.of(context).getVariableText(
|
||||||
|
@ -232,30 +234,21 @@ class _PetsHistoryScreenState extends State<PetsHistoryScreen>
|
||||||
if (uItem['gender'] == "MAC")
|
if (uItem['gender'] == "MAC")
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Macho', enText: 'Male'): Color(0xFF094CB0),
|
ptText: 'Macho', enText: 'Male'): const Color(0xFF094CB0),
|
||||||
},
|
},
|
||||||
if (uItem['gender'] == "FEM")
|
if (uItem['gender'] == "FEM")
|
||||||
{
|
{
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Femêa',
|
ptText: 'Femêa',
|
||||||
enText: 'Female',
|
enText: 'Female',
|
||||||
): Color(0xFFE463E7),
|
): const Color(0xFFE463E7),
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
onTapCardItemAction: () async {
|
onTapCardItemAction: () async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final cliUUID = await db
|
final cliName = StorageUtil().cliName;
|
||||||
.get(key: 'cliUUID', field: 'value')
|
final devUUID = StorageUtil().devUUID;
|
||||||
.then((value) => value.toString());
|
final userUUID = StorageUtil().userUUID;
|
||||||
final cliName = await db
|
|
||||||
.get(key: 'cliName', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final devUUID = await db
|
|
||||||
.get(key: 'devUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
@ -12,14 +12,14 @@ import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/form_field_controller.dart';
|
import 'package:hub/flutter_flow/form_field_controller.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/pets_page/pets_page_widget.dart';
|
import 'package:hub/pages/pets_page/pets_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/image_util.dart';
|
import 'package:hub/shared/utils/image_util.dart';
|
||||||
import 'package:hub/shared/utils/log_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:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -103,18 +103,10 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
String? Function(BuildContext, String?)? textControllerObservationValidator;
|
String? Function(BuildContext, String?)? textControllerObservationValidator;
|
||||||
|
|
||||||
Future<void> initAsync() async {
|
Future<void> initAsync() async {
|
||||||
devUUID = await db.get(key: 'devUUID', field: 'value').then((value) {
|
devUUID = StorageUtil().devUUID;
|
||||||
return value.toString();
|
userUUID = StorageUtil().userUUID;
|
||||||
});
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db.get(key: 'userUUID', field: 'value').then((value) {
|
petAmountRegister = StorageUtil().petAmountRegister.toString();
|
||||||
return value.toString();
|
|
||||||
});
|
|
||||||
cliUUID = await db.get(key: 'cliUUID', field: 'value').then((value) {
|
|
||||||
return value.toString();
|
|
||||||
});
|
|
||||||
petAmountRegister = await db
|
|
||||||
.get(key: 'petAmountRegister', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
safeSetState?.call();
|
safeSetState?.call();
|
||||||
}
|
}
|
||||||
|
@ -275,7 +267,7 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
|
var img = await ImageUtils.convertImageFileToBase64(uploadedLocalFile!);
|
||||||
img = "base64;jpeg,$img";
|
img = "base64;jpeg,$img";
|
||||||
final url =
|
final url =
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${devUUID}&userUUID=${userUUID}&cliID=${cliUUID}&atividade=consultaFotoPet&petId=$petId';
|
'https://freaccess.com.br/freaccess/getImage.php?devUUID=$devUUID&userUUID=$userUUID&cliID=$cliUUID&atividade=consultaFotoPet&petId=$petId';
|
||||||
final response = await PhpGroup.updatePet.call(
|
final response = await PhpGroup.updatePet.call(
|
||||||
petID: petId,
|
petID: petId,
|
||||||
image: imgBase64,
|
image: imgBase64,
|
||||||
|
@ -556,15 +548,15 @@ class PetsPageModel extends FlutterFlowModel<PetsPageWidget> {
|
||||||
item['notes'] ?? '',
|
item['notes'] ?? '',
|
||||||
}),
|
}),
|
||||||
imagePath:
|
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: [
|
statusHashMap: [
|
||||||
if (item['gender'] == "MAC")
|
if (item['gender'] == "MAC")
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
item['name']: Color(0xFF094CB0),
|
item['name']: const Color(0xFF094CB0),
|
||||||
}),
|
}),
|
||||||
if (item['gender'] == "FEM")
|
if (item['gender'] == "FEM")
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
item['name']: Color(0xFFE463E7),
|
item['name']: const Color(0xFFE463E7),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:easy_debounce/easy_debounce.dart';
|
|
||||||
import 'package:flutter/material.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:google_fonts/google_fonts.dart';
|
||||||
import 'package:http/http.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/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_input.dart';
|
||||||
import 'package:hub/components/atomic_components/shared_components_atoms/custom_select.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';
|
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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.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/form_field_controller.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
|
||||||
import 'package:hub/flutter_flow/nav/nav.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_history_screen.dart';
|
||||||
import 'package:hub/pages/pets_page/pets_page_model.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/image_util.dart';
|
||||||
import 'package:hub/shared/utils/validator_util.dart';
|
import 'package:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:material_symbols_icons/symbols.dart';
|
import 'package:material_symbols_icons/symbols.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
|
||||||
|
|
||||||
class PetsPageWidget extends StatefulWidget {
|
class PetsPageWidget extends StatefulWidget {
|
||||||
dynamic pet;
|
dynamic pet;
|
||||||
|
|
|
@ -4,15 +4,14 @@ 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/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_theme.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_util.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/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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:share_plus/share_plus.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
|
||||||
|
|
||||||
class PreferencesPageModel with ChangeNotifier {
|
class PreferencesPageModel with ChangeNotifier {
|
||||||
final unfocusNode = FocusNode();
|
final unfocusNode = FocusNode();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
bool fingerprint = false;
|
bool fingerprint = false;
|
||||||
bool person = false;
|
bool person = false;
|
||||||
bool notify = false;
|
bool notify = false;
|
||||||
|
@ -24,7 +23,7 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> enablePerson(BuildContext context) async {
|
Future<void> enablePerson(BuildContext context) async {
|
||||||
final String userDevUUID = await db.get(key: 'userDevUUID', field: 'value');
|
final String userDevUUID = StorageUtil().userDevUUID;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
Share.share(
|
Share.share(
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
@ -69,7 +68,7 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
|
|
||||||
Future<void> toggleAccess(BuildContext context) async {
|
Future<void> toggleAccess(BuildContext context) async {
|
||||||
onChange(String key) async {
|
onChange(String key) async {
|
||||||
AppState().accessPass = key;
|
StorageUtil().accessPass = key;
|
||||||
await PhpGroup.changePass
|
await PhpGroup.changePass
|
||||||
.call(
|
.call(
|
||||||
newSenha: key,
|
newSenha: key,
|
||||||
|
@ -105,10 +104,10 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
|
|
||||||
Future<void> togglePanic(BuildContext context) async {
|
Future<void> togglePanic(BuildContext context) async {
|
||||||
onChange(String key) async {
|
onChange(String key) async {
|
||||||
AppState().panicPass = key;
|
StorageUtil().panicPass = key;
|
||||||
await PhpGroup.changePanic
|
await PhpGroup.changePanic
|
||||||
.call(
|
.call(
|
||||||
newSenhaPanico: AppState().panicPass,
|
newSenhaPanico: StorageUtil().panicPass,
|
||||||
)
|
)
|
||||||
.then((value) async {
|
.then((value) async {
|
||||||
final String content;
|
final String content;
|
||||||
|
@ -146,8 +145,8 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
);
|
);
|
||||||
|
|
||||||
onChange(String? key) async {
|
onChange(String? key) async {
|
||||||
if (!fingerprint) AppState().fingerprintPass = key ?? '';
|
if (!fingerprint) StorageUtil().fingerprintPass = key ?? '';
|
||||||
if (fingerprint) AppState().deleteFingerprintPass();
|
if (fingerprint) SecureStorageHelper().delete('fingerprintPass');
|
||||||
|
|
||||||
fingerprint = await _toggleBoolInDb('fingerprint');
|
fingerprint = await _toggleBoolInDb('fingerprint');
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -177,7 +176,7 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
ptText: 'Conta deletada com sucesso',
|
ptText: 'Conta deletada com sucesso',
|
||||||
);
|
);
|
||||||
|
|
||||||
AppState().deleteAll();
|
StorageUtil.purge();
|
||||||
|
|
||||||
context.pop();
|
context.pop();
|
||||||
context.go(
|
context.go(
|
||||||
|
@ -223,7 +222,7 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
ptText: 'Tem certeza que deseja sair?',
|
ptText: 'Tem certeza que deseja sair?',
|
||||||
);
|
);
|
||||||
onConfirm() async {
|
onConfirm() async {
|
||||||
AppState().deleteAll();
|
StorageUtil.purge();
|
||||||
|
|
||||||
context.go(
|
context.go(
|
||||||
'/welcomePage',
|
'/welcomePage',
|
||||||
|
@ -259,9 +258,9 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
|
|
||||||
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) {
|
await PhpGroup.resopndeVinculo.call(tarefa: 'I').then((value) {
|
||||||
if (value.jsonBody['error'] == false) {
|
if (value.jsonBody['error'] == false) {
|
||||||
db.clear('cliName');
|
StorageUtil().cliName = '';
|
||||||
db.clear('cliUUID');
|
StorageUtil().cliUUID = '';
|
||||||
db.clear('ownerUUID');
|
StorageUtil().ownerUUID = '';
|
||||||
|
|
||||||
context.pop();
|
context.pop();
|
||||||
|
|
||||||
|
@ -310,14 +309,15 @@ class PreferencesPageModel with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _getBoolFromDb(String key) async {
|
Future<bool> _getBoolFromDb(String key) async {
|
||||||
final value = await db.get(key: key, field: 'value');
|
final value = SQLiteStorageHelper().get(key);
|
||||||
return value.toString() == 'true';
|
return value.toString() == 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _toggleBoolInDb(String key) async {
|
Future<bool> _toggleBoolInDb(String key) async {
|
||||||
final currentValue = await _getBoolFromDb(key);
|
final currentValue = await _getBoolFromDb(key);
|
||||||
final newValue = !currentValue;
|
final newValue = !currentValue;
|
||||||
await db.update(key, newValue.toString(), 'util');
|
await SQLiteStorageHelper().set(key, newValue.toString(), (v) {});
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,18 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/preferences_settings_page/preferences_settings_model.dart';
|
import 'package:hub/pages/preferences_settings_page/preferences_settings_model.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class PreferencesPageWidget extends StatefulWidget {
|
class PreferencesPageWidget extends StatefulWidget {
|
||||||
PreferencesPageWidget();
|
const PreferencesPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_PreferencesPageWidgetState createState() => _PreferencesPageWidgetState();
|
_PreferencesPageWidgetState createState() => _PreferencesPageWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -211,7 +210,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
: FlutterFlowTheme.of(context).primary,
|
: FlutterFlowTheme.of(context).primary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8.0),
|
const SizedBox(width: 8.0),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
content,
|
content,
|
||||||
|
@ -240,7 +239,7 @@ class _PreferencesPageWidgetState extends State<PreferencesPageWidget> {
|
||||||
enText: 'Are you sure you want to logout?',
|
enText: 'Are you sure you want to logout?',
|
||||||
ptText: 'Tem certeza',
|
ptText: 'Tem certeza',
|
||||||
), () async {
|
), () async {
|
||||||
AppState().deleteAll();
|
StorageUtil.purge();
|
||||||
// setState(() {});
|
// setState(() {});
|
||||||
|
|
||||||
context.go(
|
context.go(
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:hub/components/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/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_icon_button.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
|
|
||||||
|
@ -31,7 +29,6 @@ class _ProvisionalScheduleState extends State<ProvisionalSchedule> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: scaffoldKey,
|
key: scaffoldKey,
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
|
|
@ -3,7 +3,8 @@ import 'dart:typed_data';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_model.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/pages/qr_code_page/qr_code_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
||||||
|
@ -11,10 +12,9 @@ class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
||||||
|
|
||||||
bool isAccess = false;
|
bool isAccess = false;
|
||||||
|
|
||||||
String? key = null;
|
String? key;
|
||||||
|
|
||||||
DateTime? time;
|
DateTime? time;
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final bool isFingerprint;
|
late final bool isFingerprint;
|
||||||
late final String userDevUUID;
|
late final String userDevUUID;
|
||||||
|
|
||||||
|
@ -28,12 +28,8 @@ class QrCodePageModel extends FlutterFlowModel<QrCodePageWidget> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initVariable() async {
|
Future<void> initVariable() async {
|
||||||
isFingerprint = await db
|
isFingerprint = StorageUtil().fingerprint;
|
||||||
.get(key: 'fingerprint', field: 'value')
|
userDevUUID = StorageUtil().userDevUUID;
|
||||||
.then((value) => value.toString() == 'true');
|
|
||||||
userDevUUID = await db
|
|
||||||
.get(key: 'userDevUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -15,7 +15,10 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/qr_code_page/qr_code_page_model.dart';
|
import 'package:hub/pages/qr_code_page/qr_code_page_model.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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/circular_percent_indicator.dart';
|
||||||
// import 'package:percent_indicator/percent_indicator.dart';
|
// import 'package:percent_indicator/percent_indicator.dart';
|
||||||
|
|
||||||
|
@ -305,11 +308,11 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState ==
|
if (snapshot.connectionState ==
|
||||||
ConnectionState.waiting) {
|
ConnectionState.waiting) {
|
||||||
return CircularProgressIndicator();
|
return const CircularProgressIndicator();
|
||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text('Error: ${snapshot.error}');
|
return Text('Error: ${snapshot.error}');
|
||||||
} else if (!snapshot.hasData) {
|
} else if (!snapshot.hasData) {
|
||||||
return Text('No data');
|
return const Text('No data');
|
||||||
} else {
|
} else {
|
||||||
final progress = snapshot.data!;
|
final progress = snapshot.data!;
|
||||||
return CircularPercentIndicator(
|
return CircularPercentIndicator(
|
||||||
|
@ -358,9 +361,8 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showBiometricsAuth(BuildContext context) async {
|
Future<void> _showBiometricsAuth(BuildContext context) async {
|
||||||
AppState()
|
BiometricHelper.checkBiometrics()
|
||||||
.checkBiometrics()
|
.then((value) => BiometricHelper.authenticateBiometric().then((value) {
|
||||||
.then((value) => AppState().authenticateBiometric().then((value) {
|
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
|
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
|
||||||
animationsMap['barcodeOnActionTriggerAnimation']!
|
animationsMap['barcodeOnActionTriggerAnimation']!
|
||||||
|
@ -371,7 +373,7 @@ class _QrCodePageWidgetState extends State<QrCodePageWidget>
|
||||||
.reverse();
|
.reverse();
|
||||||
}
|
}
|
||||||
_model.isAccess = !_model.isAccess;
|
_model.isAccess = !_model.isAccess;
|
||||||
_model.key = AppState().fingerprintPass;
|
_model.key = StorageUtil().fingerprintPass;
|
||||||
});
|
});
|
||||||
}))
|
}))
|
||||||
.onError((error, StackTrace) {
|
.onError((error, StackTrace) {
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/shared/helpers/db_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:share_plus/share_plus.dart';
|
||||||
|
|
||||||
class ReceptionPageModel with ChangeNotifier {
|
class ReceptionPageModel with ChangeNotifier {
|
||||||
Future<void> getIdenfifier(BuildContext context) async {
|
Future<void> getIdenfifier(BuildContext context) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final String userDevUUID = StorageUtil().userDevUUID;
|
||||||
final String userDevUUID = await db
|
|
||||||
.get(key: 'userDevUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
Share.share(
|
Share.share(
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Este é o meu identificador de acesso: ${userDevUUID}',
|
ptText: 'Este é o meu identificador de acesso: $userDevUUID',
|
||||||
enText: 'This is my access identifier: ${userDevUUID}',
|
enText: 'This is my access identifier: $userDevUUID',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/pages/reception_page/reception_page_model.dart';
|
import 'package:hub/pages/reception_page/reception_page_model.dart';
|
||||||
|
import 'package:hub/shared/helpers/secure_storage_helper.dart';
|
||||||
|
import 'package:hub/shared/utils/storage_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ReceptionPageWidget extends StatefulWidget {
|
class ReceptionPageWidget extends StatefulWidget {
|
||||||
|
@ -26,7 +28,7 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
AppState().context = context;
|
StorageUtil().context = context;
|
||||||
return ChangeNotifierProvider(
|
return ChangeNotifierProvider(
|
||||||
create: (context) => ReceptionPageModel(),
|
create: (context) => ReceptionPageModel(),
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
@ -151,7 +153,8 @@ class _ReceptionPageWidgetState extends State<ReceptionPageWidget> {
|
||||||
child: FFButtonWidget(
|
child: FFButtonWidget(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
PhpGroup.unregisterDevice();
|
PhpGroup.unregisterDevice();
|
||||||
AppState().deleteAll();
|
|
||||||
|
StorageUtil.purge();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
context.go(
|
context.go(
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart';
|
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/flutter_flow_util.dart';
|
||||||
import '/flutter_flow/form_field_controller.dart';
|
|
||||||
import 'register_visitor_page_widget.dart' show RegisterVisitorPageWidget;
|
import 'register_visitor_page_widget.dart' show RegisterVisitorPageWidget;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
|
@ -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_icon_button.dart';
|
||||||
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'register_visitor_page_model.dart';
|
import 'register_visitor_page_model.dart';
|
||||||
|
@ -39,7 +38,6 @@ class _RegisterVisitorPageWidgetState extends State<RegisterVisitorPageWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
|
|
@ -6,50 +6,37 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
import 'package:hub/app_state.dart';
|
import 'package:hub/app_state.dart';
|
||||||
import 'package:hub/flutter_flow/internationalization.dart';
|
import 'package:hub/flutter_flow/internationalization.dart';
|
||||||
import 'package:hub/flutter_flow/nav/nav.dart';
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.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:hub/shared/utils/webview_util.dart';
|
||||||
import 'package:sqflite/sqflite.dart';
|
import 'package:sqflite/sqflite.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
import 'package:webview_flutter/webview_flutter.dart';
|
import 'package:webview_flutter/webview_flutter.dart';
|
||||||
|
|
||||||
class ReservationPageWidget extends StatefulWidget {
|
class ReservationPageWidget extends StatefulWidget {
|
||||||
|
const ReservationPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_ReservationPageWidgetState createState() => _ReservationPageWidgetState();
|
_ReservationPageWidgetState createState() => _ReservationPageWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late InAppWebViewController _controllerIOS;
|
late InAppWebViewController _controllerIOS;
|
||||||
late WebViewController _controllerAll;
|
late WebViewController _controllerAll;
|
||||||
|
|
||||||
Future<Map<String, String>> initVariables() async {
|
Future<Map<String, String>> initVariables() async {
|
||||||
final email = await db
|
final email = StorageUtil().email;
|
||||||
.get(key: 'email', field: 'value')
|
final name = StorageUtil().cliName;
|
||||||
.then((value) => value.toString());
|
final userUUID = StorageUtil().userUUID;
|
||||||
final name = await db
|
final devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'userName', field: 'value')
|
final createdAt = StorageUtil().createdAt;
|
||||||
.then((value) => value.toString());
|
final clientId = StorageUtil().cliUUID;
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final devUUID = await db
|
|
||||||
.get(key: 'devUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final createdAt = await db
|
|
||||||
.get(key: 'devUUID', field: 'createdAt')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final clientId = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
final url = 'https://hub.freaccess.com.br/hub/reservation/$clientId';
|
final url = 'https://hub.freaccess.com.br/hub/reservation/$clientId';
|
||||||
|
|
||||||
final freUserData = "{\"name\": \"$name\", " +
|
final freUserData =
|
||||||
"\"email\": \"$email\"," +
|
"{\"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\" }";
|
||||||
"\"dev_id\": \"$devUUID\"," +
|
|
||||||
"\"created_at\": \"$createdAt\"," +
|
|
||||||
"\"updated_at\": \"0000-00-00 00:00:00\"," +
|
|
||||||
"\"status\": \"A\" }";
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'url': url,
|
'url': url,
|
||||||
|
@ -163,7 +150,7 @@ class _ReservationPageWidgetState extends State<ReservationPageWidget> {
|
||||||
..loadRequest(Uri.parse(url)),
|
..loadRequest(Uri.parse(url)),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Center(child: Text('Unexpected error'));
|
return const Center(child: Text('Unexpected error'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
import 'package:hub/backend/api_requests/api_manager.dart';
|
import 'package:hub/backend/api_requests/api_manager.dart';
|
||||||
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
|
||||||
|
@ -15,8 +13,9 @@ import 'package:hub/flutter_flow/request_manager.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/visit_history_page_widget.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/visit_history_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/mixins/status_mixin.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:hub/shared/utils/validator_util.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
@ -26,7 +25,6 @@ class ScheduleCompleteVisitPageModel
|
||||||
late VoidCallback safeSetState;
|
late VoidCallback safeSetState;
|
||||||
late Function(Function) updateState;
|
late Function(Function) updateState;
|
||||||
final _visitHistoryManager = FutureRequestManager<ApiCallResponse>();
|
final _visitHistoryManager = FutureRequestManager<ApiCallResponse>();
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
|
@ -184,15 +182,9 @@ class ScheduleCompleteVisitPageModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initVariables() async {
|
Future<void> _initVariables() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
cliUUID = StorageUtil().cliUUID;
|
||||||
.then((value) => value.toString());
|
userUUID = StorageUtil().userUUID;
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -418,7 +410,7 @@ class ScheduleCompleteVisitPageModel
|
||||||
enText: 'Are you sure you want to block this visit?',
|
enText: 'Are you sure you want to block this visit?',
|
||||||
), () async {
|
), () async {
|
||||||
await changeStatusAction
|
await changeStatusAction
|
||||||
?.call(
|
.call(
|
||||||
context,
|
context,
|
||||||
int.parse(item['VAW_DESTINO']),
|
int.parse(item['VAW_DESTINO']),
|
||||||
int.parse(item['VAW_ID']),
|
int.parse(item['VAW_ID']),
|
||||||
|
@ -520,13 +512,13 @@ class ScheduleCompleteVisitPageModel
|
||||||
icon: const Icon(Icons.share),
|
icon: const Icon(Icons.share),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Share.share('''
|
Share.share('''
|
||||||
Olá, \*${item['VTE_NOME']}\*! Você foi convidado para \*${cliName}\*.
|
Olá, \*${item['VTE_NOME']}\*! Você foi convidado para \*$cliName\*.
|
||||||
|
|
||||||
\*Validade do Convite\*:
|
\*Validade do Convite\*:
|
||||||
- Início: ${item['VAW_DTINICIO']}
|
- Início: ${item['VAW_DTINICIO']}
|
||||||
- Fim: ${item['VAW_DTFIM']}
|
- 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(
|
options: FFButtonOptions(
|
||||||
|
@ -560,7 +552,7 @@ URL do Convite: https://visita.freaccess.com.br/${item['VAW_ID']}/${cliUUID}/${i
|
||||||
: '',
|
: '',
|
||||||
}),
|
}),
|
||||||
imagePath:
|
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: [
|
statusHashMap: [
|
||||||
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.active)
|
if (Status.getStatus(item['VAW_STATUS']) == StatusEnum.active)
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
|
|
|
@ -26,7 +26,7 @@ import 'package:hub/shared/utils/share_util.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ScheduleComplete extends StatefulWidget {
|
class ScheduleComplete extends StatefulWidget {
|
||||||
const ScheduleComplete({Key? key}) : super(key: key);
|
const ScheduleComplete({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
|
@ -35,7 +35,7 @@ class ScheduleComplete extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ScheduleCompleteVisitPageWidget extends ScheduleComplete {
|
class ScheduleCompleteVisitPageWidget extends ScheduleComplete {
|
||||||
const ScheduleCompleteVisitPageWidget();
|
const ScheduleCompleteVisitPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ScheduleCompleteVisitPageWidget> createState() =>
|
State<ScheduleCompleteVisitPageWidget> createState() =>
|
||||||
|
@ -48,8 +48,8 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
late ScheduleCompleteVisitPageModel _model;
|
late ScheduleCompleteVisitPageModel _model;
|
||||||
int _visitHistoryLoadingIdx = 0;
|
int _visitHistoryLoadingIdx = 0;
|
||||||
final int _visitHistoryLoadingCount = 10;
|
final int _visitHistoryLoadingCount = 10;
|
||||||
List<dynamic> _visitHistoryList = [];
|
final List<dynamic> _visitHistoryList = [];
|
||||||
ScrollController _visitHistoryController = ScrollController();
|
final ScrollController _visitHistoryController = ScrollController();
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
@ -109,8 +109,6 @@ class _ScheduleCompleteVisitPageWidgetState
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
onTap: () => _model.unfocusNode.canRequestFocus
|
||||||
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
||||||
|
@ -164,7 +162,7 @@ PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bodyScheduleCompleteVisit(BuildContext context,
|
Widget bodyScheduleCompleteVisit(BuildContext context,
|
||||||
ScheduleCompleteVisitPageModel _model, Function safeSetState) {
|
ScheduleCompleteVisitPageModel model, Function safeSetState) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
top: true,
|
top: true,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -196,7 +194,7 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
controller: _model.tabBarController,
|
controller: model.tabBarController,
|
||||||
onTap: (i) async {
|
onTap: (i) async {
|
||||||
[() async {}, () async {}][i]();
|
[() async {}, () async {}][i]();
|
||||||
},
|
},
|
||||||
|
@ -204,12 +202,12 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: _model.tabBarController,
|
controller: model.tabBarController,
|
||||||
children: [
|
children: [
|
||||||
scheduleVisit(context, _model, safeSetState),
|
scheduleVisit(context, model, safeSetState),
|
||||||
wrapWithModel(
|
wrapWithModel(
|
||||||
model: _model,
|
model: model,
|
||||||
child: VisitHistoryWidget(),
|
child: const VisitHistoryWidget(),
|
||||||
updateCallback: () {
|
updateCallback: () {
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
|
@ -223,7 +221,7 @@ Widget bodyScheduleCompleteVisit(BuildContext context,
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget scheduleVisit(BuildContext context,
|
Widget scheduleVisit(BuildContext context,
|
||||||
ScheduleCompleteVisitPageModel _model, Function safeSetState) {
|
ScheduleCompleteVisitPageModel model, Function safeSetState) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
@ -268,9 +266,9 @@ Widget scheduleVisit(BuildContext context,
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
24.0, 0.0, 24.0, 0.0),
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController1,
|
controller: model.textController1,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
focusNode: _model.textFieldFocusNode1,
|
focusNode: model.textFieldFocusNode1,
|
||||||
autovalidateMode:
|
autovalidateMode:
|
||||||
AutovalidateMode.onUserInteraction,
|
AutovalidateMode.onUserInteraction,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
@ -355,7 +353,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
lineHeight: 1.8,
|
lineHeight: 1.8,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
validator: _model.textController1Validator
|
validator: model.textController1Validator
|
||||||
.asValidator(context)),
|
.asValidator(context)),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -470,7 +468,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
if (datePicked1Date != null &&
|
if (datePicked1Date != null &&
|
||||||
datePicked1Time != null) {
|
datePicked1Time != null) {
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
_model.datePicked1 = DateTime(
|
model.datePicked1 = DateTime(
|
||||||
datePicked1Date.year,
|
datePicked1Date.year,
|
||||||
datePicked1Date.month,
|
datePicked1Date.month,
|
||||||
datePicked1Date.day,
|
datePicked1Date.day,
|
||||||
|
@ -480,15 +478,15 @@ Widget scheduleVisit(BuildContext context,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
_model.textController1?.text = dateTimeFormat(
|
model.textController1?.text = dateTimeFormat(
|
||||||
'dd/MM/yyyy HH:mm:ss',
|
'dd/MM/yyyy HH:mm:ss',
|
||||||
_model.datePicked1,
|
model.datePicked1,
|
||||||
locale: FFLocalizations.of(context)
|
locale: FFLocalizations.of(context)
|
||||||
.languageCode,
|
.languageCode,
|
||||||
);
|
);
|
||||||
_model.textController1?.selection =
|
model.textController1?.selection =
|
||||||
TextSelection.collapsed(
|
TextSelection.collapsed(
|
||||||
offset: _model
|
offset: model
|
||||||
.textController1!.text.length);
|
.textController1!.text.length);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -519,8 +517,8 @@ Widget scheduleVisit(BuildContext context,
|
||||||
24.0, 0.0, 24.0, 0.0),
|
24.0, 0.0, 24.0, 0.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
controller: _model.textController2,
|
controller: model.textController2,
|
||||||
focusNode: _model.textFieldFocusNode2,
|
focusNode: model.textFieldFocusNode2,
|
||||||
autovalidateMode:
|
autovalidateMode:
|
||||||
AutovalidateMode.onUserInteraction,
|
AutovalidateMode.onUserInteraction,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
|
@ -603,7 +601,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
lineHeight: 1.8,
|
lineHeight: 1.8,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
validator: _model.textController2Validator
|
validator: model.textController2Validator
|
||||||
.asValidator(context),
|
.asValidator(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -719,7 +717,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
if (datePicked2Date != null &&
|
if (datePicked2Date != null &&
|
||||||
datePicked2Time != null) {
|
datePicked2Time != null) {
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
_model.datePicked2 = DateTime(
|
model.datePicked2 = DateTime(
|
||||||
datePicked2Date.year,
|
datePicked2Date.year,
|
||||||
datePicked2Date.month,
|
datePicked2Date.month,
|
||||||
datePicked2Date.day,
|
datePicked2Date.day,
|
||||||
|
@ -729,15 +727,15 @@ Widget scheduleVisit(BuildContext context,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
_model.textController2?.text = dateTimeFormat(
|
model.textController2?.text = dateTimeFormat(
|
||||||
'dd/MM/yyyy HH:mm:ss',
|
'dd/MM/yyyy HH:mm:ss',
|
||||||
_model.datePicked2,
|
model.datePicked2,
|
||||||
locale: FFLocalizations.of(context)
|
locale: FFLocalizations.of(context)
|
||||||
.languageCode,
|
.languageCode,
|
||||||
);
|
);
|
||||||
_model.textController2?.selection =
|
model.textController2?.selection =
|
||||||
TextSelection.collapsed(
|
TextSelection.collapsed(
|
||||||
offset: _model
|
offset: model
|
||||||
.textController2!.text.length);
|
.textController2!.text.length);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -781,11 +779,11 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (_model.visitorJsonList.isNotEmpty)
|
if (model.visitorJsonList.isNotEmpty)
|
||||||
Builder(
|
Builder(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
final visitorListView =
|
final visitorListView =
|
||||||
_model.visitorJsonList.map((e) => e).toList();
|
model.visitorJsonList.map((e) => e).toList();
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
0,
|
0,
|
||||||
|
@ -828,7 +826,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
fadeOutDuration:
|
fadeOutDuration:
|
||||||
const Duration(milliseconds: 500),
|
const Duration(milliseconds: 500),
|
||||||
imageUrl:
|
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,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -860,7 +858,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
_model.removeFromVisitorJsonList(
|
model.removeFromVisitorJsonList(
|
||||||
visitorListViewItem);
|
visitorListViewItem);
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
|
@ -892,10 +890,10 @@ Widget scheduleVisit(BuildContext context,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _model
|
onTap: () => model
|
||||||
.unfocusNode.canRequestFocus
|
.unfocusNode.canRequestFocus
|
||||||
? FocusScope.of(context)
|
? FocusScope.of(context)
|
||||||
.requestFocus(_model.unfocusNode)
|
.requestFocus(model.unfocusNode)
|
||||||
: FocusScope.of(context).unfocus(),
|
: FocusScope.of(context).unfocus(),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height:
|
height:
|
||||||
|
@ -908,14 +906,14 @@ Widget scheduleVisit(BuildContext context,
|
||||||
child:
|
child:
|
||||||
VisitorSearchModalTemplateComponentWidget(
|
VisitorSearchModalTemplateComponentWidget(
|
||||||
getVisitors: (visitorsParam) async {
|
getVisitors: (visitorsParam) async {
|
||||||
_model.visitorJsonList =
|
model.visitorJsonList =
|
||||||
visitorsParam!
|
visitorsParam!
|
||||||
.toList()
|
.toList()
|
||||||
.cast<dynamic>();
|
.cast<dynamic>();
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
getDocs: (docsParam) async {
|
getDocs: (docsParam) async {
|
||||||
_model.visitorStrList =
|
model.visitorStrList =
|
||||||
strListToStr(
|
strListToStr(
|
||||||
docsParam!.toList());
|
docsParam!.toList());
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
|
@ -1065,17 +1063,17 @@ Widget scheduleVisit(BuildContext context,
|
||||||
.reasonsMotDescStrList(
|
.reasonsMotDescStrList(
|
||||||
snapshot.data!.jsonBody);
|
snapshot.data!.jsonBody);
|
||||||
|
|
||||||
_model.processDropDown1(reasonsJsonList!);
|
model.processDropDown1(reasonsJsonList!);
|
||||||
|
|
||||||
return FlutterFlowDropDown<String>(
|
return FlutterFlowDropDown<String>(
|
||||||
fillColor: FlutterFlowTheme.of(context)
|
fillColor: FlutterFlowTheme.of(context)
|
||||||
.primaryBackground,
|
.primaryBackground,
|
||||||
controller:
|
controller:
|
||||||
_model.dropDownValueController1,
|
model.dropDownValueController1,
|
||||||
options: _model.reasonsDropDown1,
|
options: model.reasonsDropDown1,
|
||||||
optionLabels: reasonsOptionLabels,
|
optionLabels: reasonsOptionLabels,
|
||||||
onChanged: (val) => safeSetState(
|
onChanged: (val) => safeSetState(
|
||||||
() => _model.dropDownValue1 = val),
|
() => model.dropDownValue1 = val),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
textStyle: FlutterFlowTheme.of(context)
|
||||||
|
@ -1120,7 +1118,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (_model.dropDownValue1 == '')
|
if (model.dropDownValue1 == '')
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
@ -1178,15 +1176,15 @@ Widget scheduleVisit(BuildContext context,
|
||||||
.getDadosCall
|
.getDadosCall
|
||||||
.levelNACDescricaoStrList(
|
.levelNACDescricaoStrList(
|
||||||
snapshot.data!.jsonBody);
|
snapshot.data!.jsonBody);
|
||||||
_model.processDropDown2(lavelsJsonList!);
|
model.processDropDown2(lavelsJsonList!);
|
||||||
|
|
||||||
return FlutterFlowDropDown<String>(
|
return FlutterFlowDropDown<String>(
|
||||||
controller:
|
controller:
|
||||||
_model.dropDownValueController2,
|
model.dropDownValueController2,
|
||||||
options: _model.lavelsDropDown2,
|
options: model.lavelsDropDown2,
|
||||||
optionLabels: lavelsOptionLabels,
|
optionLabels: lavelsOptionLabels,
|
||||||
onChanged: (val) => safeSetState(
|
onChanged: (val) => safeSetState(
|
||||||
() => _model.dropDownValue2 = val),
|
() => model.dropDownValue2 = val),
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
textStyle: FlutterFlowTheme.of(context)
|
||||||
|
@ -1233,7 +1231,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (_model.dropDownValue2 == '')
|
if (model.dropDownValue2 == '')
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
@ -1314,9 +1312,9 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Switch(
|
Switch(
|
||||||
value: _model.switchValue!,
|
value: model.switchValue!,
|
||||||
onChanged: (newValue) async {
|
onChanged: (newValue) async {
|
||||||
safeSetState(() => _model.switchValue = newValue);
|
safeSetState(() => model.switchValue = newValue);
|
||||||
},
|
},
|
||||||
focusColor: FlutterFlowTheme.of(context).primary,
|
focusColor: FlutterFlowTheme.of(context).primary,
|
||||||
trackColor: WidgetStateProperty.resolveWith(
|
trackColor: WidgetStateProperty.resolveWith(
|
||||||
|
@ -1391,8 +1389,8 @@ Widget scheduleVisit(BuildContext context,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _model.textController3,
|
controller: model.textController3,
|
||||||
focusNode: _model.textFieldFocusNode3,
|
focusNode: model.textFieldFocusNode3,
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
cursorColor: FlutterFlowTheme.of(context).primary,
|
cursorColor: FlutterFlowTheme.of(context).primary,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
|
@ -1472,7 +1470,7 @@ Widget scheduleVisit(BuildContext context,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
maxLength: 80,
|
maxLength: 80,
|
||||||
validator: _model.textController3Validator
|
validator: model.textController3Validator
|
||||||
.asValidator(context),
|
.asValidator(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1492,21 +1490,21 @@ Widget scheduleVisit(BuildContext context,
|
||||||
enText: 'Schedule',
|
enText: 'Schedule',
|
||||||
ptText: 'Agendar',
|
ptText: 'Agendar',
|
||||||
),
|
),
|
||||||
onPressed: _model.isValid()
|
onPressed: model.isValid()
|
||||||
? () async {
|
? () async {
|
||||||
Future<void> scheduleVisit() async {
|
Future<void> scheduleVisit() async {
|
||||||
await PhpGroup.postScheduleVisitCall
|
await PhpGroup.postScheduleVisitCall
|
||||||
.call(
|
.call(
|
||||||
devDesc: _model.textController3.text,
|
devDesc: model.textController3.text,
|
||||||
idVisitante: _model.visitorStrList,
|
idVisitante: model.visitorStrList,
|
||||||
dtInicio: _model
|
dtInicio: model
|
||||||
.convertDateFormat(_model.textController1.text ?? ''),
|
.convertDateFormat(model.textController1.text ?? ''),
|
||||||
dtFim: _model
|
dtFim: model
|
||||||
.convertDateFormat(_model.textController2.text ?? ''),
|
.convertDateFormat(model.textController2.text ?? ''),
|
||||||
unica: _model.switchValue == true ? 'Sim' : 'Não',
|
unica: model.switchValue == true ? 'Sim' : 'Não',
|
||||||
idMotivo: extractIdToStr(_model.dropDownValue1!),
|
idMotivo: extractIdToStr(model.dropDownValue1!),
|
||||||
idNAC: extractIdToStr(_model.dropDownValue2!),
|
idNAC: extractIdToStr(model.dropDownValue2!),
|
||||||
obs: _model.textController3.text,
|
obs: model.textController3.text,
|
||||||
)
|
)
|
||||||
.catchError((e) async {
|
.catchError((e) async {
|
||||||
await DialogUtil.errorDefault(context);
|
await DialogUtil.errorDefault(context);
|
||||||
|
@ -1517,14 +1515,14 @@ Widget scheduleVisit(BuildContext context,
|
||||||
false) {
|
false) {
|
||||||
context.pop();
|
context.pop();
|
||||||
|
|
||||||
_model.dropDownValue1 = null;
|
model.dropDownValue1 = null;
|
||||||
_model.dropDownValue2 = null;
|
model.dropDownValue2 = null;
|
||||||
_model.dropDownValueController1 =
|
model.dropDownValueController1 =
|
||||||
FormFieldController<String>('');
|
FormFieldController<String>('');
|
||||||
_model.dropDownValueController2 =
|
model.dropDownValueController2 =
|
||||||
FormFieldController<String>('');
|
FormFieldController<String>('');
|
||||||
_model.visitorStrList = '';
|
model.visitorStrList = '';
|
||||||
_model.visitorJsonList = [];
|
model.visitorJsonList = [];
|
||||||
|
|
||||||
ToastUtil.showToast(
|
ToastUtil.showToast(
|
||||||
message: FFLocalizations.of(context)
|
message: FFLocalizations.of(context)
|
||||||
|
@ -1545,16 +1543,16 @@ Widget scheduleVisit(BuildContext context,
|
||||||
safeSetState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_model.visitorJsonList.length > 1) {
|
if (model.visitorJsonList.length > 1) {
|
||||||
final title = FFLocalizations.of(context).getVariableText(
|
final title = FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Cadastrar Múltiplos Visitantes',
|
ptText: 'Cadastrar Múltiplos Visitantes',
|
||||||
enText: 'Register Multiple Visitors',
|
enText: 'Register Multiple Visitors',
|
||||||
);
|
);
|
||||||
final content = FFLocalizations.of(context).getVariableText(
|
final content = FFLocalizations.of(context).getVariableText(
|
||||||
ptText:
|
ptText:
|
||||||
'Você deseja agendar uma visita para ${_model.visitorJsonList.length} visitantes?',
|
'Você deseja agendar uma visita para ${model.visitorJsonList.length} visitantes?',
|
||||||
enText:
|
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);
|
showAlertDialog(context, title, content, scheduleVisit);
|
||||||
|
@ -1563,9 +1561,9 @@ Widget scheduleVisit(BuildContext context,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
onTap: () => model.unfocusNode.canRequestFocus
|
||||||
? FocusScope.of(context)
|
? FocusScope.of(context)
|
||||||
.requestFocus(_model.unfocusNode)
|
.requestFocus(model.unfocusNode)
|
||||||
: FocusScope.of(context).unfocus(),
|
: FocusScope.of(context).unfocus(),
|
||||||
child: Dialog(
|
child: Dialog(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
|
@ -1599,28 +1597,28 @@ Widget scheduleVisit(BuildContext context,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
imagePath:
|
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: {
|
labelsHashMap: {
|
||||||
'Nome': _model.visitorJsonList[0]['VTE_NOME'],
|
'Nome': model.visitorJsonList[0]['VTE_NOME'],
|
||||||
'Start': _model.textController1.text,
|
'Start': model.textController1.text,
|
||||||
'End': _model.textController2.text ?? '',
|
'End': model.textController2.text ?? '',
|
||||||
'Reason': (RegExp(r'MOT_DESCRICAO:\s*([^,]+)')
|
'Reason': (RegExp(r'MOT_DESCRICAO:\s*([^,]+)')
|
||||||
.firstMatch(
|
.firstMatch(
|
||||||
_model.dropDownValue1.toString())
|
model.dropDownValue1.toString())
|
||||||
?.group(1)
|
?.group(1)
|
||||||
.toString()) ??
|
.toString()) ??
|
||||||
'',
|
'',
|
||||||
'Level': (RegExp(r'NAC_DESCRICAO:\s*([^,]+)')
|
'Level': (RegExp(r'NAC_DESCRICAO:\s*([^,]+)')
|
||||||
.firstMatch(
|
.firstMatch(
|
||||||
_model.dropDownValue2.toString())
|
model.dropDownValue2.toString())
|
||||||
?.group(1)
|
?.group(1)
|
||||||
.toString()) ??
|
.toString()) ??
|
||||||
'',
|
'',
|
||||||
'Single Visit': _model.switchValue == true
|
'Single Visit': model.switchValue == true
|
||||||
? 'Sim'
|
? 'Sim'
|
||||||
: 'Não',
|
: 'Não',
|
||||||
if (_model.textController3.text.isNotEmpty)
|
if (model.textController3.text.isNotEmpty)
|
||||||
'Observation': _model.textController3.text,
|
'Observation': model.textController3.text,
|
||||||
},
|
},
|
||||||
statusHashMap: [
|
statusHashMap: [
|
||||||
Map<String, Color>.from({
|
Map<String, Color>.from({
|
||||||
|
|
|
@ -5,14 +5,15 @@ 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_util.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
|
||||||
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
|
||||||
import 'package:hub/shared/helpers/db_helper.dart';
|
import 'package:hub/shared/helpers/sqlite_storage_helper.dart';
|
||||||
import 'package:hub/shared/mixins/status_mixin.dart';
|
import 'package:hub/shared/mixins/status_mixin.dart';
|
||||||
import 'package:hub/shared/utils/dialog_util.dart';
|
import 'package:hub/shared/utils/dialog_util.dart';
|
||||||
import 'package:hub/shared/utils/log_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:hub/shared/utils/validator_util.dart';
|
||||||
|
|
||||||
class VisitHistoryWidget extends ScheduleComplete {
|
class VisitHistoryWidget extends ScheduleComplete {
|
||||||
const VisitHistoryWidget();
|
const VisitHistoryWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
|
_VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
|
||||||
|
@ -20,7 +21,6 @@ class VisitHistoryWidget extends ScheduleComplete {
|
||||||
|
|
||||||
class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
with TickerProviderStateMixin, Status {
|
with TickerProviderStateMixin, Status {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
|
||||||
late final String devUUID;
|
late final String devUUID;
|
||||||
late final String userUUID;
|
late final String userUUID;
|
||||||
late final String cliUUID;
|
late final String cliUUID;
|
||||||
|
@ -35,15 +35,9 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
List<dynamic> _visitWrap = [];
|
List<dynamic> _visitWrap = [];
|
||||||
|
|
||||||
Future<void> _initVariables() async {
|
Future<void> _initVariables() async {
|
||||||
devUUID = await db
|
devUUID = StorageUtil().devUUID;
|
||||||
.get(key: 'devUUID', field: 'value')
|
userUUID = StorageUtil().userUUID;
|
||||||
.then((value) => value.toString());
|
cliUUID = StorageUtil().cliUUID;
|
||||||
userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -82,7 +76,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
|
|
||||||
final List<dynamic> visits = response.jsonBody['visitas'] ?? [];
|
final List<dynamic> visits = response.jsonBody['visitas'] ?? [];
|
||||||
|
|
||||||
if (visits != null && visits.isNotEmpty) {
|
if (visits.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_visitWrap.addAll(visits);
|
_visitWrap.addAll(visits);
|
||||||
_hasData = true;
|
_hasData = true;
|
||||||
|
@ -109,6 +103,7 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
_loading = false;
|
_loading = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadMore() {
|
void _loadMore() {
|
||||||
|
@ -252,19 +247,11 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget>
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
onTapCardItemAction: () async {
|
onTapCardItemAction: () async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
final cliUUID = await db
|
final cliName = StorageUtil().cliName;
|
||||||
.get(key: 'cliUUID', field: 'value')
|
final devUUID = StorageUtil().devUUID;
|
||||||
.then((value) => value.toString());
|
final userUUID = StorageUtil().userUUID;
|
||||||
final cliName = await db
|
|
||||||
.get(key: 'cliName', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final devUUID = await db
|
|
||||||
.get(key: 'devUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final userUUID = await db
|
|
||||||
.get(key: 'userUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
import 'package:hub/shared/helpers/secure_storage_helper.dart';
|
||||||
import 'package:hub/shared/mixins/switcher_mixin.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 '/components/templates_components/welcome_template_component/welcome_template_component_widget.dart';
|
||||||
import '/flutter_flow/flutter_flow_theme.dart';
|
import '/flutter_flow/flutter_flow_theme.dart';
|
||||||
import '/flutter_flow/flutter_flow_util.dart';
|
import '/flutter_flow/flutter_flow_util.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'welcome_page_model.dart';
|
import 'welcome_page_model.dart';
|
||||||
export 'welcome_page_model.dart';
|
export 'welcome_page_model.dart';
|
||||||
|
|
||||||
|
@ -29,13 +30,13 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
|
||||||
// On page load action.
|
// On page load action.
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||||
if (isAndroid == true) {
|
if (isAndroid == true) {
|
||||||
AppState().deviceType = 'Android';
|
StorageUtil().deviceType = 'Android';
|
||||||
setState(() {});
|
setState(() {});
|
||||||
} else if (isiOS == true) {
|
} else if (isiOS == true) {
|
||||||
AppState().deviceType = 'iOS';
|
StorageUtil().deviceType = 'iOS';
|
||||||
setState(() {});
|
setState(() {});
|
||||||
} else {
|
} else {
|
||||||
AppState().deviceType = 'Web';
|
StorageUtil().deviceType = 'Web';
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -50,8 +51,6 @@ class _WelcomePageWidgetState extends State<WelcomePageWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
context.watch<AppState>();
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => _model.unfocusNode.canRequestFocus
|
onTap: () => _model.unfocusNode.canRequestFocus
|
||||||
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
? FocusScope.of(context).requestFocus(_model.unfocusNode)
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
import 'package:csv/csv.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||||
|
import 'package:synchronized/synchronized.dart';
|
||||||
|
|
||||||
|
extension FlutterSecureStorageExtensions on FlutterSecureStorage {
|
||||||
|
static final _lock = Lock();
|
||||||
|
|
||||||
|
Future<void> writeSync({required String key, String? value}) async =>
|
||||||
|
await _lock.synchronized(() async {
|
||||||
|
await write(key: key, value: value);
|
||||||
|
});
|
||||||
|
|
||||||
|
void remove(String key) => delete(key: key);
|
||||||
|
|
||||||
|
Future<String?> getString(String key) async => await read(key: key);
|
||||||
|
Future<void> setString(String key, String value) async =>
|
||||||
|
await writeSync(key: key, value: value);
|
||||||
|
|
||||||
|
Future<bool?> getBool(String key) async => (await read(key: key)) == 'true';
|
||||||
|
Future<void> setBool(String key, bool? value) async =>
|
||||||
|
await writeSync(key: key, value: value.toString());
|
||||||
|
|
||||||
|
Future<int?> getInt(String key) async =>
|
||||||
|
int.tryParse(await read(key: key) ?? '');
|
||||||
|
Future<void> setInt(String key, int value) async =>
|
||||||
|
await writeSync(key: key, value: value.toString());
|
||||||
|
|
||||||
|
Future<double?> getDouble(String key) async =>
|
||||||
|
double.tryParse(await read(key: key) ?? '');
|
||||||
|
Future<void> setDouble(String key, double value) async =>
|
||||||
|
await writeSync(key: key, value: value.toString());
|
||||||
|
|
||||||
|
Future<BuildContext?> getObject(String key) async {
|
||||||
|
final value = await read(key: key);
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return value as BuildContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<String>?> getStringList(String key) async =>
|
||||||
|
await read(key: key).then((result) {
|
||||||
|
if (result == null || result.isEmpty) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return const CsvToListConverter()
|
||||||
|
.convert(result)
|
||||||
|
.first
|
||||||
|
.map((e) => e.toString())
|
||||||
|
.toList();
|
||||||
|
});
|
||||||
|
Future<void> setStringList(String key, List<String> value) async =>
|
||||||
|
await writeSync(
|
||||||
|
key: key, value: const ListToCsvConverter().convert([value]));
|
||||||
|
}
|
|
@ -1,240 +0,0 @@
|
||||||
import 'dart:developer';
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:path/path.dart';
|
|
||||||
import 'package:sqflite/sqflite.dart';
|
|
||||||
|
|
||||||
class DatabaseConfig {
|
|
||||||
static const String dbName = 'database.db';
|
|
||||||
static const int dbVersion = 1;
|
|
||||||
|
|
||||||
static const String tableKeychain = 'keychain';
|
|
||||||
static const String columnKey = 'key';
|
|
||||||
static const String columnValue = 'value';
|
|
||||||
static const String columnType = 'type';
|
|
||||||
static const String columnUpdateAt = 'updateAt';
|
|
||||||
static const String columnResolvedAt = 'resolvedAt';
|
|
||||||
static const String columnCreatedAt = 'createdAt';
|
|
||||||
}
|
|
||||||
|
|
||||||
class DatabaseHelper {
|
|
||||||
static final DatabaseHelper _instance = DatabaseHelper._internal();
|
|
||||||
static Database? _database;
|
|
||||||
|
|
||||||
factory DatabaseHelper() => _instance;
|
|
||||||
|
|
||||||
DatabaseHelper._internal();
|
|
||||||
|
|
||||||
Future<Database> get database async {
|
|
||||||
if (_database != null) return _database!;
|
|
||||||
_database = await _initDatabase();
|
|
||||||
return _database!;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Database> _initDatabase() async {
|
|
||||||
final path = await _getDatabasePath();
|
|
||||||
log('Database path: $path');
|
|
||||||
return await openDatabase(
|
|
||||||
path,
|
|
||||||
version: DatabaseConfig.dbVersion,
|
|
||||||
onCreate: _onCreate,
|
|
||||||
onOpen: _onOpen,
|
|
||||||
onUpgrade: _onUpgrade,
|
|
||||||
onDowngrade: _onDowngrade,
|
|
||||||
onConfigure: _onConfigure,
|
|
||||||
).catchError((error) {
|
|
||||||
throw error;
|
|
||||||
}).whenComplete(() => log('Database initialized'));
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> _getDatabasePath() async {
|
|
||||||
final databasesPath = await getDatabasesPath();
|
|
||||||
final path = join(databasesPath, DatabaseConfig.dbName);
|
|
||||||
log('Database path: $path');
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onCreate(Database db, int version) async {
|
|
||||||
log('Creating tables...');
|
|
||||||
await db.execute('''
|
|
||||||
CREATE TABLE ${DatabaseConfig.tableKeychain} (
|
|
||||||
${DatabaseConfig.columnKey} TEXT UNIQUE,
|
|
||||||
${DatabaseConfig.columnValue} TEXT,
|
|
||||||
${DatabaseConfig.columnType} TEXT,
|
|
||||||
${DatabaseConfig.columnUpdateAt} TEXT,
|
|
||||||
${DatabaseConfig.columnResolvedAt} TEXT,
|
|
||||||
${DatabaseConfig.columnCreatedAt} TEXT
|
|
||||||
);
|
|
||||||
''');
|
|
||||||
await _insertInitialData(db);
|
|
||||||
log('Tables created');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _insertInitialData(Database db) async {
|
|
||||||
final initialData = [
|
|
||||||
{'key': 'devUUID', 'value': '', 'type': 'user'},
|
|
||||||
{'key': 'userUUID', 'value': '', 'type': 'user'},
|
|
||||||
{'key': 'userDevUUID', 'value': '', 'type': 'user'},
|
|
||||||
{'key': 'status', 'value': '', 'type': 'user'},
|
|
||||||
{'key': 'userName', 'value': '', 'type': 'user'},
|
|
||||||
{'key': 'cliUUID', 'value': '', 'type': 'local'},
|
|
||||||
{'key': 'ownerUUID', 'value': '', 'type': 'local'},
|
|
||||||
{'key': 'cliName', 'value': '', 'type': 'local'},
|
|
||||||
{'key': 'whatsapp', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'provisional', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'pets', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'local', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'notify', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'fingerprint', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'access', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'panic', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'person', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'requestOSnotification', 'value': 'false', 'type': 'util'},
|
|
||||||
{'key': 'petAmountRegister', 'value': '', 'type': 'local'},
|
|
||||||
];
|
|
||||||
|
|
||||||
for (var data in initialData) {
|
|
||||||
await db.insert(DatabaseConfig.tableKeychain, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onOpen(Database db) async {
|
|
||||||
log('Checking existing data...');
|
|
||||||
await _checkExistingData(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onUpgrade(Database db, int oldVersion, int newVersion) async {
|
|
||||||
log('Upgrading database from version $oldVersion to $newVersion');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onDowngrade(Database db, int oldVersion, int newVersion) async {
|
|
||||||
log('Downgrading database from version $oldVersion to $newVersion');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onConfigure(Database db) async {
|
|
||||||
log('Configuring database...');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _checkExistingData(Database db) async {
|
|
||||||
try {
|
|
||||||
final maps = await db.query(DatabaseConfig.tableKeychain);
|
|
||||||
log('Existing data: $maps');
|
|
||||||
} catch (error) {
|
|
||||||
log('Error checking existing data: $error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> deleteDatabaseDB() async {
|
|
||||||
final path = await _getDatabasePath();
|
|
||||||
await deleteDatabase(path);
|
|
||||||
log('Database deleted');
|
|
||||||
_database = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<dynamic> get({String? key, String? field}) async {
|
|
||||||
try {
|
|
||||||
final db = await database;
|
|
||||||
List<Map<String, dynamic>> queryResult;
|
|
||||||
|
|
||||||
if (field != null && key != null) {
|
|
||||||
queryResult = await db.query(
|
|
||||||
DatabaseConfig.tableKeychain,
|
|
||||||
columns: [field],
|
|
||||||
where: '${DatabaseConfig.columnKey} = ?',
|
|
||||||
whereArgs: [key],
|
|
||||||
);
|
|
||||||
} else if (field != null) {
|
|
||||||
queryResult = await db.query(
|
|
||||||
DatabaseConfig.tableKeychain,
|
|
||||||
columns: [field],
|
|
||||||
);
|
|
||||||
} else if (key != null) {
|
|
||||||
field = DatabaseConfig.columnValue;
|
|
||||||
queryResult = await db.query(
|
|
||||||
DatabaseConfig.tableKeychain,
|
|
||||||
columns: [field],
|
|
||||||
where: '${DatabaseConfig.columnKey} = ?',
|
|
||||||
whereArgs: [key],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
queryResult = await db.query(DatabaseConfig.tableKeychain);
|
|
||||||
}
|
|
||||||
|
|
||||||
log('Query result for key: $key, field: $field -> $queryResult');
|
|
||||||
|
|
||||||
if (queryResult.isNotEmpty) {
|
|
||||||
return queryResult.first[field];
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
log('Error getting: $error');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<int> insert(String key, dynamic value, String? type) async {
|
|
||||||
final db = await database;
|
|
||||||
|
|
||||||
final Map<String, dynamic> data = {
|
|
||||||
DatabaseConfig.columnKey: key,
|
|
||||||
DatabaseConfig.columnValue: value.toString(),
|
|
||||||
DatabaseConfig.columnType: type,
|
|
||||||
DatabaseConfig.columnUpdateAt: DateTime.now().toIso8601String(),
|
|
||||||
DatabaseConfig.columnResolvedAt: null,
|
|
||||||
DatabaseConfig.columnCreatedAt: DateTime.now().toIso8601String(),
|
|
||||||
};
|
|
||||||
|
|
||||||
log('Inserting: $data');
|
|
||||||
return await db.insert(DatabaseConfig.tableKeychain, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<int> update(String key, dynamic value, String? type) async {
|
|
||||||
final db = await database;
|
|
||||||
|
|
||||||
final Map<String, dynamic> data = {
|
|
||||||
DatabaseConfig.columnKey: key,
|
|
||||||
if (value != null) DatabaseConfig.columnValue: value.toString(),
|
|
||||||
if (type != null) DatabaseConfig.columnType: type,
|
|
||||||
DatabaseConfig.columnUpdateAt: DateTime.now().toIso8601String(),
|
|
||||||
DatabaseConfig.columnResolvedAt: null,
|
|
||||||
DatabaseConfig.columnCreatedAt: DateTime.now().toIso8601String(),
|
|
||||||
};
|
|
||||||
|
|
||||||
log('Updating: $data');
|
|
||||||
return await db.update(
|
|
||||||
DatabaseConfig.tableKeychain,
|
|
||||||
data,
|
|
||||||
where: '${DatabaseConfig.columnKey} = ?',
|
|
||||||
whereArgs: [key],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<int> clear(String key) async {
|
|
||||||
final db = await database;
|
|
||||||
|
|
||||||
log('Setting value of key: $key to empty string');
|
|
||||||
return await db.update(
|
|
||||||
DatabaseConfig.tableKeychain,
|
|
||||||
{DatabaseConfig.columnValue: ''},
|
|
||||||
where: '${DatabaseConfig.columnKey} = ?',
|
|
||||||
whereArgs: [key],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<int> delete(String key) async {
|
|
||||||
final db = await database;
|
|
||||||
|
|
||||||
log('Deleting key: $key');
|
|
||||||
return await db.delete(
|
|
||||||
DatabaseConfig.tableKeychain,
|
|
||||||
where: '${DatabaseConfig.columnKey} = ?',
|
|
||||||
whereArgs: [key],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> purge() async {
|
|
||||||
await deleteDatabaseDB();
|
|
||||||
await database;
|
|
||||||
log('Purge');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
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';
|
||||||
|
|
||||||
|
class SecureStorageHelper extends ChangeNotifier implements Storage {
|
||||||
|
static final SecureStorageHelper _instance = SecureStorageHelper._internal();
|
||||||
|
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
|
||||||
|
|
||||||
|
factory SecureStorageHelper() => _instance;
|
||||||
|
|
||||||
|
SecureStorageHelper._internal();
|
||||||
|
|
||||||
|
static SecureStorageHelper get instance => _instance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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 {
|
||||||
|
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 {
|
||||||
|
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 {
|
||||||
|
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 {
|
||||||
|
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 {
|
||||||
|
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, Function(dynamic) cacheSetter) async {
|
||||||
|
if (value is String) {
|
||||||
|
await setAndCacheString(key, value, cacheSetter);
|
||||||
|
} else if (value is bool) {
|
||||||
|
await setAndCacheBool(key, value, cacheSetter);
|
||||||
|
} else if (value is BuildContext) {
|
||||||
|
await setAndCacheObject(key, value.toString(), cacheSetter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<dynamic> get(String key) async {
|
||||||
|
log('get value for key: $key');
|
||||||
|
var stringValue = await getString(key);
|
||||||
|
if (stringValue != null) return stringValue;
|
||||||
|
|
||||||
|
var boolValue = await getBool(key);
|
||||||
|
if (boolValue != null) return boolValue;
|
||||||
|
|
||||||
|
var objectValue = await getObject(key);
|
||||||
|
if (objectValue != null) return objectValue;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> delete(String key) async {
|
||||||
|
log('delete value for key: $key');
|
||||||
|
await _secureStorage.delete(key: key);
|
||||||
|
CacheUtil.instance.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> purge() async {
|
||||||
|
log('purge values');
|
||||||
|
await _secureStorage.deleteAll();
|
||||||
|
CacheUtil.instance.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
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';
|
||||||
|
|
||||||
|
class SharedPreferencesStorageHelper implements Storage {
|
||||||
|
static final SharedPreferencesStorageHelper _instance = SharedPreferencesStorageHelper._internal();
|
||||||
|
SharedPreferences? _prefs;
|
||||||
|
SharedPreferences? get prefs => _prefs;
|
||||||
|
set prefs(SharedPreferences? value) => _prefs = value;
|
||||||
|
|
||||||
|
factory SharedPreferencesStorageHelper() => _instance;
|
||||||
|
|
||||||
|
SharedPreferencesStorageHelper._internal();
|
||||||
|
|
||||||
|
static SharedPreferencesStorageHelper get instance => _instance;
|
||||||
|
|
||||||
|
bool _isFirstRun = true;
|
||||||
|
bool get isFirstRun => _isFirstRun;
|
||||||
|
set isFirstRun(bool value) => _setAndCacheBool('first_run', value, (v) => _isFirstRun = v);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Future<void> _setAndCache<T>(String key, T value, Function(T) cacheSetter, Future<void> Function(String, T) setFunc) 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, Function(dynamic) cacheSetter) async {
|
||||||
|
|
||||||
|
if (value is bool) {
|
||||||
|
await _prefs?.setBool(key, value);
|
||||||
|
} else if (value is String) {
|
||||||
|
await _prefs?.setString(key, value);
|
||||||
|
} else if (value is int) {
|
||||||
|
await _prefs?.setInt(key, value);
|
||||||
|
} else if (value is double) {
|
||||||
|
await _prefs?.setDouble(key, value);
|
||||||
|
} else if (value is List<String>) {
|
||||||
|
await _prefs?.setStringList(key, value);
|
||||||
|
}
|
||||||
|
CacheUtil.instance.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<dynamic> get(String key) 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 {
|
||||||
|
log('Deleting value for key: $key');
|
||||||
|
await _prefs?.remove(key);
|
||||||
|
CacheUtil.instance.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> purge() async {
|
||||||
|
log('Purging shared preferences');
|
||||||
|
await _prefs?.clear();
|
||||||
|
CacheUtil.instance.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,293 @@
|
||||||
|
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';
|
||||||
|
|
||||||
|
class DatabaseConfig {
|
||||||
|
static const String dbName = 'database.db';
|
||||||
|
static const int dbVersion = 1;
|
||||||
|
|
||||||
|
static const String tableKeychain = 'keychain';
|
||||||
|
static const String columnKey = 'key';
|
||||||
|
static const String columnValue = 'value';
|
||||||
|
static const String columnType = 'type';
|
||||||
|
static const String columnUpdateAt = 'updateAt';
|
||||||
|
static const String columnResolvedAt = 'resolvedAt';
|
||||||
|
static const String columnCreatedAt = 'createdAt';
|
||||||
|
|
||||||
|
static const List<Map<String, dynamic>> initialData = [
|
||||||
|
{'key': 'devUUID', 'value': '', 'type': 'user'},
|
||||||
|
{'key': 'userUUID', 'value': '', 'type': 'user'},
|
||||||
|
{'key': 'userDevUUID', 'value': '', 'type': 'user'},
|
||||||
|
{'key': 'status', 'value': '', 'type': 'user'},
|
||||||
|
{'key': 'userName', 'value': '', 'type': 'user'},
|
||||||
|
{'key': 'cliUUID', 'value': '', 'type': 'local'},
|
||||||
|
{'key': 'ownerUUID', 'value': '', 'type': 'local'},
|
||||||
|
{'key': 'cliName', 'value': '', 'type': 'local'},
|
||||||
|
{'key': 'whatsapp', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'provisional', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'pets', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'local', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'notify', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'fingerprint', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'access', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'panic', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'person', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'requestOSnotification', 'value': 'false', 'type': 'util'},
|
||||||
|
{'key': 'petAmountRegister', 'value': '', 'type': 'local'},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
class SQLiteStorageHelper implements Storage {
|
||||||
|
static final SQLiteStorageHelper _instance = SQLiteStorageHelper._internal();
|
||||||
|
static Database? _database;
|
||||||
|
static String? _databasePath;
|
||||||
|
|
||||||
|
factory SQLiteStorageHelper() => _instance;
|
||||||
|
|
||||||
|
SQLiteStorageHelper._internal();
|
||||||
|
|
||||||
|
static SQLiteStorageHelper get instance => _instance;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Future<Database> get database async {
|
||||||
|
log('Getting database instance');
|
||||||
|
if (_database != null) return _database!;
|
||||||
|
_database = await _initDatabase();
|
||||||
|
return _database!;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> _getDatabasePath() async {
|
||||||
|
log('Getting database path');
|
||||||
|
if (_databasePath != null) return _databasePath!;
|
||||||
|
final databasesPath = await getDatabasesPath();
|
||||||
|
_databasePath = join(databasesPath, DatabaseConfig.dbName);
|
||||||
|
log('Database path: $_databasePath');
|
||||||
|
return _databasePath!;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Database> _initDatabase() async {
|
||||||
|
log('Initializing database');
|
||||||
|
final path = await _getDatabasePath();
|
||||||
|
return await openDatabase(
|
||||||
|
path,
|
||||||
|
version: DatabaseConfig.dbVersion,
|
||||||
|
onCreate: _onCreate,
|
||||||
|
onOpen: _onOpen,
|
||||||
|
onUpgrade: _onUpgrade,
|
||||||
|
onDowngrade: _onDowngrade,
|
||||||
|
onConfigure: _onConfigure,
|
||||||
|
).catchError((error) {
|
||||||
|
log('Error initializing database: $error');
|
||||||
|
throw error;
|
||||||
|
}).whenComplete(() async {
|
||||||
|
log('Database initialization complete');
|
||||||
|
await setupLocalVariables();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onCreate(Database db, int version) async {
|
||||||
|
log('Creating tables...');
|
||||||
|
await db.execute('''
|
||||||
|
CREATE TABLE ${DatabaseConfig.tableKeychain} (
|
||||||
|
${DatabaseConfig.columnKey} TEXT UNIQUE,
|
||||||
|
${DatabaseConfig.columnValue} TEXT,
|
||||||
|
${DatabaseConfig.columnType} TEXT,
|
||||||
|
${DatabaseConfig.columnUpdateAt} TEXT,
|
||||||
|
${DatabaseConfig.columnResolvedAt} TEXT,
|
||||||
|
${DatabaseConfig.columnCreatedAt} TEXT
|
||||||
|
);
|
||||||
|
''');
|
||||||
|
await _insertInitialData(db);
|
||||||
|
log('Tables created');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _insertInitialData(Database db) async {
|
||||||
|
log('Inserting initial data');
|
||||||
|
final batch = db.batch();
|
||||||
|
for (var data in DatabaseConfig.initialData) {
|
||||||
|
batch.insert(DatabaseConfig.tableKeychain, data);
|
||||||
|
}
|
||||||
|
await batch.commit(noResult: true);
|
||||||
|
log('Initial data inserted');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onOpen(Database db) async {
|
||||||
|
log('Opening database');
|
||||||
|
await _checkExistingData(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onUpgrade(Database db, int oldVersion, int newVersion) async {
|
||||||
|
log('Upgrading database from version $oldVersion to $newVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onDowngrade(Database db, int oldVersion, int newVersion) async {
|
||||||
|
log('Downgrading database from version $oldVersion to $newVersion');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onConfigure(Database db) async {
|
||||||
|
log('Configuring database');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _checkExistingData(Database db) async {
|
||||||
|
log('Checking existing data');
|
||||||
|
try {
|
||||||
|
final maps = await db.query(DatabaseConfig.tableKeychain);
|
||||||
|
log('Existing data: $maps');
|
||||||
|
} catch (error) {
|
||||||
|
log('Error checking existing data: $error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Future<void> setupLocalVariables() async {
|
||||||
|
log('Setting up local variables');
|
||||||
|
try {
|
||||||
|
await _database?.transaction((txn) async {
|
||||||
|
final keys = [
|
||||||
|
'devUUID',
|
||||||
|
'userUUID',
|
||||||
|
'userDevUUID',
|
||||||
|
'status',
|
||||||
|
'userName',
|
||||||
|
'cliUUID',
|
||||||
|
'ownerUUID',
|
||||||
|
'cliName',
|
||||||
|
'petAmountRegister',
|
||||||
|
'whatsapp',
|
||||||
|
'provisional',
|
||||||
|
'pets',
|
||||||
|
'local',
|
||||||
|
'notify',
|
||||||
|
'fingerprint',
|
||||||
|
'access',
|
||||||
|
'panic',
|
||||||
|
'person',
|
||||||
|
'requestOSnotification'
|
||||||
|
];
|
||||||
|
|
||||||
|
for (var key in keys) {
|
||||||
|
log('Fetching value for key: $key');
|
||||||
|
final result = await txn.query(
|
||||||
|
DatabaseConfig.tableKeychain,
|
||||||
|
where: '${DatabaseConfig.columnKey} = ?',
|
||||||
|
whereArgs: [key],
|
||||||
|
);
|
||||||
|
log('Result for key $key: $result');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
log('Local variables setup complete');
|
||||||
|
} catch (error) {
|
||||||
|
log('Error setting up local variables: $error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> getBoolean(String key) async {
|
||||||
|
log('Getting boolean value for key: $key');
|
||||||
|
final value = await get(key);
|
||||||
|
return value == 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<dynamic> get(String key) async {
|
||||||
|
log('Getting value for key: $key');
|
||||||
|
final cachedValue = CacheUtil().get(key);
|
||||||
|
if (cachedValue != null) {
|
||||||
|
log('Found cached value for key: $key');
|
||||||
|
return cachedValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
final db = await database;
|
||||||
|
final result = await db.query(
|
||||||
|
DatabaseConfig.tableKeychain,
|
||||||
|
columns: [DatabaseConfig.columnValue],
|
||||||
|
where: '${DatabaseConfig.columnKey} = ?',
|
||||||
|
whereArgs: [key],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.isNotEmpty) {
|
||||||
|
final value = result.first[DatabaseConfig.columnValue];
|
||||||
|
CacheUtil().set(key, value);
|
||||||
|
log('Value for key $key: $value');
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
log('No value found for key: $key');
|
||||||
|
return null;
|
||||||
|
} catch (error) {
|
||||||
|
log('Error getting value for key $key: $error');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 database;
|
||||||
|
final data = {
|
||||||
|
DatabaseConfig.columnKey: key,
|
||||||
|
DatabaseConfig.columnValue: value.toString(),
|
||||||
|
DatabaseConfig.columnUpdateAt: DateTime.now().toIso8601String(),
|
||||||
|
DatabaseConfig.columnCreatedAt: DateTime.now().toIso8601String(),
|
||||||
|
};
|
||||||
|
|
||||||
|
final result = await db.insert(
|
||||||
|
DatabaseConfig.tableKeychain,
|
||||||
|
data,
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
|
);
|
||||||
|
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 database;
|
||||||
|
final result = await db.transaction((txn) async {
|
||||||
|
return await txn.delete(
|
||||||
|
DatabaseConfig.tableKeychain,
|
||||||
|
where: '${DatabaseConfig.columnKey} = ?',
|
||||||
|
whereArgs: [key],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
log('Value deleted for key: $key');
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> purge() async {
|
||||||
|
log('Purging database');
|
||||||
|
await deleteDatabaseDB();
|
||||||
|
await database;
|
||||||
|
log('Database purged');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteDatabaseDB() async {
|
||||||
|
log('Deleting database');
|
||||||
|
final path = await _getDatabasePath();
|
||||||
|
await deleteDatabase(path);
|
||||||
|
log('Database deleted');
|
||||||
|
_database = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class SqliteStorageDelegate {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import 'package:local_auth/local_auth.dart';
|
||||||
|
|
||||||
|
class BiometricHelper {
|
||||||
|
static final LocalAuthentication auth = LocalAuthentication();
|
||||||
|
|
||||||
|
static Future<bool> checkBiometrics() async {
|
||||||
|
try {
|
||||||
|
return await auth.canCheckBiometrics;
|
||||||
|
} catch (e) {
|
||||||
|
// Log or handle the error
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<bool> authenticateBiometric() async {
|
||||||
|
try {
|
||||||
|
return await auth.authenticate(
|
||||||
|
localizedReason: 'Scan your fingerprint to authenticate',
|
||||||
|
options: const AuthenticationOptions(
|
||||||
|
biometricOnly: true,
|
||||||
|
stickyAuth: true,
|
||||||
|
useErrorDialogs: true,
|
||||||
|
sensitiveTransaction: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
// Log or handle the error
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
class CacheUtil {
|
||||||
|
static final CacheUtil _instance = CacheUtil._internal();
|
||||||
|
static final Map<String, dynamic> _cache = {};
|
||||||
|
|
||||||
|
CacheUtil._internal();
|
||||||
|
|
||||||
|
factory CacheUtil() => _instance;
|
||||||
|
|
||||||
|
static CacheUtil get instance => _instance;
|
||||||
|
|
||||||
|
void set(String key, dynamic value) {
|
||||||
|
_cache[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic get(String key) {
|
||||||
|
return _cache[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool containsKey(String key) {
|
||||||
|
return _cache.containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic getOrElse(String key, dynamic fallback) {
|
||||||
|
return _cache.containsKey(key) ? _cache[key] : fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
void delete(String key) {
|
||||||
|
_cache.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
_cache.clear();
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ class DeviceUtil {
|
||||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||||
return androidDeviceInfo.id; // unique ID on Android
|
return androidDeviceInfo.id; // unique ID on Android
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<String?> getSerialNumber() async {
|
static Future<String?> getSerialNumber() async {
|
||||||
|
@ -31,5 +32,6 @@ class DeviceUtil {
|
||||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||||
return androidDeviceInfo.serialNumber; // unique ID on Android
|
return androidDeviceInfo.serialNumber; // unique ID on Android
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ class ImageUtils {
|
||||||
String base64Image = base64Encode(imageBytes);
|
String base64Image = base64Encode(imageBytes);
|
||||||
return base64Image;
|
return base64Image;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<FFUploadedFile> convertToUploadFile(String img) async {
|
static Future<FFUploadedFile> convertToUploadFile(String img) async {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
|
||||||
import 'package:hub/backend/api_requests/api_calls.dart';
|
import 'package:hub/backend/api_requests/api_calls.dart';
|
||||||
|
|
||||||
class LogUtil {
|
class LogUtil {
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
import 'package:hub/shared/helpers/db_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:share_plus/share_plus.dart';
|
||||||
|
|
||||||
class ShareUtil {
|
class ShareUtil {
|
||||||
static Future<void> showShare(payload) async {
|
static Future<void> showShare(payload) async {
|
||||||
final DatabaseHelper db = DatabaseHelper();
|
final cliName = StorageUtil().cliName;
|
||||||
final cliName = await db
|
final cliUUID = StorageUtil().cliUUID;
|
||||||
.get(key: 'cliName', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
final cliUUID = await db
|
|
||||||
.get(key: 'cliUUID', field: 'value')
|
|
||||||
.then((value) => value.toString());
|
|
||||||
|
|
||||||
for (var i = 0; i < payload['convites'].length; i++) {
|
for (var i = 0; i < payload['convites'].length; i++) {
|
||||||
await Share.share('''
|
await Share.share('''
|
||||||
|
@ -20,7 +16,7 @@ Olá, \*${payload['convites'][i]['VTE_NOME']}\*! Você foi convidado para \*$cli
|
||||||
- Fim: ${payload['convites'][i]['VAW_DTFIM']}
|
- Fim: ${payload['convites'][i]['VAW_DTFIM']}
|
||||||
|
|
||||||
URL do Convite: https://visita.freaccess.com.br/${payload['convites'][i]['VAW_ID']}/$cliUUID/${payload['convites'][i]['VAW_CHAVE']}
|
URL do Convite: https://visita.freaccess.com.br/${payload['convites'][i]['VAW_ID']}/$cliUUID/${payload['convites'][i]['VAW_CHAVE']}
|
||||||
''');
|
''');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue