Merge pull request #11 from FRE-Informatica/develop

Develop
This commit is contained in:
Ivan Antunes 2024-08-14 09:42:04 -03:00 committed by GitHub
commit 10668c9f97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
49 changed files with 4247 additions and 4636 deletions

View File

@ -1,4 +1,7 @@
PODS: PODS:
- connectivity_plus (0.0.1):
- Flutter
- FlutterMacOS
- device_info_plus (0.0.1): - device_info_plus (0.0.1):
- Flutter - Flutter
- DKImagePickerController/Core (4.3.9): - DKImagePickerController/Core (4.3.9):
@ -225,6 +228,7 @@ PODS:
- Flutter - Flutter
DEPENDENCIES: DEPENDENCIES:
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
@ -271,6 +275,8 @@ SPEC REPOS:
- SwiftyGif - SwiftyGif
EXTERNAL SOURCES: EXTERNAL SOURCES:
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/darwin"
device_info_plus: device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios" :path: ".symlinks/plugins/device_info_plus/ios"
file_picker: file_picker:
@ -313,6 +319,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios" :path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60

View File

@ -41,6 +41,8 @@
4C588A6A63D12FBFE8C3D586 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; }; 4C588A6A63D12FBFE8C3D586 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = "<group>"; };
4C7A2C30DCF835BA60FAD235 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; 4C7A2C30DCF835BA60FAD235 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
50BE974D08F66282C0031620 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; 50BE974D08F66282C0031620 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
6436409127A31CDB00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
6436409227A31CD800820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--Flutter View Controller--> <!--Flutter View Controller-->
@ -14,13 +16,14 @@
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/> <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view> </view>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="-16" y="-40"/>
</scene> </scene>
</scenes> </scenes>
</document> </document>

View File

@ -22,7 +22,6 @@ import 'package:url_launcher/url_launcher.dart';
import '../shared/utils/log_util.dart'; import '../shared/utils/log_util.dart';
Future<void> openTermsOfUse(BuildContext context) async { Future<void> openTermsOfUse(BuildContext context) async {
log('openTermsOfUse');
final Uri url = Uri.parse('https://freaccess.com.br/pp/'); final Uri url = Uri.parse('https://freaccess.com.br/pp/');
if (!await launchUrl(url)) { if (!await launchUrl(url)) {
throw Exception('Could not launch $url'); throw Exception('Could not launch $url');
@ -90,7 +89,6 @@ Future<Color> manageStatusColorAction(
BuildContext context, { BuildContext context, {
required String? visitStatusStr, required String? visitStatusStr,
}) async { }) async {
log('visitStatusStr: $visitStatusStr');
if (visitStatusStr == 'A') { if (visitStatusStr == 'A') {
return FlutterFlowTheme.of(context).success; return FlutterFlowTheme.of(context).success;
} else if ((visitStatusStr == 'C') || } else if ((visitStatusStr == 'C') ||
@ -322,40 +320,28 @@ Future toggleHomePage(BuildContext context) async {
); );
} }
Future<bool> visitRequestComponentAction( Future<bool> visitCancelAction(BuildContext context,
BuildContext context, { {required int? idDestino,
required String? actionValue, required int? idVisita,
required String? refUUID, required String? accessKey,
required String? responseValue, required String? email}) async {
required String? vteUUID, ApiCallResponse? apiCallResponse;
}) async {
ApiCallResponse? respondeSolicitacaoCall;
respondeSolicitacaoCall = await PhpGroup.respondeSolicitacaoCall.call( apiCallResponse = await PhpGroup.cancelaVisita.call(
userUUID: FFAppState().userUUID, userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID, devUUID: FFAppState().devUUID,
cliUUID: FFAppState().cliUUID, cliID: FFAppState().cliUUID,
atividade: 'respondeSolicitacao', atividade: 'cancelaVisita',
referencia: refUUID, idDestino: idDestino,
tarefa: actionValue, idVisita: idVisita,
resposta: responseValue, AccessKey: accessKey,
idVisitante: vteUUID, UsuEmail: email,
DevDesc: '',
); );
if (respondeSolicitacaoCall.statusCode == 200) { if (apiCallResponse.statusCode == 200) {
return true; return !apiCallResponse.jsonBody['error'];
} else { } else {
log('headers: ${respondeSolicitacaoCall.headers}');
log('bodyText: ${respondeSolicitacaoCall.bodyText}');
log('jsonBody: ${respondeSolicitacaoCall.jsonBody}');
log('userUUID: ${FFAppState().userUUID}');
log('devUUID: ${FFAppState().devUUID}');
log('cliUUID: ${FFAppState().cliUUID}');
log('atividade: respondeSolicitacao');
log('referencia: $refUUID');
log('tarefa: $actionValue');
log('resposta: $responseValue');
log('idVisitante: $vteUUID');
return false; return false;
} }
} }
@ -401,7 +387,6 @@ Future<bool> checkLocals({
// Verificação rápida de erro para evitar processamento desnecessário. // Verificação rápida de erro para evitar processamento desnecessário.
if (response.jsonBody['error']) { if (response.jsonBody['error']) {
log("checkLocals => Erro encontrado na resposta");
return false; return false;
} }
@ -413,10 +398,8 @@ Future<bool> checkLocals({
// Log e retorno condicional baseado no resultado da busca. // Log e retorno condicional baseado no resultado da busca.
if (itemFound) { if (itemFound) {
log("checkLocals => Item encontrado com CLI_ID $uuid e CLU_STATUS A");
return true; return true;
} else { } else {
log("checkLocals => Item não encontrado com CLI_ID $uuid e CLU_STATUS A");
// A chamada para showModalBottomSheet permanece, mas a atualização da UI é otimizada. // A chamada para showModalBottomSheet permanece, mas a atualização da UI é otimizada.
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
@ -439,54 +422,50 @@ Future<bool> checkLocals({
} }
} }
Future answersRequest(BuildContext context, String? ref, String? task,
String? response, String? id) async {
ApiCallResponse? respondeSolicitacaoCall;
respondeSolicitacaoCall = await PhpGroup.respondeSolicitacaoCall.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliUUID: FFAppState().cliUUID,
atividade: 'respondeSolicitacao',
referencia: ref,
tarefa: task,
resposta: response,
idVisitante: id,
);
if (respondeSolicitacaoCall.statusCode == 200) {
return !respondeSolicitacaoCall.jsonBody['error'];
} else {
return false;
}
}
Future changeStatusAction( Future changeStatusAction(
BuildContext context, BuildContext context,
String status, int idDestino,
String vawREF, int idVisita,
String msg, String accessKey,
String vteUUID, String email,
) async { ) async {
log('status: $status');
switch (status) {
case 'L':
Navigator.pop(context, true);
bool? approveVisitRequest;
approveVisitRequest = await visitRequestComponentAction(
context,
actionValue: status,
refUUID: vawREF,
responseValue: msg,
vteUUID: vteUUID,
);
if (!context.mounted) return;
if (approveVisitRequest == true) {
log('Aprovado');
} else {
log('Erro ao aprovar');
}
break;
case 'B':
Navigator.pop(context, true); Navigator.pop(context, true);
bool? blockVisitRequest; bool? blockVisitRequest;
blockVisitRequest = await visitRequestComponentAction( blockVisitRequest = await visitCancelAction(
context, context,
actionValue: status, accessKey: accessKey,
refUUID: vawREF, idDestino: idDestino,
responseValue: msg, idVisita: idVisita,
vteUUID: vteUUID, email: email,
); );
if (!context.mounted) return; if (!context.mounted) return;
if (blockVisitRequest == true) { if (blockVisitRequest == true) {
log('Bloqueado'); return true;
} else { } else {
log('Erro ao bloquear'); return false;
}
break;
default:
break;
} }
} }
@ -497,8 +476,6 @@ Uint8List assembleQRPacket(int direction, String identifier, String password) {
String paddedBadge = identifier.padLeft(30, '0'); String paddedBadge = identifier.padLeft(30, '0');
log("Badge: $paddedBadge");
for (var i = 0; i < paddedBadge.length; i += 2) { for (var i = 0; i < paddedBadge.length; i += 2) {
packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16)); packet.add(int.parse(paddedBadge.substring(i, i + 2), radix: 16));
} }
@ -540,8 +517,6 @@ Uint8List assembleQRPacket(int direction, String identifier, String password) {
var bytes = var bytes =
packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' ')); packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' '));
log("Pacote: $packet");
log("Bytes: $bytes");
return Uint8List.fromList(packet); return Uint8List.fromList(packet);
} }
@ -577,7 +552,6 @@ Widget buildQrCode(
required String pass, required String pass,
required int direction}) { required int direction}) {
try { try {
log("pass: $pass");
const Color backgroundColor = Colors.white; const Color backgroundColor = Colors.white;
const Color foregroundColor = Colors.black; const Color foregroundColor = Colors.black;
return QrImageView.withQr( return QrImageView.withQr(
@ -779,3 +753,22 @@ Future accessQRCodeOptAction(BuildContext context) async {
}, },
); );
} }
enum status { active, unknown, canceled, finished, blocked, inactive }
status? getStatus(dynamic data) {
switch (data) {
case 'A':
return status.active;
case 'F':
return status.finished;
case 'B':
return status.blocked;
case 'C':
return status.canceled;
case 'I':
return status.inactive;
default:
return status.unknown;
}
}

View File

@ -20,7 +20,6 @@ class FFAppState extends ChangeNotifier {
return await auth.canCheckBiometrics; return await auth.canCheckBiometrics;
} catch (e) { } catch (e) {
clearBiometricAuthentication(); clearBiometricAuthentication();
debugPrint('Error checking biometrics: $e');
return false; return false;
} }
} }
@ -44,8 +43,6 @@ class FFAppState extends ChangeNotifier {
// Salvar o estado de autenticação biométrica, se necessário // Salvar o estado de autenticação biométrica, se necessário
} }
} catch (e) { } catch (e) {
print(e);
debugPrint('Error authenticating: $e');
clearBiometricAuthentication(); clearBiometricAuthentication();
return Future.error(e); return Future.error(e);
} }

View File

@ -12,7 +12,6 @@ export 'api_manager.dart' show ApiCallResponse;
const _kPrivateApiFunctionName = 'ffPrivateApiCall'; const _kPrivateApiFunctionName = 'ffPrivateApiCall';
/// Start PHP Group Code /// Start PHP Group Code
class PhpGroup { class PhpGroup {
@ -47,6 +46,128 @@ class PhpGroup {
static ChangeNotifica changeNotifica = ChangeNotifica(); static ChangeNotifica changeNotifica = ChangeNotifica();
static RespondeVinculo resopndeVinculo = RespondeVinculo(); static RespondeVinculo resopndeVinculo = RespondeVinculo();
static ChangePass changePass = ChangePass(); static ChangePass changePass = ChangePass();
static ChangePanic changePanic = ChangePanic();
static DeleteAccount deleteAccount = DeleteAccount();
static CancelaVisita cancelaVisita = CancelaVisita();
}
class CancelaVisita {
Future<ApiCallResponse> call({
String? devUUID = '',
String? userUUID = '',
String? cliID = '',
String? atividade = '',
int? idDestino,
int? idVisita,
String? AccessKey = '',
String? UsuEmail = '',
String? DevDesc = '',
}) async {
final baseUrl = PhpGroup.getBaseUrl();
return ApiManager.instance.makeApiCall(
callName: 'cancelaVisita',
apiUrl: '$baseUrl/processRequest.php',
callType: ApiCallType.POST,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
params: {
'devUUID': devUUID,
'userUUID': userUUID,
'atividade': atividade,
'cliID': cliID,
'idVisita': idVisita,
'AccessKey': AccessKey,
'UsuEmail': UsuEmail,
'DevDesc': DevDesc,
},
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true,
encodeBodyUtf8: false,
decodeUtf8: false,
cache: false,
alwaysAllowBody: false,
);
}
bool? error(dynamic response) => castToType<bool>(getJsonField(
response,
r'''$.error''',
));
}
class DeleteAccount {
Future<ApiCallResponse> call({
String? devUUID = '',
String? userUUID = '',
}) async {
final baseUrl = PhpGroup.getBaseUrl();
return ApiManager.instance.makeApiCall(
callName: 'deleteAccount',
apiUrl: '$baseUrl/deleteAccount.php',
callType: ApiCallType.POST,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
params: {
'devUUID': devUUID,
'userUUID': userUUID,
},
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true,
encodeBodyUtf8: false,
decodeUtf8: false,
cache: false,
isStreamingApi: false,
alwaysAllowBody: false,
);
}
bool? error(dynamic response) => castToType<bool>(getJsonField(
response,
r'''$.error''',
));
}
class ChangePanic {
Future<ApiCallResponse> call({
String? devUUID = '',
String? userUUID = '',
String? cliID = '',
String? atividade = '',
String? newSenhaPanico = '',
}) async {
final baseUrl = PhpGroup.getBaseUrl();
return ApiManager.instance.makeApiCall(
callName: 'changePass',
apiUrl: '$baseUrl/processRequest.php',
callType: ApiCallType.POST,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
params: {
'devUUID': devUUID,
'userUUID': userUUID,
'cliID': cliID,
'atividade': atividade,
'newSenhaPanico': newSenhaPanico,
},
bodyType: BodyType.X_WWW_FORM_URL_ENCODED,
returnBody: true,
encodeBodyUtf8: false,
decodeUtf8: false,
cache: false,
isStreamingApi: false,
alwaysAllowBody: false,
);
}
bool? error(dynamic response) => castToType<bool>(getJsonField(
response,
r'''$.error''',
));
} }
class ChangePass { class ChangePass {
@ -100,7 +221,7 @@ class RespondeVinculo {
return ApiManager.instance.makeApiCall( return ApiManager.instance.makeApiCall(
callName: 'respondeVinculo', callName: 'respondeVinculo',
apiUrl: '$baseUrl/processRequest.php', apiUrl: '$baseUrl/responderVinculo.php',
callType: ApiCallType.POST, callType: ApiCallType.POST,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
@ -120,7 +241,6 @@ class RespondeVinculo {
alwaysAllowBody: false, alwaysAllowBody: false,
); );
} }
} }
class ChangeNotifica { class ChangeNotifica {
@ -2405,9 +2525,7 @@ String _serializeList(List? list) {
try { try {
return json.encode(list, toEncodable: _toEncodable); return json.encode(list, toEncodable: _toEncodable);
} catch (_) { } catch (_) {
if (kDebugMode) { if (kDebugMode) {}
log("List serialization failed. Returning empty list.");
}
return '[]'; return '[]';
} }
} }
@ -2417,9 +2535,7 @@ String _serializeJson(dynamic jsonVar, [bool isList = false]) {
try { try {
return json.encode(jsonVar, toEncodable: _toEncodable); return json.encode(jsonVar, toEncodable: _toEncodable);
} catch (_) { } catch (_) {
if (kDebugMode) { if (kDebugMode) {}
log("Json serialization failed. Returning empty json.");
}
return isList ? '[]' : '{}'; return isList ? '[]' : '{}';
} }
} }

View File

@ -2,6 +2,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:core'; import 'dart:core';
import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
@ -15,9 +16,6 @@ import '/flutter_flow/uploaded_file.dart';
import 'get_streamed_response.dart'; import 'get_streamed_response.dart';
enum ApiCallType { enum ApiCallType {
GET, GET,
POST, POST,
@ -413,6 +411,7 @@ class ApiManager {
ApiCallOptions? options, ApiCallOptions? options,
http.Client? client, http.Client? client,
}) async { }) async {
final callOptions = options ?? final callOptions = options ??
ApiCallOptions( ApiCallOptions(
callName: callName, callName: callName,

View File

@ -4,8 +4,6 @@ import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'dart:math' as math; import 'dart:math' as math;
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -17,11 +15,16 @@ import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart'; import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/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/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
// //
class PushNotificationService { class PushNotificationService {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin = final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
@ -57,10 +60,7 @@ class PushNotificationService {
sound: true, sound: true,
); );
if (settings.authorizationStatus == AuthorizationStatus.authorized) { if (settings.authorizationStatus == AuthorizationStatus.authorized) {
log('User granted permission'); } else {}
} else {
log('User declined or has not accepted permission');
}
} }
Map<String, dynamic> validJsonFromString(String? jsonString) { Map<String, dynamic> validJsonFromString(String? jsonString) {
@ -99,13 +99,10 @@ class PushNotificationService {
// Passo 4: Decodificar o JSON corrigido // Passo 4: Decodificar o JSON corrigido
return jsonDecode(correctedJson); return jsonDecode(correctedJson);
} catch (e) { } catch (e) {
log('Error decoding JSON: $e');
return {}; return {};
} }
} }
void _initializeLocalNotifications( void _initializeLocalNotifications(
BehaviorSubject<BuildContext> context) async { BehaviorSubject<BuildContext> context) async {
while (context.valueOrNull == null) { while (context.valueOrNull == null) {
@ -126,18 +123,12 @@ class PushNotificationService {
_flutterLocalNotificationsPlugin.initialize( _flutterLocalNotificationsPlugin.initialize(
initializationSettings, initializationSettings,
onDidReceiveNotificationResponse: (NotificationResponse response) async { onDidReceiveNotificationResponse: (NotificationResponse response) async {
log('Response payload:${response.payload}');
if (response.payload != null) { if (response.payload != null) {
try { try {
Map<String, dynamic> message = Map<String, dynamic> message = validJsonFromString(response.payload!);
validJsonFromString(response.payload!);
log('Notification payload: $message');
var data = _notificationDetails; // Assuming getOnMessage() now returns the latest RemoteMessage var data = _notificationDetails; // Assuming getOnMessage() now returns the latest RemoteMessage
log('Extra: ${data.value}');
_handleNotificationClick(message, extra: data.value); _handleNotificationClick(message, extra: data.value);
} catch (e) { } catch (e) {}
log('Error decoding notification payload: $e');
}
} }
}, },
); );
@ -173,8 +164,7 @@ class PushNotificationService {
void _listenToForegroundMessages(BuildContext context) { void _listenToForegroundMessages(BuildContext context) {
FirebaseMessaging.onMessage.listen((RemoteMessage message) { FirebaseMessaging.onMessage.listen((RemoteMessage message) {
log('Got a message whilst in the foreground!'); log("Message Foregroud: ${message.data}");
log('Message data: ${message.toMap()}');
_onMessage.add(message); _onMessage.add(message);
_notificationDetails.add(message.toMap()['notification']); _notificationDetails.add(message.toMap()['notification']);
_showNotification(message); _showNotification(message);
@ -187,31 +177,25 @@ class PushNotificationService {
void _listenToNotificationClicks(BuildContext context) { void _listenToNotificationClicks(BuildContext context) {
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
log('Notification clicked!');
_onMessage.add(message); _onMessage.add(message);
log('Extra: ${message.notification?.body}'); NotificationHandler().handleMessage(message.data, context);
NotificationHandler().handleMessage(message.data, context); }); });
} }
void configureTokenRefresh() { void configureTokenRefresh() {
_firebaseMessaging.onTokenRefresh.listen(_handleTokenUpdate).onError((err) { _firebaseMessaging.onTokenRefresh
log("Error refreshing token: $err"); .listen(_handleTokenUpdate)
}); .onError((err) {});
} }
Future<void> _updateToken(String token) async { Future<void> _updateToken(String token) async {
FFAppState().token = token; FFAppState().token = token;
final ApiCallResponse? response = await _updateTokenOnServer(token); final ApiCallResponse? response = await _updateTokenOnServer(token);
if (_isTokenUpdateSuccessful(response)) { if (_isTokenUpdateSuccessful(response)) {
log('Token updated successfully on server. Token: $token'); } else {}
} else {
log('Error updating token on server');
}
} }
Future<void> _handleTokenUpdate(String newToken) async { Future<void> _handleTokenUpdate(String newToken) async {
log('Token refreshed: $newToken');
await _updateToken(newToken); await _updateToken(newToken);
} }
@ -224,11 +208,8 @@ class PushNotificationService {
final String? deviceToken = await _firebaseMessaging.getToken(); final String? deviceToken = await _firebaseMessaging.getToken();
if (deviceToken != null) { if (deviceToken != null) {
log('Push Messaging token: $deviceToken');
await _updateToken(deviceToken); await _updateToken(deviceToken);
} else { } else {}
log('Failed to get Firebase Messaging token');
}
} }
Future<NotificationSettings> _requestNotificationPermission() async { Future<NotificationSettings> _requestNotificationPermission() async {
@ -278,10 +259,8 @@ class PushNotificationService {
priority: Priority.high, priority: Priority.high,
); );
var iOSDetails = DarwinNotificationDetails(); var iOSDetails = DarwinNotificationDetails();
var generalNotificationDetails = var generalNotificationDetails = NotificationDetails(android: androidDetails, iOS: iOSDetails);
NotificationDetails(android: androidDetails, iOS: iOSDetails);
log('Showing notification: ${message.messageId.hashCode}');
await _flutterLocalNotificationsPlugin.show( await _flutterLocalNotificationsPlugin.show(
// DateTime.now().millisecondsSinceEpoch % (1 << 31), // DateTime.now().millisecondsSinceEpoch % (1 << 31),
math.Random().nextInt(1 << 30), math.Random().nextInt(1 << 30),
@ -292,39 +271,32 @@ class PushNotificationService {
); );
} }
_handleNotificationClick(Map<String, dynamic> payload, {Map<String, dynamic> extra = const {}}) { _handleNotificationClick(Map<String, dynamic> payload,
{Map<String, dynamic> extra = const {}}) {
switch (payload.isNotEmpty) { switch (payload.isNotEmpty) {
case true: case true:
// Print the 'data' property // Print the 'data' property
log('Notification payload: $payload');
log('Extra: $extra');
// Handle the message data as needed // Handle the message data as needed
NotificationHandler().handleMessage(payload, _context.value, extra: extra.isEmpty ? {} : extra); NotificationHandler().handleMessage(payload, _context.value, extra: extra.isEmpty ? {} : extra);
// Access the 'data' property of 'RemoteMessage' // Access the 'data' property of 'RemoteMessage'
case false: case false:
log('Notification payload is empty');
// Handle the message notification as needed // Handle the message notification as needed
break; break;
} }
} }
static Future<void> _firebaseMessagingBackgroundHandler( static Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
RemoteMessage message) async { log("Mensagem firebase: $message");
log('Handling a background message: ${message.messageId}');
} }
} }
class NotificationHandler { class NotificationHandler {
void handleMessage(Map<String, dynamic> message, BuildContext context, {Map<String, dynamic> extra = const {}}) { void handleMessage(Map<String, dynamic> message, BuildContext context, {Map<String, dynamic> extra = const {}}) {
log('Notification Received!'); message.forEach((key, value) {});
message.forEach((key, value) {
log('$key: $value');
});
switch (message['click_action']) { switch (message['click_action']) {
case 'visit_request': case 'visit_request':
_showVisitRequestDialog(message, context); _showVisitRequestDialog(message, context);
break; break;
case '': case '':
break; break;
@ -332,13 +304,12 @@ class NotificationHandler {
_showAcessNotificationModal(message, context); _showAcessNotificationModal(message, context);
break; break;
case 'mensagem': case 'mensagem':
log("Extra Handle Message: $extra");
_showMessageNotificationDialog(message, context, extra); _showMessageNotificationDialog(message, context, extra);
break; break;
case 'enroll_cond': case 'enroll_cond':
log('enroll_cond');
break; break;
default: default:
log('Notification type not recognized');
} }
} }
@ -358,10 +329,6 @@ class NotificationHandler {
void _showAcessNotificationModal( void _showAcessNotificationModal(
Map<String, dynamic> message, BuildContext context) { Map<String, dynamic> message, BuildContext context) {
log('Showing access notification dialog');
log('USR_TIPO: ${message['USR_TIPO']}');
log('USR_ID: ${message['USR_ID']}');
log('USR_DOCUMENTO: ${message['USR_DOCUMENTO']}');
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -385,46 +352,199 @@ class NotificationHandler {
); );
} }
void _showMessageNotificationDialog( void _showMessageNotificationDialog(Map<String, dynamic> message, BuildContext context, Map<String, dynamic> extra) {
Map<String, dynamic> message, BuildContext context, Map<String, dynamic> extra) {
log('Showing message notification dialog');
log('Notification "message": $message');
showDialog( showDialog(
useSafeArea: true, useSafeArea: true,
barrierDismissible: true,
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Dialog( String localId = '';
try {
localId = jsonDecode(message['local'])['CLI_ID'];
} catch(e, s) {
localId = message['local']['CLI_ID'].toString();
}
log("Mensagem: $message");
log("Extra: $extra");
return GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Dialog(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
child: GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: MessageNotificationModalTemplateComponentWidget( child: MessageNotificationModalTemplateComponentWidget(
id: message['local']['CLI_ID'].toString(), id: localId,
from: message['remetente'].toString(), from: message['remetente'].toString(),
to: message['destinatario'].toString() == 'O' ? 'Morador' : 'Visitante', to: message['destinatario'].toString() == 'O'
message: extra['body'].toString().isEmpty ? 'Unknown' : extra['body'].toString(), ? 'Morador'
: 'Visitante',
message: extra['body'].toString().isEmpty
? 'Unknown'
: extra['body'].toString(),
),
),
),
),
), ),
); );
}, },
); );
} }
void _showVisitRequestDialog( void _showVisitRequestDialog(
Map<String, dynamic> message, BuildContext context) { Map<String, dynamic> message, BuildContext context) {
log('Showing visit request notification dialog');
showDialog( showDialog(
context: context, context: context,
barrierDismissible: true,
// barrierColor: Colors.green,
builder: (BuildContext context) { builder: (BuildContext context) {
_getIdBasedOnUserType(message); _getIdBasedOnUserType(message);
return Dialog( return Dialog(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
child: DetailsComponentWidget( child: DetailsComponentWidget(
vteName: message['mensagem'] ?? 'Unknown', buttons: [
vteReason: message['motivo'] ?? 'Unknown', FlutterFlowIconButton(
vteMsg: message['mensagem'] ?? 'Unknown', icon: const Icon(Icons.done),
vteDocument: message['documento'] ?? '', onPressed: () async {
vteUUID: message['idVisitante'].toString(), showDialog(
vawRef: message['referencia'].toString(), context: context,
vawStatus: 'S', builder: (context) {
changeStatusAction: changeStatusAction, return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Aprovar Visita',
enText: 'Approve Visit',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja aprovar essa visita?',
enText:
'Are you sure you want to approve this visit?',
),
),
backgroundColor:
FlutterFlowTheme.of(context).primaryBackground,
actions: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context)
.primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context)
.primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
onPressed: () async {
await answersRequest.call(
context,
message['referencia'].toString(),
'L',
'Mensagem',
message['idVisitante'].toString(),
);
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context)
.primaryBackground,
textStyle: TextStyle(
color:
FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
);
});
},
),
FlutterFlowIconButton(
icon: const Icon(Icons.close),
onPressed: () async {
showAlertDialog(
context,
FFLocalizations.of(context).getVariableText(
ptText: 'Bloquear Visita',
enText: 'Block Visit',
),
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja bloquear essa visita?',
enText: 'Are you sure you want to block this visit?',
), () async {
await answersRequest.call(
context,
message['referencia'].toString(),
'B',
'Mensagem',
message['idVisitante'].toString(),
);
});
},
),
],
labelsHashMap: Map<String, String>.from({
FFLocalizations.of(context).getVariableText(
enText: 'Visitor',
ptText: 'Visitante',
): message['nomevisita'],
FFLocalizations.of(context).getVariableText(
enText: 'Reason',
ptText: 'Motivo',
): message['motivo'],
FFLocalizations.of(context).getVariableText(
enText: 'Message',
ptText: 'Mensagem',
): message['mensagem'],
}),
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${message['documento'] ?? ''}&tipo=E',
statusHashMap: [
{
FFLocalizations.of(context).getVariableText(
enText: 'Active',
ptText: 'Ativo',
): FlutterFlowTheme.of(context).warning,
},
],
// changeStatusAction: answersRequest,
), ),
); );
}, },
@ -448,6 +568,4 @@ class PushNotificationManager {
void dispose() { void dispose() {
_onMessageReceivedController.close(); _onMessageReceivedController.close();
} }
} }

View File

@ -1,90 +1 @@
// import 'package:f_r_e_hub/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart';
// import 'package:firebase_messaging/firebase_messaging.dart';
// import 'package:flutter/material.dart';
// import 'package:rxdart/rxdart.dart';
// class NotificationHandler {
// // Criar BehaviorSubjects para mensagens em primeiro plano e mensagens que abriram o app
// final BehaviorSubject<RemoteMessage> _onMessage =
// BehaviorSubject<RemoteMessage>();
// final BehaviorSubject<RemoteMessage> _onMessageOpenedApp =
// BehaviorSubject<RemoteMessage>();
// // Inicializar listeners no construtor
// NotificationHandler() {
// initializeListeners();
// }
// void initializeListeners() async {
// // Listener para mensagens em primeiro plano
// // FirebaseMessaging.onMessage.listen((message) {
// // _onMessage.add(message); // Adicionar mensagem ao stream
// // });
// RemoteMessage? initialMessage =
// await FirebaseMessaging.instance.getInitialMessage();
// if (initialMessage != null) _onMessage.add(initialMessage);
// // Listener para mensagens que abriram o app
// FirebaseMessaging.onMessageOpenedApp.listen((message) {
// _onMessageOpenedApp.add(message); // Adicionar mensagem ao stream
// });
// }
// void openedAppVisitRequestNotification(
// RemoteMessage message, BuildContext context) {
// log('openedAppVisitRequestNotification');
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return Dialog(
// backgroundColor:
// Colors.transparent, // Faz o fundo do Dialog ser transparente
// child: VisitRequestTemplateComponentWidget(
// name: message.data['nome'] ?? 'blabla',
// reason: message.data['motivo'] ?? 'blabla',
// message: message.data['mensagem'] ?? 'blabla',
// document: message.data['document']),
// );
// });
// }
// // Método para tratar mensagens recebidas
// void handleMessage(RemoteMessage message, BuildContext context) {
// log('Notification Received!');
// message.data.forEach((key, value) {
// log('$key: $value');
// });
// switch (message.data['type']) {
// case 'visit_request':
// openedAppVisitRequestNotification(message, context);
// break;
// case '':
// break;
// default:
// log('Notification type not recognized');
// }
// }
// // Ouvir streams
// void listenToNotifications(BuildContext context) {
// _onMessage.listen((message) {
// handleMessage(message, context);
// });
// _onMessageOpenedApp.listen((message) {
// handleMessage(message, context);
// });
// }
// // Dispor streams
// void dispose() {
// _onMessage.close();
// _onMessageOpenedApp.close();
// }
// }

View File

@ -93,7 +93,6 @@ class _ThrowExceptionWidgetState extends State<ThrowExceptionWidget>
case EnumThrowException.success: case EnumThrowException.success:
return FFLocalizations.of(context) return FFLocalizations.of(context)
.getVariableText(ptText: "Sucesso ;)", enText: "Success ;)"); .getVariableText(ptText: "Sucesso ;)", enText: "Success ;)");
;
} }
} }

View File

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:hub/components/molecular_components/visitor_not_found_component/visitor_not_found_component_model.dart'; import 'package:hub/components/molecular_components/visitor_not_found_component/visitor_not_found_component_model.dart';
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 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
@ -9,8 +11,9 @@ 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';
class VisitorNotFoundComponentWidget extends StatefulWidget { class VisitorNotFoundComponentWidget extends StatefulWidget {
const VisitorNotFoundComponentWidget({super.key}); const VisitorNotFoundComponentWidget({this.doc, Key? key}) : super(key: key);
final String? doc;
@override @override
State<VisitorNotFoundComponentWidget> createState() => State<VisitorNotFoundComponentWidget> createState() =>
_VisitorNotFoundComponentWidgetState(); _VisitorNotFoundComponentWidgetState();
@ -41,9 +44,10 @@ class _VisitorNotFoundComponentWidgetState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return SingleChildScrollView(
width: MediaQuery.of(context).size.height * 0.5, child: Container(
height: MediaQuery.of(context).size.height * 0.4, // width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.height,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
@ -54,13 +58,13 @@ class _VisitorNotFoundComponentWidgetState
), ),
), ),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Align( Align(
alignment: const AlignmentDirectional(1.0, -1.0), alignment: const AlignmentDirectional(1.0, -1.0),
child: Padding( child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 5.0, 0.0), padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 5.0, 0.0),
child: FlutterFlowIconButton( child: FlutterFlowIconButton(
borderRadius: 20.0, borderRadius: 20.0,
borderWidth: 1.0, borderWidth: 1.0,
@ -82,7 +86,8 @@ class _VisitorNotFoundComponentWidgetState
size: 72.0, size: 72.0,
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0), padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0),
child: Text( child: Text(
FFLocalizations.of(context).getText( FFLocalizations.of(context).getText(
'1p9mykbj' /* Usuário não encontrado */, '1p9mykbj' /* Usuário não encontrado */,
@ -97,13 +102,15 @@ class _VisitorNotFoundComponentWidgetState
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(20.0, 4.0, 20.0, 0.0), padding:
const EdgeInsetsDirectional.fromSTEB(20.0, 4.0, 20.0, 0.0),
child: Text( child: Text(
FFLocalizations.of(context).getText( FFLocalizations.of(context).getText(
'kt937sp6' /* O documento inserido não corre... */, 'kt937sp6' /* O documento inserido não corre... */,
), ),
style: FlutterFlowTheme.of(context).labelMedium.override( style: FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0, fontSize: 14.0,
letterSpacing: 0.0, letterSpacing: 0.0,
@ -113,12 +120,12 @@ class _VisitorNotFoundComponentWidgetState
), ),
), ),
), ),
Expanded( Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Align( child: Align(
alignment: const AlignmentDirectional(0.0, 1.0), alignment: const AlignmentDirectional(0.0, 1.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: () async { onPressed: () async {
Navigator.pop(context);
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@ -132,22 +139,23 @@ class _VisitorNotFoundComponentWidgetState
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.height * 0.9, height: MediaQuery.of(context).size.height * 0.9,
child: const RegisiterVistorTemplateComponentWidget( child: RegisiterVistorTemplateComponentWidget(
source: 'VisitorNotFoundComponent', source: 'VisitorNotFoundComponent',
)), doc: _model.widget?.doc,
),
),
); );
}, },
).then((value) => safeSetState(() {})); ).then((value) => Navigator.pop(context, value));
}, },
text: FFLocalizations.of(context) text: FFLocalizations.of(context)
.getVariableText(enText: 'Add', ptText: 'Adicionar'), .getVariableText(enText: 'Add', ptText: 'Adicionar'),
options: FFButtonOptions( options: FFButtonOptions(
width: double.infinity,
height: 30.0, height: 30.0,
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0), 24.0, 0.0, 24.0, 0.0),
iconPadding: iconPadding: const EdgeInsetsDirectional.fromSTEB(
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), 0.0, 0.0, 0.0, 0.0),
color: FlutterFlowTheme.of(context).primary, color: FlutterFlowTheme.of(context).primary,
textStyle: FlutterFlowTheme.of(context).titleSmall.override( textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: fontFamily:
@ -165,8 +173,8 @@ class _VisitorNotFoundComponentWidgetState
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(25.0), bottomLeft: Radius.circular(25.0),
bottomRight: Radius.circular(25.0), bottomRight: Radius.circular(25.0),
topLeft: Radius.circular(15.0), topLeft: Radius.circular(25.0),
topRight: Radius.circular(15.0), topRight: Radius.circular(25.0),
), ),
), ),
), ),
@ -174,6 +182,7 @@ class _VisitorNotFoundComponentWidgetState
), ),
], ],
), ),
),
); );
} }
} }

View File

@ -10,7 +10,6 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class BottomArrowLinkedLocalsComponentWidget extends StatefulWidget { class BottomArrowLinkedLocalsComponentWidget extends StatefulWidget {
const BottomArrowLinkedLocalsComponentWidget({super.key}); const BottomArrowLinkedLocalsComponentWidget({super.key});
@ -100,9 +99,7 @@ class _BottomArrowLinkedLocalsComponentWidgetState
color: FlutterFlowTheme.of(context).primary, color: FlutterFlowTheme.of(context).primary,
size: 24.0, size: 24.0,
), ),
onPressed: () { onPressed: () {},
print('IconButton pressed ...');
},
), ),
), ),
Expanded( Expanded(
@ -180,8 +177,8 @@ class _BottomArrowLinkedLocalsComponentWidgetState
width: 50.0, width: 50.0,
height: double.infinity, height: double.infinity,
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
alignment: alignment: const AlignmentDirectional(
const AlignmentDirectional(0.0, 0.0), 0.0, 0.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
@ -232,13 +229,14 @@ class _BottomArrowLinkedLocalsComponentWidgetState
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
fit: BoxFit.fill, fit: BoxFit.fill,
alignment: alignment: const Alignment(
const Alignment(0.0, 0.0), 0.0, 0.0),
), ),
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional padding:
const EdgeInsetsDirectional
.fromSTEB( .fromSTEB(
0.0, 10.0, 0.0, 0.0), 0.0, 10.0, 0.0, 0.0),
child: Text( child: Text(

View File

@ -1,4 +1,3 @@
import '/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart'; import '/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_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';
@ -12,10 +11,7 @@ export 'local_profile_component_model.dart';
//// ////
class LocalProfileComponentWidget extends StatefulWidget { class LocalProfileComponentWidget extends StatefulWidget {
const LocalProfileComponentWidget({ const LocalProfileComponentWidget({required bool localStatus, super.key});
required bool localStatus,
super.key
});
@override @override
State<LocalProfileComponentWidget> createState() => State<LocalProfileComponentWidget> createState() =>
@ -87,8 +83,7 @@ class _LocalProfileComponentWidgetState
padding: MediaQuery.viewInsetsOf(context), padding: MediaQuery.viewInsetsOf(context),
child: const SizedBox( child: const SizedBox(
height: double.infinity, height: double.infinity,
child: child: BottomArrowLinkedLocalsComponentWidget(),
BottomArrowLinkedLocalsComponentWidget(),
), ),
); );
}, },
@ -96,23 +91,23 @@ class _LocalProfileComponentWidgetState
}, },
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(200.0), borderRadius: BorderRadius.circular(200.0),
child: child: Image.network(
Image.network(
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png', 'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
width: 80.0, width: 80.0,
height: 80.0, height: 80.0,
fit: BoxFit.cover, fit: BoxFit.cover,
alignment: const Alignment(0.0, 0.0), alignment: const Alignment(0.0, 0.0),
errorBuilder: (context, error, stackTrace) => Image.network( errorBuilder: (context, error, stackTrace) =>
Image.network(
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
width: 80.0, width: 80.0,
height: 80.0, height: 80.0,
fit: BoxFit.cover, fit: BoxFit.cover,
alignment: const Alignment(0.0, 0.0), alignment: const Alignment(0.0, 0.0),
errorBuilder: (context, error, stackTrace) => Image.asset('assets/images/error_image.svg'), errorBuilder: (context, error, stackTrace) =>
), Image.asset('assets/images/error_image.svg'),
)
), ),
)),
), ),
), ),
), ),
@ -125,8 +120,7 @@ class _LocalProfileComponentWidgetState
functions.convertToUppercase(FFAppState().local), functions.convertToUppercase(FFAppState().local),
'NOME DO LOCAL', 'NOME DO LOCAL',
), ),
style: style: FlutterFlowTheme.of(context).labelMedium.override(
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Nunito', fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).info, color: FlutterFlowTheme.of(context).info,
fontSize: 14.0, fontSize: 14.0,

View File

@ -13,7 +13,6 @@ import 'package:flutter/material.dart';
import 'menu_component_model.dart'; import 'menu_component_model.dart';
export 'menu_component_model.dart'; export 'menu_component_model.dart';
class MenuComponentWidget extends StatefulWidget { class MenuComponentWidget extends StatefulWidget {
const MenuComponentWidget({ const MenuComponentWidget({
Key? key, Key? key,
@ -31,11 +30,8 @@ class MenuComponentWidget extends StatefulWidget {
class _MenuComponentWidgetState extends State<MenuComponentWidget> { class _MenuComponentWidgetState extends State<MenuComponentWidget> {
late MenuComponentModel _model; late MenuComponentModel _model;
@override @override
void setState(VoidCallback callback) { void setState(VoidCallback callback) {
super.setState(callback); super.setState(callback);
_model.onUpdate(); _model.onUpdate();
} }
@ -44,7 +40,6 @@ class _MenuComponentWidgetState extends State<MenuComponentWidget> {
void initState() { void initState() {
super.initState(); super.initState();
_model = createModel(context, () => MenuComponentModel()); _model = createModel(context, () => MenuComponentModel());
} }
@override @override
@ -58,42 +53,164 @@ class _MenuComponentWidgetState extends State<MenuComponentWidget> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final options = widget.item == MenuItem.button final options = widget.item == MenuItem.button
? <MenuEntry>[ ? <MenuEntry>[
MenuButtonWidget(icon: FFIcons.kvector1, action: () async { await _model.scheduleVisitOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Schedule\nVisit' , ptText:'Agendar\nVisita' ,),), MenuButtonWidget(
icon: FFIcons.kvector1,
action: () async {
await _model.scheduleVisitOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Schedule\nVisit',
ptText: 'Agendar\nVisita',
),
),
MenuButtonWidget(icon: FFIcons.khome, action: () async {await _model.registerVisitorOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\nVisitor' , ptText:'Cadastro\nde Visitante' ,),), MenuButtonWidget(
icon: FFIcons.khome,
action: () async {
await _model.registerVisitorOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Register\nVisitor',
ptText: 'Cadastro\nde Visitante',
),
),
// MenuButtonWidget(icon: FFIcons.kvector2, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Link\nCondominum' , ptText:'' ,),), // MenuButtonWidget(icon: FFIcons.kvector2, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Link\nCondominum' , ptText:'' ,),),
// MenuButtonWidget(icon: FFIcons.kpets, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\Pet' , ptText:'' ,),), // MenuButtonWidget(icon: FFIcons.kpets, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\Pet' , ptText:'' ,),),
MenuButtonWidget(icon: Icons.qr_code, action: () async {await _model.accessQRCodeOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'QRCode\nAccess' , ptText:'QRCode\nde Acesso' ,),), MenuButtonWidget(
icon: Icons.qr_code,
action: () async {
await _model.accessQRCodeOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'QRCode\nAccess',
ptText: 'QRCode\nde Acesso',
),
),
MenuButtonWidget(icon: Icons.people, action: () async {await _model.peopleOnThePropertyAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Poeple on\nthe Property' , ptText:'Pessoas na\nPropriedade' ,),), MenuButtonWidget(
icon: Icons.people,
action: () async {
await _model.peopleOnThePropertyAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Poeple on\nthe Property',
ptText: 'Pessoas na\nPropriedade',
),
),
MenuButtonWidget(icon: Icons.history_sharp, action: () async {await _model.liberationHistoryOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Consult\nHistories' , ptText:'Consultar\nHistóricos' ,),), MenuButtonWidget(
icon: Icons.history_sharp,
action: () async {
await _model.liberationHistoryOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Consult\nHistories',
ptText: 'Consultar\nHistóricos',
),
),
MenuButtonWidget(icon: Icons.settings, action: () async {await _model.preferencesSettings(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Preferences\nSettings' , ptText:'Configurações' ,),), MenuButtonWidget(
] : <MenuEntry>[ icon: Icons.settings,
MenuCardItem(icon: FFIcons.kvector1, action: () async { await _model.scheduleVisitOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Schedule Visit' , ptText:'Agendar\nVisita' ,),), action: () async {
await _model.preferencesSettings(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Preferences\nSettings',
ptText: 'Preferências \nde Configurações',
),
),
]
: <MenuEntry>[
MenuCardItem(
icon: FFIcons.kvector1,
action: () async {
await _model.scheduleVisitOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Schedule\nVisit',
ptText: 'Agendar\nVisita',
),
),
MenuCardItem(icon: FFIcons.khome, action: () async {await _model.registerVisitorOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register Visitor' , ptText:'Cadastro de Visitante' ,),), MenuCardItem(
icon: FFIcons.khome,
action: () async {
await _model.registerVisitorOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Register\nVisitor',
ptText: 'Cadastro\nde Visitante',
),
),
// MenuCardItem(icon: FFIcons.kvector2, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Link Condominum' , ptText:'' ,),), // MenuCardItem(icon: FFIcons.kvector2, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Link Condominum' , ptText:'' ,),),
// MenuCardItem(icon: FFIcons.kpets, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\Pet' , ptText:'' ,),), // MenuCardItem(icon: FFIcons.kpets, action: () async {setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Register\Pet' , ptText:'' ,),),
MenuCardItem(icon: Icons.qr_code, action: () async {await _model.accessQRCodeOptAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'QRCode Access' , ptText:'QRCode de Acesso' ,),), MenuCardItem(
icon: Icons.qr_code,
action: () async {
await _model.accessQRCodeOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'QRCode\nAccess',
ptText: 'QRCode\nde Acesso',
),
),
MenuCardItem(icon: Icons.people, action: () async {await _model.peopleOnThePropertyAction(context); setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Poeple on the Property' , ptText:'Pessoas na Propriedade' ,),), MenuCardItem(
icon: Icons.people,
action: () async {
await _model.peopleOnThePropertyAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Poeple on\nthe Property',
ptText: 'Pessoas\nna Propriedade',
),
),
MenuCardItem(icon: Icons.history_sharp, action: () async {await _model.liberationHistoryOptAction(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Consult Histories' , ptText:'Consultar Historicos' ,),), MenuCardItem(
icon: Icons.history_sharp,
MenuCardItem(icon: Icons.settings, action: () async {await _model.preferencesSettings(context);setState(() {});}, title: FFLocalizations.of(context).getVariableText(enText:'Preferences Settings' , ptText:'Configurações' ,),), action: () async {
await _model.liberationHistoryOptAction(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Consult\nHistories',
ptText: 'Consultar\nHistoricos',
),
),
MenuCardItem(
icon: Icons.settings,
action: () async {
await _model.preferencesSettings(context);
setState(() {});
},
title: FFLocalizations.of(context).getVariableText(
enText: 'Preferences\nSettings',
ptText: 'Preferências\nde Configuração',
),
),
]; ];
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: Builder( child: Builder(
builder: (context) { builder: (context) {
if (widget.style == MenuView.list_grid && widget.expandable == true && widget.item == MenuItem.button) { if (widget.style == MenuView.list_grid &&
widget.expandable == true &&
widget.item == MenuItem.button) {
if (_model.isGrid == true) { if (_model.isGrid == true) {
return wrapWithModel( return wrapWithModel(
model: _model.menuListViewComponentModel, model: _model.menuListViewComponentModel,
@ -126,7 +243,9 @@ class _MenuComponentWidgetState extends State<MenuComponentWidget> {
); );
} }
} }
if (widget.style == MenuView.list && widget.expandable == false && widget.item == MenuItem.card){ if (widget.style == MenuView.list &&
widget.expandable == false &&
widget.item == MenuItem.card) {
return wrapWithModel( return wrapWithModel(
model: _model.menuListViewComponentModel, model: _model.menuListViewComponentModel,
updateCallback: () => setState(() {}), updateCallback: () => setState(() {}),
@ -160,6 +279,4 @@ class _MenuComponentWidgetState extends State<MenuComponentWidget> {
}, },
); );
} }
} }

View File

@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:collection'; import 'dart:collection';
import 'dart:developer'; import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
@ -14,7 +13,6 @@ import 'package:rxdart/rxdart.dart';
// //
final dropdown = BehaviorSubject<LinkedHashMap<String, String>>.seeded( final dropdown = BehaviorSubject<LinkedHashMap<String, String>>.seeded(
LinkedHashMap.from({ LinkedHashMap.from({
'All': 'A', 'All': 'A',
@ -82,7 +80,6 @@ class _MessageWellComponentWidgetState
); );
} }
Widget _buildMenuMessageWell(BuildContext context, FlutterFlowTheme theme) { Widget _buildMenuMessageWell(BuildContext context, FlutterFlowTheme theme) {
final dropdownItems = LinkedHashMap.from({ final dropdownItems = LinkedHashMap.from({
'All': 'A', 'All': 'A',
@ -148,7 +145,8 @@ class _MessageWellComponentWidgetState
fillColor: theme.primary, fillColor: theme.primary,
), ),
onChanged: (String? newValue) { onChanged: (String? newValue) {
safeSetState(() => dropdown.value = LinkedHashMap.from({newValue!: dropdownItems[newValue].toString()})); safeSetState(() => dropdown.value = LinkedHashMap.from(
{newValue!: dropdownItems[newValue].toString()}));
}, },
items: dropdownItems.entries items: dropdownItems.entries
.map((entry) => DropdownMenuItem<String>( .map((entry) => DropdownMenuItem<String>(
@ -178,84 +176,138 @@ class _MessageWellComponentWidgetState
); );
} }
Widget _buildMessageItem( Widget _buildMessageItem(BuildContext context, dynamic message, int index) {
BuildContext context, dynamic message, int index) {
final theme = FlutterFlowTheme.of(context); final theme = FlutterFlowTheme.of(context);
String formatMessageOrigin(String messageOrigin) { String formatMessageOrigin(String messageOrigin) {
final words = messageOrigin.split(' '); final words = messageOrigin.split(' ');
final formattedWords = words.map((word) { final formattedWords = words.map((word) {
if (word.isEmpty) return word; // Handle empty words
final firstLetter = word.substring(0, 1).toUpperCase(); final firstLetter = word.substring(0, 1).toUpperCase();
final remainingLetters = word.substring(1).toLowerCase(); final remainingLetters =
word.length > 1 ? word.substring(1).toLowerCase() : '';
return '$firstLetter$remainingLetters'; return '$firstLetter$remainingLetters';
}); });
return formattedWords.join(' '); return formattedWords.join(' ');
} }
return GestureDetector(
onTap: () => {}, return Padding(
child: Padding( padding: const EdgeInsets.symmetric(horizontal: 30),
padding: const EdgeInsets.fromLTRB(20, 5, 20, 5), child: Card(
color: FlutterFlowTheme.of(context).primaryBackground,
child: Container( child: Container(
width: MediaQuery.of(context).size.width * 0.9, // height: 100,
height: 127.0, child: Padding(
decoration: BoxDecoration( padding: const EdgeInsets.all(8.0),
borderRadius: BorderRadius.circular(10), child: Column(
), mainAxisAlignment: MainAxisAlignment.center,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Container(
width: 64.0,
height: 64.0,
decoration: const BoxDecoration(shape: BoxShape.circle),
),
),
Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const SizedBox(height: 8.0), Row(
Center( mainAxisAlignment: MainAxisAlignment.start,
child: Text( mainAxisSize: MainAxisSize.max,
'~ ${formatMessageOrigin(message['MSG_ORIGEM_DESC'].toString())}', children: [
style: theme.bodyMedium.copyWith( Icon(
fontFamily: 'Nunito Sans', message['MSG_DESTINO_TP'] == 'T'
color: theme.primary, ? Icons.language
fontSize: 14.0, : message['MSG_DESTINO_TP'] == 'P'
fontWeight: FontWeight.bold, ? Icons.person
: Icons.home,
color: FlutterFlowTheme.of(context).primary,
size: 25,
), ),
),
),
const SizedBox(height: 8.0),
Expanded( Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Text( child: Text(
formatMessageOrigin(message['MSG_TEXTO'].toString()), message['MSG_ORIGEM_DESC'].toString(),
style: theme.bodyMedium.copyWith( style: TextStyle(
fontFamily: 'Nunito Sans', fontWeight: FontWeight.bold,
color: theme.bodyMedium.color, fontSize: 15,
fontSize: 14.0, color: FlutterFlowTheme.of(context).primary,
), ),
softWrap: true, overflow: TextOverflow.fade,
maxLines: 10, ),
),
].divide(const SizedBox(width: 10)),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: const EdgeInsets.only(left: 5),
child: Icon(
Icons.history,
color:
FlutterFlowTheme.of(context).customColor6,
size: 15,
),
),
Expanded(
child: Text(
message['MSG_DATE'].toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 10,
color:
FlutterFlowTheme.of(context).customColor6,
),
overflow: TextOverflow.ellipsis,
),
),
].divide(const SizedBox(width: 15)),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: const EdgeInsets.only(left: 5),
child: Icon(
Icons.message,
color:
FlutterFlowTheme.of(context).customColor6,
size: 15,
),
),
Expanded(
child: Text(
message['MSG_TEXTO'].toString(),
),
),
].divide(const SizedBox(width: 15)),
),
].divide(const SizedBox(height: 4)),
),
),
// Row(
// children: [
// Icon(
// Icons.message,
// color: FlutterFlowTheme.of(context).customColor6,
// size: 15,
// ),
// Expanded(
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Text(
// message['MSG_TEXTO'].toString(),
// ),
// ),
// ),
// ]
// .addToStart(const SizedBox(width: 8))
// .addToEnd(const SizedBox(width: 8))),
].divide(
const SizedBox(height: 8),
), ),
), ),
), ),
],
), ),
) ));
],
),
),
),
);
} }
} }
class MessageWellState { class MessageWellState {
@ -277,8 +329,7 @@ class MessageWellState {
return MessageWellState( return MessageWellState(
messages: messages ?? this.messages, messages: messages ?? this.messages,
pageNumber: pageNumber ?? this.pageNumber, pageNumber: pageNumber ?? this.pageNumber,
allowScrollInSingleChildScrollView: allowScrollInSingleChildScrollView: allowScrollInSingleChildScrollView ??
allowScrollInSingleChildScrollView ??
this.allowScrollInSingleChildScrollView, this.allowScrollInSingleChildScrollView,
); );
} }
@ -322,17 +373,14 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
// .toList(); // .toList();
// Provider.of<MessageCounter>(context, listen: false).setCounter(int.parse(response.jsonBody['total_pages'])); // Provider.of<MessageCounter>(context, listen: false).setCounter(int.parse(response.jsonBody['total_pages']));
// totalPageNumber = int.parse(response.jsonBody['total_pages']); // totalPageNumber = int.parse(response.jsonBody['total_pages']);
} else { } else {}
log('Error fetching messages: ${response.statusCode}'); } else {}
}
} else {
log('No more messages to fetch ...');
}
} }
List<dynamic> getMessages() { List<dynamic> getMessages() {
return state.messages; return state.messages;
} }
void incrementPageNumber() { void incrementPageNumber() {
if (state.pageNumber <= totalPageNumber) { if (state.pageNumber <= totalPageNumber) {
state = state.copyWith(pageNumber: state.pageNumber + 1); state = state.copyWith(pageNumber: state.pageNumber + 1);

View File

@ -40,8 +40,6 @@ class ScheduleVisitDetailModel
String convertDateFormat(String dateStr) { String convertDateFormat(String dateStr) {
try { try {
log('Received date string: $dateStr');
// Formato original // Formato original
DateFormat originalFormat = DateFormat('d/M/y H:mm:ss'); DateFormat originalFormat = DateFormat('d/M/y H:mm:ss');
// Novo formato // Novo formato
@ -50,7 +48,6 @@ class ScheduleVisitDetailModel
// Validate the input string format // Validate the input string format
if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$') if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$')
.hasMatch(dateStr)) { .hasMatch(dateStr)) {
log('Invalid date format: $dateStr');
return 'Invalid date format'; return 'Invalid date format';
} }
@ -59,11 +56,9 @@ class ScheduleVisitDetailModel
// Converte DateTime para a nova string formatada // Converte DateTime para a nova string formatada
String formattedDate = newFormat.format(dateTime); String formattedDate = newFormat.format(dateTime);
log('Formatted date: $formattedDate');
return formattedDate; return formattedDate;
} catch (e) { } catch (e) {
// Handle the exception by returning an error message or a default value // Handle the exception by returning an error message or a default value
log('Error parsing date: $e');
return 'Invalid date format'; return 'Invalid date format';
} }
} }

View File

@ -19,13 +19,13 @@ class CardItemTemplateComponentWidget extends StatefulWidget {
super.key, super.key,
required this.labelsHashMap, required this.labelsHashMap,
required this.statusHashMap, required this.statusHashMap,
required this.imageHashMap, required this.imagePath,
required this.onTapCardItemAction, required this.onTapCardItemAction,
}); });
final Map<String, String>? labelsHashMap; final Map<String, String>? labelsHashMap;
final List<Map<String, Color>?> statusHashMap; final List<Map<String, Color>?> statusHashMap;
final Map<String, String> imageHashMap; final String? imagePath;
final Future Function()? onTapCardItemAction; final Future Function()? onTapCardItemAction;
@override @override
@ -84,7 +84,6 @@ class _CardItemTemplateComponentWidgetState
double screenWidth = MediaQuery.of(context).size.width; double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height; double screenHeight = MediaQuery.of(context).size.height;
context.watch<FFAppState>(); context.watch<FFAppState>();
return InkWell( return InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,
focusColor: Colors.transparent, focusColor: Colors.transparent,
@ -97,7 +96,7 @@ class _CardItemTemplateComponentWidgetState
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0), padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
child: Card( child: Card(
clipBehavior: Clip.antiAliasWithSaveLayer, clipBehavior: Clip.antiAliasWithSaveLayer,
color: FlutterFlowTheme.of(context).secondaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
elevation: 5.0, elevation: 5.0,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
@ -106,7 +105,7 @@ class _CardItemTemplateComponentWidgetState
width: 350.0, width: 350.0,
height: 115.0, height: 115.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).secondaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -114,9 +113,11 @@ class _CardItemTemplateComponentWidgetState
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
width: 100.0, width: MediaQuery.of(context).size.width,
height: 100.0, height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -132,10 +133,7 @@ class _CardItemTemplateComponentWidgetState
String value = labelsLinkedHashMap[key]!; String value = labelsLinkedHashMap[key]!;
return Padding( return Padding(
padding: padding:
const EdgeInsets.fromLTRB(0, 2, 0, 5), const EdgeInsets.fromLTRB(20, 0, 0, 5),
child: Padding(
padding:
const EdgeInsets.fromLTRB(20, 0, 0, 0),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: mainAxisAlignment:
@ -166,17 +164,18 @@ class _CardItemTemplateComponentWidgetState
const SizedBox( const SizedBox(
width: width:
5.0), // Espaçamento entre o label e o valor 5.0), // Espaçamento entre o label e o valor
Text( Flexible(
truncate(20, value), child: Text(
value,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: fontFamily:
FlutterFlowTheme.of(context) FlutterFlowTheme.of(
context)
.bodyMediumFamily, .bodyMediumFamily,
fontSize: screenWidth * 0.030, fontSize: 12.5,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts useGoogleFonts: GoogleFonts
@ -187,17 +186,15 @@ class _CardItemTemplateComponentWidgetState
.bodyMediumFamily), .bodyMediumFamily),
), ),
), ),
],
), ),
],
), ),
); );
}, },
), ),
), ),
Padding( Row(
padding: const EdgeInsets.fromLTRB(20, 0, 0, 0), mainAxisAlignment: MainAxisAlignment.center,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: children:
statusLinkedHashMap.expand((linkedHashMap) { statusLinkedHashMap.expand((linkedHashMap) {
@ -212,7 +209,7 @@ class _CardItemTemplateComponentWidgetState
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 1.0, vertical: 3.0), horizontal: 1.0, vertical: 3.0),
child: Container( child: Container(
width: screenWidth * 0.20, width: 100.0,
height: 27.0, height: 27.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: item color: item
@ -225,7 +222,6 @@ class _CardItemTemplateComponentWidgetState
child: Text( child: Text(
item.key, // Usa a chave do item atual como texto item.key, // Usa a chave do item atual como texto
style: TextStyle( style: TextStyle(
fontSize: screenWidth * 0.03,
color: FlutterFlowTheme.of( color: FlutterFlowTheme.of(
context) context)
.info, // Ajuste conforme necessário .info, // Ajuste conforme necessário
@ -240,27 +236,27 @@ class _CardItemTemplateComponentWidgetState
}).toList(); }).toList();
}).toList(), }).toList(),
), ),
),
]), ]),
), ),
), ),
),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(
10.0, 10.0, 10.0, 10.0), 10.0, 10.0, 10.0, 10.0),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(22.0), borderRadius: BorderRadius.circular(22.0),
child: AspectRatio(
aspectRatio:
1.0, // Define a proporção desejada (1:1 neste caso)
child: CachedNetworkImage( child: CachedNetworkImage(
fadeInDuration: const Duration(milliseconds: 500), fadeInDuration: const Duration(milliseconds: 500),
fadeOutDuration: const Duration(milliseconds: 500), fadeOutDuration: const Duration(milliseconds: 500),
imageUrl: valueOrDefault<String>( imageUrl: widget.imagePath ?? '',
// 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.imageHashMap['key']}&tipo=${widget.imageHashMap['value']}',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.imageHashMap['key']}&tipo=${widget.imageHashMap['value']}',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
), ),
)
], ],
), ),
), ),

View File

@ -0,0 +1,226 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hub/actions/actions.dart';
import 'package:hub/app_state.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart';
import 'package:rxdart/rxdart.dart';
import 'package:share_plus/share_plus.dart';
Widget buildDetails(
dynamic visitaWrapItem,
BuildContext context,
Future<dynamic> Function(BuildContext, int, int, String, String)?
changeStatusAction) {
return DetailsComponentWidget(
buttons: [
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
status.active) // REJECT ACTION
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
ptText: 'Cancelar',
enText: 'Cancel',
),
icon: const Icon(Icons.close),
onPressed: () async {
showAlertDialog(
context,
FFLocalizations.of(context).getVariableText(
ptText: 'Bloquear Visita',
enText: 'Block Visit',
),
FFLocalizations.of(context).getVariableText(
ptText: 'Você tem certeza que deseja bloquear essa visita?',
enText: 'Are you sure you want to block this visit?',
), () async {
await changeStatusAction
?.call(
context,
int.parse(visitaWrapItem['VAW_DESTINO']),
int.parse(visitaWrapItem['VAW_ID']),
visitaWrapItem['VAW_CHAVE'] ?? '',
visitaWrapItem['VTE_DOCUMENTO'] ?? '',
)
.then((value) {
Navigator.pop(context, value);
if (value == false) {
showSnackbar(
context,
FFLocalizations.of(context).getVariableText(
enText: 'Error blocking visit',
ptText: 'Erro ao bloquear visita',
),
true,
);
} else if (value == true) {
showSnackbar(
context,
FFLocalizations.of(context).getVariableText(
enText: 'Success canceling visit',
ptText: 'Succeso ao cancelar visita',
),
false,
);
}
}).catchError((err, stack) {
Navigator.pop(context);
showSnackbar(
context,
FFLocalizations.of(context).getVariableText(
enText: 'Error blocking visit',
ptText: 'Erro ao bloquear visita',
),
true,
);
});
});
},
options: FFButtonOptions(
width: 130,
height: 40,
color: FlutterFlowTheme.of(context).primaryBackground,
elevation: 0,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
// borderRadius: 12,
),
),
if (getStatus(visitaWrapItem['VAW_STATUS']) !=
status.active) // RECALL ACTION
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
ptText: 'Reagendar',
enText: 'Reschedule',
),
icon: const Icon(Icons.refresh),
onPressed: () async {
Navigator.pop(context);
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ScheduleCompleteVisitPageWidget(
dropdownValue1: visitaWrapItem['MOT_DESCRICAO'],
dropdownValue2: visitaWrapItem['NAC_DESCRICAO'],
visitorJsonList: [visitaWrapItem],
visitorStrList: visitaWrapItem['VTE_DOCUMENTO'],
)
),
);
},
options: FFButtonOptions(
width: 130,
height: 40,
color: FlutterFlowTheme.of(context).primaryBackground,
elevation: 0,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
// borderRadius: 12,
),
),
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
status.active) // SHARE ACTION
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
ptText: 'Compartilhar',
enText: 'Share',
),
icon: const Icon(Icons.share),
onPressed: () async {
Share.share('''
Olá, \*${visitaWrapItem['VTE_NOME']}\*! Você foi convidado para \*${visitaWrapItem['NAC_DESCRICAO']}\*.
\*Validade do Convite\*:
- Início: ${visitaWrapItem['VAW_DTINICIO']}
- Fim: ${visitaWrapItem['VAW_DTFIM']}
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
''');
},
options: FFButtonOptions(
width: 130,
height: 40,
color: FlutterFlowTheme.of(context).primaryBackground,
elevation: 0,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
// borderRadius: 12,
),
),
],
labelsHashMap: Map<String, String>.from({
'Nome': visitaWrapItem['VTE_NOME'] ?? '',
'Inicio': visitaWrapItem['VAW_DTINICIO'] ?? '',
'Fim': visitaWrapItem['VAW_DTFIM'] ?? '',
}),
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
statusHashMap: [
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Ativo',
enText: 'Active',
): FlutterFlowTheme.of(context).warning,
}),
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.unknown)
Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Pendente',
enText: 'Pending',
): FlutterFlowTheme.of(context).alternate,
}),
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.canceled)
Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Cancelado',
enText: 'Canceled',
): FlutterFlowTheme.of(context).error,
}),
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.finished)
Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Finalizado',
enText: 'Finished',
): FlutterFlowTheme.of(context).success,
}),
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.blocked)
Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Bloqueado',
enText: 'Blocked',
): FlutterFlowTheme.of(context).error,
}),
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.inactive)
Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Inativo',
enText: 'Inactive',
): FlutterFlowTheme.of(context).warning,
}),
],
);
}

View File

@ -1,3 +1,6 @@
import 'dart:collection';
import 'dart:developer';
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';
@ -8,56 +11,39 @@ 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:provider/provider.dart'; import 'package:provider/provider.dart';
class DetailsComponentWidget extends StatefulWidget { class DetailsComponentWidget extends StatefulWidget {
const DetailsComponentWidget({ const DetailsComponentWidget({
super.key, Key? key,
required this.vteName, required this.labelsHashMap,
required this.vteReason, required this.statusHashMap,
required this.vteMsg, required this.imagePath,
this.vteDocument, this.onTapCardItemAction,
this.cliUUID, required this.buttons,
this.vteUUID,
this.vawName,
this.msgUUID,
this.vawRef,
this.vawUUID,
this.vawDestino,
required this.vawStatus,
this.vawDate,
this.changeStatusAction,
}); });
final String? vteName; final Map<String, String> labelsHashMap;
final String? vteReason; final List<Map<String, Color>?> statusHashMap;
final String? vteMsg; final String? imagePath;
final String? vteDocument; final Future Function()? onTapCardItemAction;
final String? cliUUID; final List<Widget> buttons;
final String? vteUUID;
final String? vawName;
final String? msgUUID;
final String? vawRef;
final String? vawUUID;
final String? vawDestino;
final String? vawStatus;
final String? vawDate;
final Future Function(
BuildContext context,
String status,
String vawREF,
String msg,
String vteUUID,
)? changeStatusAction;
@override @override
State<DetailsComponentWidget> createState() => _DetailsComponentWidgetState(); State<DetailsComponentWidget> createState() =>
_DetailsComponentWidgetState();
} }
class _DetailsComponentWidgetState extends State<DetailsComponentWidget> { class _DetailsComponentWidgetState
extends State<DetailsComponentWidget> {
late DetailsComponentModel _model; late DetailsComponentModel _model;
LinkedHashMap<String, String> get labelsLinkedHashMap =>
LinkedHashMap.from(widget.labelsHashMap ?? {});
List<LinkedHashMap<String, Color>> get statusLinkedHashMap =>
widget.statusHashMap
.map((map) => LinkedHashMap<String, Color>.from(map ?? {}))
.toList();
@override @override
void setState(VoidCallback callback) { void setState(VoidCallback callback) {
super.setState(callback); super.setState(callback);
@ -68,24 +54,6 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
void initState() { void initState() {
super.initState(); super.initState();
_model = createModel(context, () => DetailsComponentModel()); _model = createModel(context, () => DetailsComponentModel());
_model.textController1 ??= TextEditingController(text: widget.vteName);
_model.textFieldFocusNode1 ??= FocusNode();
_model.textController2 ??= TextEditingController(text: widget.vteReason);
_model.textFieldFocusNode2 ??= FocusNode();
_model.textController3 ??= TextEditingController(text: widget.vteMsg);
_model.textFieldFocusNode3 ??= FocusNode();
_model.textController4 ??= TextEditingController(text: widget.vawDate);
_model.textFieldFocusNode4 ??= FocusNode();
_model.textController5 ??= TextEditingController();
_model.textFieldFocusNode5 ??= FocusNode();
_model.textControllerStatus ??=
TextEditingController(text: widget.vawStatus);
_model.textFieldFocusNodeStatus ??= FocusNode(); _model.textFieldFocusNodeStatus ??= FocusNode();
} }
@ -99,38 +67,25 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
context.watch<FFAppState>(); context.watch<FFAppState>();
bool isLoaded = false;
return Align( return Container(
alignment: const AlignmentDirectional(0.0, 0.0), constraints: BoxConstraints(
child: Padding( maxWidth: MediaQuery.of(context).size.width,
padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0), maxHeight: MediaQuery.of(context).size.height,
child: Container( ),
width: MediaQuery.sizeOf(context).width * 0.9,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.all(Radius.circular(25.0)),
bottomLeft: Radius.circular(25.0),
bottomRight: Radius.circular(25.0),
topLeft: Radius.circular(25.0),
topRight: Radius.circular(25.0),
),
), ),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Row( SizedBox(height: MediaQuery.of(context).size.height * 0.02),
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
mainAxisSize: MainAxisSize.max,
children: [
Container( Container(
width: 150.0, width: MediaQuery.of(context).size.width * 0.3,
height: 150.0, height: MediaQuery.of(context).size.width * 0.3,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
decoration: const BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
@ -138,240 +93,20 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
child: CachedNetworkImage( child: CachedNetworkImage(
fadeInDuration: const Duration(milliseconds: 100), fadeInDuration: const Duration(milliseconds: 100),
fadeOutDuration: const Duration(milliseconds: 100), fadeOutDuration: const Duration(milliseconds: 100),
imageUrl: valueOrDefault<String>( imageUrl: widget.imagePath ?? '',
// 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.vteDocument}&tipo=E',
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.vteDocument != null ? widget.vteDocument : widget.vteUUID}&tipo=E',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
// Container( SizedBox(height: MediaQuery.of(context).size.height * 0.03),
// width: 153.0, Row(
// height: 25.0, children: statusLinkedHashMap.expand((linkedHashMap) {
// decoration: BoxDecoration( return linkedHashMap.entries
// color: () { .map((MapEntry<String, Color> item) {
// if (widget.vawStatus == 'L') { return Expanded(
// return FlutterFlowTheme.of(context).primary; child: Padding(
// } else if (widget.vawStatus == 'B') { padding: EdgeInsets.symmetric(
// return FlutterFlowTheme.of(context).error; horizontal: MediaQuery.of(context).size.width * 0.05,
// } else if (widget.vawStatus == 'S') {
// return FlutterFlowTheme.of(context).warning;
// } else {
// return FlutterFlowTheme.of(context).warning;
// }
// }(),
// borderRadius: BorderRadius.circular(16.0),
// ),
// child: Align(
// alignment: const AlignmentDirectional(0.0, 0.0),
// child: Text(
// () {
// if (widget.vawStatus == 'L') {
// return FFLocalizations.of(context)
// .getVariableText(
// ptText: 'Ativo',
// enText: 'Active',
// );
// } else if (widget.vawStatus == 'B') {
// return FFLocalizations.of(context)
// .getVariableText(
// ptText: 'Bloqueado',
// enText: 'Blocked',
// );
// } else {
// return FFLocalizations.of(context)
// .getVariableText(
// ptText: 'Pendente',
// enText: 'Pending',
// );
// }
// }(),
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: FlutterFlowTheme.of(context)
// .bodyMediumFamily,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts.asMap()
// .containsKey(
// FlutterFlowTheme.of(context)
// .bodyMediumFamily),
// ),
// ),
// ),
// ),
].divide(const SizedBox(height: 5.0)),
), ),
]
.addToStart(const SizedBox(width: 10.0))
.addToEnd(const SizedBox(width: 10.0)),
),
// Padding(
// padding: const EdgeInsetsDirectional.fromSTEB(
// 24.0, 0.0, 24.0, 0.0),
// child: TextFormField(
// controller: _model.textController1,
// focusNode: _model.textFieldFocusNode1,
// autofocus: false,
// textInputAction: TextInputAction.next,
// readOnly: true,
// obscureText: false,
// decoration: InputDecoration(
// labelText: FFLocalizations.of(context).getText(
// 'ivfw4j04' /* Nome */,
// ),
// labelStyle: FlutterFlowTheme.of(context)
// .labelMedium
// .override(
// fontFamily:
// FlutterFlowTheme.of(context).labelMediumFamily,
// color: FlutterFlowTheme.of(context).primaryText,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts.asMap().containsKey(
// FlutterFlowTheme.of(context).labelMediumFamily),
// ),
// hintStyle: FlutterFlowTheme.of(context)
// .labelMedium
// .override(
// fontFamily:
// FlutterFlowTheme.of(context).labelMediumFamily,
// color: FlutterFlowTheme.of(context).primaryText,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts.asMap().containsKey(
// FlutterFlowTheme.of(context).labelMediumFamily),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).accent1,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).primary,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// errorBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).error,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// focusedErrorBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).error,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// suffixIcon: Icon(
// Icons.person,
// color: FlutterFlowTheme.of(context).accent1,
// ),
// ),
// style: FlutterFlowTheme.of(context).bodyMedium.override(
// fontFamily:
// FlutterFlowTheme.of(context).bodyMediumFamily,
// color: FlutterFlowTheme.of(context).primaryText,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts.asMap().containsKey(
// FlutterFlowTheme.of(context).bodyMediumFamily),
// ),
// maxLines: null,
// keyboardType: TextInputType.name,
// validator:
// _model.textController1Validator.asValidator(context),
// ),
// ),
// Padding(
// padding: const EdgeInsetsDirectional.fromSTEB(
// 24.0, 0.0, 24.0, 0.0),
// child: TextFormField(
// controller: _model.textController2,
// focusNode: _model.textFieldFocusNode2,
// autofocus: false,
// textInputAction: TextInputAction.next,
// readOnly: true,
// obscureText: false,
// decoration: InputDecoration(
// labelText: FFLocalizations.of(context).getText(
// 'ndzkqehm' /* Motivo */,
// ),
// labelStyle: FlutterFlowTheme.of(context)
// .labelMedium
// .override(
// fontFamily:
// FlutterFlowTheme.of(context).labelMediumFamily,
// color: FlutterFlowTheme.of(context).primaryText,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts.asMap().containsKey(
// FlutterFlowTheme.of(context).labelMediumFamily),
// ),
// hintStyle: FlutterFlowTheme.of(context)
// .labelMedium
// .override(
// fontFamily:
// FlutterFlowTheme.of(context).labelMediumFamily,
// color: FlutterFlowTheme.of(context).primaryText,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts.asMap().containsKey(
// FlutterFlowTheme.of(context).labelMediumFamily),
// ),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).accent1,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).primary,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// errorBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).error,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// focusedErrorBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context).error,
// width: 0.5,
// ),
// borderRadius: BorderRadius.circular(10.0),
// ),
// suffixIcon: Icon(
// Icons.history_edu,
// color: FlutterFlowTheme.of(context).accent1,
// ),
// ),
// style: FlutterFlowTheme.of(context).bodyMedium.override(
// fontFamily:
// FlutterFlowTheme.of(context).bodyMediumFamily,
// color: FlutterFlowTheme.of(context).primaryText,
// letterSpacing: 0.0,
// useGoogleFonts: GoogleFonts.asMap().containsKey(
// FlutterFlowTheme.of(context).bodyMediumFamily),
// ),
// maxLines: null,
// keyboardType: TextInputType.name,
// validator:
// _model.textController2Validator.asValidator(context),
// ),
// ),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField( child: TextFormField(
// controller: _model.textControllerStatus, // controller: _model.textControllerStatus,
// focusNode: _model.textFieldFocusNodeStatus, // focusNode: _model.textFieldFocusNodeStatus,
@ -382,94 +117,98 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0)), borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: item.value,
),
),
filled: true, filled: true,
fillColor: () { fillColor: item.value,
if (widget.vawStatus == 'L') { labelText: item.key,
return FlutterFlowTheme.of(context).primary;
} else if (widget.vawStatus == 'B') {
return FlutterFlowTheme.of(context).error;
} else if (widget.vawStatus == 'S') {
return FlutterFlowTheme.of(context).warning;
} else {
return FlutterFlowTheme.of(context).warning;
}
}(),
labelText: () {
if (widget.vawStatus == 'L') {
return FFLocalizations.of(context).getVariableText(
ptText: 'Ativo',
enText: 'Active',
);
} else if (widget.vawStatus == 'B') {
return FFLocalizations.of(context).getVariableText(
ptText: 'Bloqueado',
enText: 'Blocked',
);
} else {
return FFLocalizations.of(context).getVariableText(
ptText: 'Pendente',
enText: 'Pending',
);
}
}(),
labelStyle: FlutterFlowTheme.of(context) labelStyle: FlutterFlowTheme.of(context)
.labelMedium .labelMedium
.override( .override(
fontFamily: fontFamily: FlutterFlowTheme.of(context)
FlutterFlowTheme.of(context).labelMediumFamily, .labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText, fontWeight: FontWeight.bold,
color: FlutterFlowTheme.of(context).info,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily), FlutterFlowTheme.of(context)
.labelMediumFamily,
),
), ),
hintStyle: FlutterFlowTheme.of(context) hintStyle: FlutterFlowTheme.of(context)
.labelMedium .labelMedium
.override( .override(
fontFamily: fontFamily: FlutterFlowTheme.of(context)
FlutterFlowTheme.of(context).labelMediumFamily, .labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).info,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily), FlutterFlowTheme.of(context)
.labelMediumFamily,
),
), ),
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
errorBorder: InputBorder.none, errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none, focusedErrorBorder: InputBorder.none,
suffixIcon: Icon( suffixIcon: Icon(
Icons.info, Icons.info,
color: FlutterFlowTheme.of(context).accent1, color: FlutterFlowTheme.of(context).info,
), ),
), ),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).info,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily,
),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator: _model.textController1Validator
.asValidator(context),
),
),
);
}).toList();
}).toList(),
),
SizedBox(height: MediaQuery.of(context).size.height * 0.03),
ListView.builder(
shrinkWrap: true,
itemCount: labelsLinkedHashMap.length,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
String key = labelsLinkedHashMap.keys.elementAt(index);
String value = labelsLinkedHashMap[key]!;
// return Text('key: $key, value: $value');
return TextFormField(
readOnly: true,
initialValue: '$value',
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily, FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily), FlutterFlowTheme.of(context).bodyMediumFamily,
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator:
_model.textController1Validator.asValidator(context),
), ),
), ),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController1,
focusNode: _model.textFieldFocusNode1,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, labelText: key,
labelText: FFLocalizations.of(context).getText( filled: true,
'ivfw4j04' /* Nome */, fillColor: FlutterFlowTheme.of(context).primaryBackground,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
), ),
labelStyle: FlutterFlowTheme.of(context) labelStyle: FlutterFlowTheme.of(context)
.labelMedium .labelMedium
@ -479,7 +218,8 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily), FlutterFlowTheme.of(context).labelMediumFamily,
),
), ),
hintStyle: FlutterFlowTheme.of(context) hintStyle: FlutterFlowTheme.of(context)
.labelMedium .labelMedium
@ -489,347 +229,50 @@ class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.person,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator:
_model.textController1Validator.asValidator(context),
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController2,
focusNode: _model.textFieldFocusNode2,
autofocus: false,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText(
'ndzkqehm' /* Motivo */,
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily, FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
), ),
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily:
FlutterFlowTheme.of(context).labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.history_edu,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator:
_model.textController2Validator.asValidator(context),
),
),
if (widget.vawStatus != 'S')
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController3,
focusNode: _model.textFieldFocusNode3,
autofocus: false,
textCapitalization: TextCapitalization.none,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText(
'kt87omsz' /* Mensagem */,
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily),
),
hintStyle:
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(FlutterFlowTheme.of(context)
.labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.message,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
validator:
_model.textController3Validator.asValidator(context),
),
),
if (widget.vawStatus != 'S')
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0),
child: TextFormField(
controller: _model.textController4,
focusNode: _model.textFieldFocusNode4,
autofocus: false,
textCapitalization: TextCapitalization.none,
textInputAction: TextInputAction.next,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText(
'yyni99pe' /* Data */,
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily),
),
hintStyle:
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(FlutterFlowTheme.of(context)
.labelMediumFamily),
),
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.date_range,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
),
textAlign: TextAlign.start,
validator:
_model.textController4Validator.asValidator(context),
),
),
if (widget.vawStatus == 'S')
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 20.0, 24.0, 20.0),
child: TextFormField(
controller: _model.textController5,
focusNode: _model.textFieldFocusNode5,
autofocus: false,
textInputAction: TextInputAction.next,
obscureText: false,
decoration: InputDecoration(
isDense: true,
labelText: FFLocalizations.of(context).getText(
'ssz899es' /* Pergunta */,
),
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily),
),
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).accent1,
width: 0.5,
),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
), ),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primary,
width: 0.5,
),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
), ),
errorBorder: OutlineInputBorder( errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 0.5,
),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).error,
width: 0.5,
),
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), borderSide: BorderSide(
suffixIcon: Icon( color: FlutterFlowTheme.of(context)
Icons.question_answer, .primaryBackground, // Change border color here
color: FlutterFlowTheme.of(context).accent1,
), ),
), ),
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily:
FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily),
), ),
validator: );
_model.textController5Validator.asValidator(context), },
), ),
), SizedBox(height: MediaQuery.of(context).size.height * 0.02),
if (widget.vawStatus == 'S') if (widget.buttons
.isNotEmpty) // Adicione este SizedBox com a altura desejada
Row( Row(
mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.center, children: widget.buttons,
children: [
FlutterFlowIconButton(
borderRadius: 20.0,
borderWidth: 1.0,
showLoadingIndicator: isLoaded,
buttonSize: 40.0,
fillColor: FlutterFlowTheme.of(context).error,
icon: Icon(
Icons.close,
color: FlutterFlowTheme.of(context).primaryBackground,
size: 24.0,
),
onPressed: () async {
await widget.changeStatusAction?.call(
context,
'B',
widget.vawRef ?? '',
_model.textController5.text,
widget.vteUUID ?? '',
);
},
),
FlutterFlowIconButton(
borderRadius: 20.0,
showLoadingIndicator: isLoaded,
borderWidth: 1.0,
buttonSize: 40.0,
fillColor: FlutterFlowTheme.of(context).success,
icon: Icon(
Icons.done,
color: FlutterFlowTheme.of(context).primaryBackground,
size: 24.0,
),
onPressed: () async {
await widget.changeStatusAction?.call(
context,
'L',
widget.vawRef ?? '',
_model.textController5.text,
widget.vteUUID ?? '',
);
},
),
].divide(const SizedBox(width: 20.0)),
),
]
.divide(const SizedBox(height: 10.0))
.addToStart(const SizedBox(height: 20.0))
.addToEnd(const SizedBox(height: 20.0)),
),
), ),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
],
), ),
), ),
); );

View File

@ -16,6 +16,8 @@ import 'package:google_fonts/google_fonts.dart';
import 'forgot_password_template_component_model.dart'; import 'forgot_password_template_component_model.dart';
export 'forgot_password_template_component_model.dart'; export 'forgot_password_template_component_model.dart';
//
class ForgotPasswordTemplateComponentWidget extends StatefulWidget { class ForgotPasswordTemplateComponentWidget extends StatefulWidget {
const ForgotPasswordTemplateComponentWidget({super.key}); const ForgotPasswordTemplateComponentWidget({super.key});
@ -81,7 +83,8 @@ class _ForgotPasswordTemplateComponentWidgetState
tablet: false, tablet: false,
)) ))
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0), padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0),
child: InkWell( child: InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,
focusColor: Colors.transparent, focusColor: Colors.transparent,
@ -103,8 +106,8 @@ class _ForgotPasswordTemplateComponentWidgetState
), ),
), ),
Padding( Padding(
padding: padding: const EdgeInsetsDirectional.fromSTEB(
const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0), 12.0, 0.0, 0.0, 0.0),
child: Text( child: Text(
'', '',
style: style:
@ -124,7 +127,8 @@ class _ForgotPasswordTemplateComponentWidgetState
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0),
child: Text( child: Text(
FFLocalizations.of(context).getText( FFLocalizations.of(context).getText(
'xxm3ajsy' /* ESQUECEU SUA SENHA? */, 'xxm3ajsy' /* ESQUECEU SUA SENHA? */,
@ -140,7 +144,8 @@ class _ForgotPasswordTemplateComponentWidgetState
), ),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0),
child: Text( child: Text(
FFLocalizations.of(context).getText( FFLocalizations.of(context).getText(
'wu2f7yzo' /* Não se preucupe nós vamos te a... */, 'wu2f7yzo' /* Não se preucupe nós vamos te a... */,
@ -160,7 +165,8 @@ class _ForgotPasswordTemplateComponentWidgetState
key: _model.formKey, key: _model.formKey,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
child: Padding( child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0), padding:
const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0),
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
@ -246,31 +252,43 @@ class _ForgotPasswordTemplateComponentWidgetState
Align( Align(
alignment: const AlignmentDirectional(0.0, 0.0), alignment: const AlignmentDirectional(0.0, 0.0),
child: Padding( child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: (_model.emailAddressTextController.text == '' || !ValidatorUtil.isValidEmail(_model.emailAddressTextController.text)) onPressed: (_model.emailAddressTextController.text == '' ||
!ValidatorUtil.isValidEmail(
_model.emailAddressTextController.text))
? null ? null
: () async { : () async {
try { try {
_model.req = await PhpGroup.forgotPasswordCall.call( _model.req = await PhpGroup.forgotPasswordCall.call(
email: _model.emailAddressTextController.text, email: _model.emailAddressTextController.text,
); );
if (PhpGroup.forgotPasswordCall.error((_model.req?.jsonBody ?? '')) == false) { if (PhpGroup.forgotPasswordCall
await DialogUtil.success(context, FFLocalizations.of(context).getVariableText( .error((_model.req?.jsonBody ?? '')) ==
false) {
await DialogUtil.success(
context,
FFLocalizations.of(context).getVariableText(
enText: "Send E-mail Successful!", enText: "Send E-mail Successful!",
ptText: "E-mail Enviado com Sucesso!" ptText: "E-mail Enviado com Sucesso!"));
));
Navigator.pop(context); Navigator.pop(context);
} else { } else {
await DialogUtil.error(context, PhpGroup.forgotPasswordCall.msg((_model.req?.jsonBody ?? ''))!); await DialogUtil.error(
context,
PhpGroup.forgotPasswordCall
.msg((_model.req?.jsonBody ?? ''))!);
} }
setState(() {}); setState(() {});
} catch (error, stack) { } catch (error, stack) {
LogUtil.requestAPIFailed("iforgot.php", _model.emailAddressTextController.text, "Recuperar Senha", error, stack); LogUtil.requestAPIFailed(
"iforgot.php",
_model.emailAddressTextController.text,
"Recuperar Senha",
error,
stack);
await DialogUtil.errorDefault(context); await DialogUtil.errorDefault(context);
} }
}, },
@ -280,9 +298,10 @@ class _ForgotPasswordTemplateComponentWidgetState
options: FFButtonOptions( options: FFButtonOptions(
width: 270.0, width: 270.0,
height: 50.0, height: 50.0,
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(
iconPadding: 0.0, 0.0, 0.0, 0.0),
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), iconPadding: const EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 0.0),
color: FlutterFlowTheme.of(context).primary, color: FlutterFlowTheme.of(context).primary,
textStyle: FlutterFlowTheme.of(context).titleSmall.override( textStyle: FlutterFlowTheme.of(context).titleSmall.override(
fontFamily: 'Plus Jakarta Sans', fontFamily: 'Plus Jakarta Sans',
@ -298,12 +317,8 @@ class _ForgotPasswordTemplateComponentWidgetState
color: Colors.transparent, color: Colors.transparent,
width: 1.0, width: 1.0,
), ),
disabledColor: disabledColor: FlutterFlowTheme.of(context).customColor5,
FlutterFlowTheme.of( disabledTextColor: Colors.white,
context)
.customColor5,
disabledTextColor:
Colors.white,
), ),
showLoadingIndicator: true, showLoadingIndicator: true,
), ),

View File

@ -5,7 +5,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/internationalization.dart'; import 'package:hub/flutter_flow/internationalization.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';
@ -54,7 +53,6 @@ class _MessageNotificationModalTemplateComponentWidgetState
_model.textController3 ??= TextEditingController(text: widget.to); _model.textController3 ??= TextEditingController(text: widget.to);
_model.textFieldFocusNode3 ??= FocusNode(); _model.textFieldFocusNode3 ??= FocusNode();
} }
@override @override
@ -73,7 +71,7 @@ class _MessageNotificationModalTemplateComponentWidgetState
child: Padding( child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0),
child: Container( child: Container(
width: MediaQuery.sizeOf(context).width * 0.9, width: MediaQuery.sizeOf(context).width,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
@ -88,7 +86,6 @@ class _MessageNotificationModalTemplateComponentWidgetState
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(
24.0, 0.0, 24.0, 0.0), 24.0, 0.0, 24.0, 0.0),
@ -105,7 +102,6 @@ class _MessageNotificationModalTemplateComponentWidgetState
ptText: 'Mensagem', ptText: 'Mensagem',
enText: 'Message', enText: 'Message',
), ),
labelStyle: FlutterFlowTheme.of(context) labelStyle: FlutterFlowTheme.of(context)
.labelMedium .labelMedium
.override( .override(
@ -163,7 +159,8 @@ class _MessageNotificationModalTemplateComponentWidgetState
obscureText: false, obscureText: false,
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
labelText: FFLocalizations.of(context).getVariableText( labelText:
FFLocalizations.of(context).getVariableText(
ptText: 'De', ptText: 'De',
enText: 'From', enText: 'From',
), ),
@ -278,8 +275,6 @@ class _MessageNotificationModalTemplateComponentWidgetState
_model.textController3Validator.asValidator(context), _model.textController3Validator.asValidator(context),
), ),
), ),
] ]
.divide(const SizedBox(height: 10.0)) .divide(const SizedBox(height: 10.0))
.addToStart(const SizedBox(height: 20.0)) .addToStart(const SizedBox(height: 20.0))

View File

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:developer'; import 'dart:developer';
import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart'; import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart';
@ -14,12 +15,20 @@ import 'regisiter_vistor_template_component_widget.dart';
class RegisiterVistorTemplateComponentModel class RegisiterVistorTemplateComponentModel
extends FlutterFlowModel<RegisiterVistorTemplateComponentWidget> { extends FlutterFlowModel<RegisiterVistorTemplateComponentWidget> {
/// State fields for stateful widgets in this page. /// State fields for stateful widgets in this page.
Timer? _debounceTimer;
final unfocusNode = FocusNode(); final unfocusNode = FocusNode();
bool isDataUploading = false; bool isDataUploading = false;
FFUploadedFile uploadedLocalFile = FFUploadedFile uploadedLocalFile =
FFUploadedFile(bytes: Uint8List.fromList([])); FFUploadedFile(bytes: Uint8List.fromList([]));
void debounce(Function() fn, Duration time) {
if (_debounceTimer != null) {
_debounceTimer!.cancel();
}
_debounceTimer = Timer(time, fn);
}
// State field(s) for TextField widget. // State field(s) for TextField widget.
FocusNode? textFieldFocusNode1; FocusNode? textFieldFocusNode1;
TextEditingController? textController1; TextEditingController? textController1;
@ -35,7 +44,7 @@ class RegisiterVistorTemplateComponentModel
return null; return null;
} }
Future<bool?> getVisitanteByDocument( Future<bool> getVisitanteByDocument(
String document, BuildContext context) async { String document, BuildContext context) async {
final response = await PhpGroup.getVisitorByDocCall.call( final response = await PhpGroup.getVisitorByDocCall.call(
devUUID: FFAppState().devUUID, devUUID: FFAppState().devUUID,
@ -44,12 +53,12 @@ class RegisiterVistorTemplateComponentModel
atividade: 'getVisitante', atividade: 'getVisitante',
documento: document, documento: document,
); );
log('${response.jsonBody}');
if (response.jsonBody['visitante']['VTE_ID'] != '0' && if (response.jsonBody['visitante']['VTE_ID'] != '0' &&
response.jsonBody['error'] != 'false') { response.jsonBody['error'] != 'false') {
return true; return true;
} }
return null; return false;
} }
// State field(s) for TextField widget. // State field(s) for TextField widget.

View File

@ -23,9 +23,10 @@ export 'regisiter_vistor_template_component_model.dart';
class RegisiterVistorTemplateComponentWidget extends StatefulWidget { class RegisiterVistorTemplateComponentWidget extends StatefulWidget {
final String source; final String source;
final String? doc;
const RegisiterVistorTemplateComponentWidget( const RegisiterVistorTemplateComponentWidget(
{super.key, required this.source}); {super.key, required this.source, this.doc});
@override @override
State<RegisiterVistorTemplateComponentWidget> createState() => State<RegisiterVistorTemplateComponentWidget> createState() =>
@ -38,15 +39,22 @@ class _RegisiterVistorTemplateComponentWidgetState
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
bool _isVisitorRegistered = false;
BehaviorSubject<bool> visitorAlreadyRegistered = BehaviorSubject<bool>();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
visitorAlreadyRegistered = BehaviorSubject<bool>.seeded(false);
_model = _model =
createModel(context, () => RegisiterVistorTemplateComponentModel()); createModel(context, () => RegisiterVistorTemplateComponentModel());
_model.textController1 ??= TextEditingController(); _model.textController1 ??= TextEditingController();
_model.textFieldFocusNode1 ??= FocusNode(); _model.textFieldFocusNode1 ??= FocusNode();
log('doc: ${widget.doc}');
_model.textController2 ??= TextEditingController(); _model.textController2 ??= TextEditingController();
_model.textFieldFocusNode2 ??= FocusNode(); _model.textFieldFocusNode2 ??= FocusNode();
_model.textController2?.addListener(_onTextChanged); _model.textController2?.addListener(_onTextChanged);
@ -56,6 +64,10 @@ class _RegisiterVistorTemplateComponentWidgetState
_model.textController4 ??= TextEditingController(); _model.textController4 ??= TextEditingController();
_model.textFieldFocusNode4 ??= FocusNode(); _model.textFieldFocusNode4 ??= FocusNode();
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
_model.textController2.text = widget.doc ?? '';
});
} }
@override @override
@ -67,17 +79,40 @@ class _RegisiterVistorTemplateComponentWidgetState
} }
void _onTextChanged() { void _onTextChanged() {
log('changed');
setState(() {}); setState(() {});
} }
bool _isFormValid(BuildContext context) {
if (_model.uploadedLocalFile.bytes?.isEmpty ?? true) {
return false;
}
if (_model.textController1.text.isEmpty ||
_model.textController1.text == '') {
return false;
}
if (_model.dropDownValue == null ||
_model.dropDownValue!.isEmpty ||
_model.dropDownValue == '') {
return false;
}
if (_model.textController2.text.isEmpty ||
_model.textController2.text == '') {
return false;
}
if (_isVisitorRegistered) {
return false;
}
return true;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
BehaviorSubject<bool> visitorAlreadyRegistered = BehaviorSubject<bool>();
context.watch<FFAppState>(); context.watch<FFAppState>();
log(context
.describeWidget('RegisiterVistorTemplateComponentWidget')
.toString());
return Align( return Align(
alignment: const AlignmentDirectional(0.0, 1.0), alignment: const AlignmentDirectional(0.0, 1.0),
child: Container( child: Container(
@ -123,7 +158,8 @@ class _RegisiterVistorTemplateComponentWidgetState
Padding( Padding(
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: Column(children: [
TextFormField(
controller: _model.textController2, controller: _model.textController2,
focusNode: _model.textFieldFocusNode2, focusNode: _model.textFieldFocusNode2,
autovalidateMode: AutovalidateMode.onUserInteraction, autovalidateMode: AutovalidateMode.onUserInteraction,
@ -141,21 +177,22 @@ class _RegisiterVistorTemplateComponentWidgetState
labelStyle: FlutterFlowTheme.of(context) labelStyle: FlutterFlowTheme.of(context)
.labelMedium .labelMedium
.override( .override(
fontFamily: fontFamily: FlutterFlowTheme.of(context)
FlutterFlowTheme.of(context).labelMediumFamily, .labelMediumFamily,
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primaryText,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily), FlutterFlowTheme.of(context)
.labelMediumFamily),
), ),
hintStyle: FlutterFlowTheme.of(context) hintStyle:
.labelMedium FlutterFlowTheme.of(context).labelMedium.override(
.override( fontFamily: FlutterFlowTheme.of(context)
fontFamily: .labelMediumFamily,
FlutterFlowTheme.of(context).labelMediumFamily,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap()
FlutterFlowTheme.of(context).labelMediumFamily), .containsKey(FlutterFlowTheme.of(context)
.labelMediumFamily),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
@ -198,38 +235,31 @@ class _RegisiterVistorTemplateComponentWidgetState
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).bodyMediumFamily), FlutterFlowTheme.of(context).bodyMediumFamily),
), ),
onChanged: (value) {
_model.debounce(() async {
var data = await _model.getVisitanteByDocument(
value, context);
setState(() {
_isVisitorRegistered = data;
});
}, const Duration(milliseconds: 500));
},
validator: validator:
_model.textController2Validator.asValidator(context), _model.textController2Validator.asValidator(context),
inputFormatters: [ inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9]')), FilteringTextInputFormatter.allow(RegExp('[0-9]')),
], ],
), ),
), _model.textController2.text.isEmpty
FutureBuilder(
future: _model.textController2.text.isNotEmpty
? _model.getVisitanteByDocument(
_model.textController2.text, context)
: null,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const SizedBox();
} else if (snapshot.hasError ||
snapshot.data == null ||
snapshot.data == '') {
visitorAlreadyRegistered.add(true);
return const SizedBox();
} else {
visitorAlreadyRegistered.add(false);
return _model.textController2.text.isEmpty
? const SizedBox() ? const SizedBox()
: Row( : _isVisitorRegistered == true
? Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only( padding: const EdgeInsetsDirectional.only(
right: MediaQuery.sizeOf(context).width * top: 5, start: 12),
0.1),
child: Text( child: Text(
FFLocalizations.of(context) FFLocalizations.of(context)
.getVariableText( .getVariableText(
@ -237,19 +267,28 @@ class _RegisiterVistorTemplateComponentWidgetState
ptText: 'Visitante já cadastrado', ptText: 'Visitante já cadastrado',
), ),
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context)
.bodySmall .labelSmall
.override( .override(
fontFamily: 'Nunito', fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context) color: Theme.of(context)
.error, .brightness ==
fontSize: 14.0, Brightness.dark
? Color.alphaBlend(
Colors.white
.withOpacity(0.7),
Colors.red)
: Color.alphaBlend(
Colors.black
.withOpacity(0.25),
Colors.red),
fontSize: 13.0,
letterSpacing: 0.0, letterSpacing: 0.0,
)), )),
), ),
], ],
); )
} : const SizedBox()
}, ]),
), ),
Padding( Padding(
padding: const EdgeInsetsDirectional.fromSTEB( padding: const EdgeInsetsDirectional.fromSTEB(
@ -334,41 +373,11 @@ class _RegisiterVistorTemplateComponentWidgetState
), ),
), ),
Padding( Padding(
padding: padding: const EdgeInsetsDirectional.fromSTEB(
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), 24.0, 0.0, 24.0, 10.0),
child: Container(
width: MediaQuery.sizeOf(context).width * 0.95,
decoration: const BoxDecoration(),
child: Column( child: Column(
children: [ children: [
Row( FlutterFlowDropDown<String>(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 7.0),
child: Text(
FFLocalizations.of(context).getText(
'yp23q90m' /* Selecione o tipo: */,
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(
0.0, 0.0, 0.0, 5.0),
child: FlutterFlowDropDown<String>(
controller: _model.dropDownValueController ??= controller: _model.dropDownValueController ??=
FormFieldController<String>(null), FormFieldController<String>(null),
options: [ options: [
@ -381,18 +390,16 @@ class _RegisiterVistorTemplateComponentWidgetState
], ],
onChanged: (val) => onChanged: (val) =>
setState(() => _model.dropDownValue = val), setState(() => _model.dropDownValue = val),
width: 200.0, width: MediaQuery.sizeOf(context).width * 0.9,
height: 44.0, // height: 44.0,
textStyle: FlutterFlowTheme.of(context) textStyle: FlutterFlowTheme.of(context)
.bodyMedium .bodyMedium
.override( .override(
fontFamily: FlutterFlowTheme.of(context) fontFamily:
.bodyMediumFamily, FlutterFlowTheme.of(context).bodyMediumFamily,
color: FlutterFlowTheme.of(context) color: FlutterFlowTheme.of(context).primaryText,
.primaryText,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap().containsKey(
.containsKey(
FlutterFlowTheme.of(context) FlutterFlowTheme.of(context)
.bodyMediumFamily), .bodyMediumFamily),
), ),
@ -401,13 +408,11 @@ class _RegisiterVistorTemplateComponentWidgetState
), ),
icon: Icon( icon: Icon(
Icons.keyboard_arrow_down_rounded, Icons.keyboard_arrow_down_rounded,
color: color: FlutterFlowTheme.of(context).primaryText,
FlutterFlowTheme.of(context).primaryText,
size: 24.0, size: 24.0,
), ),
elevation: 2.0, elevation: 2.0,
borderColor: borderColor: FlutterFlowTheme.of(context).customColor6,
FlutterFlowTheme.of(context).customColor6,
borderWidth: 0.5, borderWidth: 0.5,
borderRadius: 8.0, borderRadius: 8.0,
margin: const EdgeInsetsDirectional.fromSTEB( margin: const EdgeInsetsDirectional.fromSTEB(
@ -417,15 +422,15 @@ class _RegisiterVistorTemplateComponentWidgetState
isSearchable: false, isSearchable: false,
isMultiSelect: false, isMultiSelect: false,
), ),
),
]
.divide(const SizedBox(width: 19.0))
.addToStart(const SizedBox(width: 30.0)),
),
if (_model.dropDownValue == null || if (_model.dropDownValue == null ||
_model.dropDownValue == '') _model.dropDownValue == '')
Align( Row(
alignment: const AlignmentDirectional(0.4, 0), mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: const EdgeInsetsDirectional.only(
top: 5, start: 15),
child: Text( child: Text(
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
enText: 'This field is required', enText: 'This field is required',
@ -447,6 +452,7 @@ class _RegisiterVistorTemplateComponentWidgetState
), ),
], ],
), ),
],
), ),
), ),
Builder( Builder(
@ -491,10 +497,11 @@ class _RegisiterVistorTemplateComponentWidgetState
allowPhoto: true, allowPhoto: true,
includeDimensions: true, includeDimensions: true,
); );
if (selectedMedia != null && if (selectedMedia != null) {
selectedMedia.every((m) => // &&
validateFileFormat( // selectedMedia.every((m) =>
m.storagePath, context))) { // validateFileFormat(
// m.storagePath, context))) {
setState(() => _model.isDataUploading = true); setState(() => _model.isDataUploading = true);
var selectedUploadedFiles = var selectedUploadedFiles =
<FFUploadedFile>[]; <FFUploadedFile>[];
@ -793,15 +800,8 @@ class _RegisiterVistorTemplateComponentWidgetState
padding: padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 65.0, 0.0, 0.0), const EdgeInsetsDirectional.fromSTEB(0.0, 65.0, 0.0, 0.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: (((_model.uploadedLocalFile.bytes?.isNotEmpty ?? onPressed: _isFormValid(context)
false)) &&
(_model.textController1.text != '') &&
(_model.dropDownValue != null &&
_model.dropDownValue != '') &&
(_model.textController2.text != ''))
? () async { ? () async {
log(visitorAlreadyRegistered.value.toString());
if (visitorAlreadyRegistered.value == true) {
_model.imgBase64 = _model.imgBase64 =
await actions.convertImageFileToBase64( await actions.convertImageFileToBase64(
_model.uploadedLocalFile, _model.uploadedLocalFile,
@ -830,8 +830,7 @@ class _RegisiterVistorTemplateComponentWidgetState
return GestureDetector( return GestureDetector(
onTap: () => Navigator.pop(context), onTap: () => Navigator.pop(context),
child: Padding( child: Padding(
padding: padding: MediaQuery.viewInsetsOf(context),
MediaQuery.viewInsetsOf(context),
child: Dialog( child: Dialog(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
child: ThrowExceptionWidget( child: ThrowExceptionWidget(
@ -859,6 +858,8 @@ class _RegisiterVistorTemplateComponentWidgetState
_model.textController3?.clear(); _model.textController3?.clear();
_model.textController4?.clear(); _model.textController4?.clear();
_model.dropDownValueController?.reset(); _model.dropDownValueController?.reset();
_model.uploadedLocalFile = FFUploadedFile(
bytes: Uint8List.fromList([]));
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
@ -868,8 +869,7 @@ class _RegisiterVistorTemplateComponentWidgetState
enText: enText:
'Visitor successfully registered.'), 'Visitor successfully registered.'),
style: TextStyle( style: TextStyle(
color: color: FlutterFlowTheme.of(context)
FlutterFlowTheme.of(context)
.info)), .info)),
backgroundColor: backgroundColor:
FlutterFlowTheme.of(context).primary, FlutterFlowTheme.of(context).primary,
@ -886,27 +886,27 @@ class _RegisiterVistorTemplateComponentWidgetState
); );
if (widget.source == if (widget.source ==
'VisitorNotFoundComponent') { 'VisitorNotFoundComponent') {
Navigator.pop(context); Navigator.pop(context, true);
} }
}); });
} else { } else {
return DialogUtil.error( return DialogUtil.error(
context, context,
PhpGroup.postScheduleVisitorCall PhpGroup.postScheduleVisitorCall.errorMsg(
_model
.scheduleVisitor?.jsonBody) ==
null
? FFLocalizations.of(context)
.getVariableText(
ptText:
'Erro ao se conectar com o servidor',
enText: 'Error connecting to server',
)
: PhpGroup.postScheduleVisitorCall
.errorMsg( .errorMsg(
_model.scheduleVisitor?.jsonBody) _model.scheduleVisitor?.jsonBody)
.toString()); .toString());
} }
} else {
DialogUtil.error(
context,
FFLocalizations.of(context).getVariableText(
ptText:
'Visitante já cadastrado. Verifique se o documento foi preenchido corretamente.',
enText:
'Visitor already registered. Check if the document was filled in correctly.',
));
}
} }
: null, : null,
text: FFLocalizations.of(context).getText( text: FFLocalizations.of(context).getText(

View File

@ -100,7 +100,8 @@ class _SignInTemplateComponentWidgetState
} }
bool _isFormInvalid() { bool _isFormInvalid() {
if (_model.emailAddressTextController.text == '' || _model.passwordTextController.text == '') { if (_model.emailAddressTextController.text == '' ||
_model.passwordTextController.text == '') {
return true; return true;
} }
@ -185,7 +186,8 @@ class _SignInTemplateComponentWidgetState
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
child: const AtomImageSvgTheme(filename: 'login', width: 600, height: 155), child: const AtomImageSvgTheme(
filename: 'login', width: 600, height: 155),
), ),
), ),
Column( Column(
@ -697,7 +699,8 @@ class _SignInTemplateComponentWidgetState
.fromSTEB(0.0, 0.0, .fromSTEB(0.0, 0.0,
0.0, 16.0), 0.0, 16.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: _isFormInvalid() onPressed:
_isFormInvalid()
? null ? null
: () async { : () async {
try { try {
@ -711,10 +714,20 @@ class _SignInTemplateComponentWidgetState
.passwordTextController .passwordTextController
.text, .text,
); );
setState(() {}); setState(
() {});
} catch (e, s) { } catch (e, s) {
await DialogUtil.errorDefault(context); await DialogUtil
LogUtil.requestAPIFailed('login.php', _model.emailAddressTextController.text, "Login", e, s); .errorDefault(
context);
LogUtil.requestAPIFailed(
'login.php',
_model
.emailAddressTextController
.text,
"Login",
e,
s);
} }
}, },
text: FFLocalizations.of( text: FFLocalizations.of(
@ -773,7 +786,8 @@ class _SignInTemplateComponentWidgetState
const Color( const Color(
0xE81AAB5F), 0xE81AAB5F),
), ),
showLoadingIndicator: true, showLoadingIndicator:
true,
), ),
), ),
), ),
@ -866,15 +880,20 @@ class _SignInTemplateComponentWidgetState
onTap: () async { onTap: () async {
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor:
Colors.transparent,
context: context, context: context,
builder: (context) { builder: (context) {
return Padding( return Padding(
padding: MediaQuery.viewInsetsOf(context), padding:
child: const ForgotPasswordTemplateComponentWidget(), MediaQuery.viewInsetsOf(
context),
child:
const ForgotPasswordTemplateComponentWidget(),
); );
}, },
).then((value) => safeSetState(() {})); ).then(
(value) => safeSetState(() {}));
}, },
child: RichText( child: RichText(
textScaler: MediaQuery.of(context) textScaler: MediaQuery.of(context)

View File

@ -3,6 +3,7 @@ import 'dart:developer';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/flutter_flow/nav/serialization_util.dart'; import 'package:hub/flutter_flow/nav/serialization_util.dart';
import 'package:hub/shared/utils/dialog_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 '/components/molecular_components/throw_exception/throw_exception_widget.dart';
@ -63,7 +64,6 @@ List<dynamic>? findVisitorById(List<dynamic>? jsonList, String? id) {
); );
return foundItem != null ? [foundItem] : null; return foundItem != null ? [foundItem] : null;
} catch (e) { } catch (e) {
log("Error searching item: $e");
return null; return null;
} }
} }
@ -131,10 +131,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
context.watch<FFAppState>(); context.watch<FFAppState>();
return Padding( return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 35.0, 0.0, 0.0), padding: const EdgeInsetsDirectional.fromSTEB(0.0, 200.0, 0.0, 0.0),
child: Container( child: Container(
width: double.infinity, width: MediaQuery.of(context).size.width,
height: double.infinity, height: MediaQuery.of(context).size.height,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground, color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
@ -264,6 +264,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
focusNode: _model.textFieldFocusNode1, focusNode: _model.textFieldFocusNode1,
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
showCursor: false,
enabled: false,
cursorColor: FlutterFlowTheme.of(context).primary,
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'9yu35pzg' /* Encerramento da Visita */, '9yu35pzg' /* Encerramento da Visita */,
@ -348,6 +352,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
focusNode: _model.textFieldFocusNode2, focusNode: _model.textFieldFocusNode2,
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
showCursor: false,
enabled: false,
cursorColor: FlutterFlowTheme.of(context).primary,
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'aj6scczp' /* Início */, 'aj6scczp' /* Início */,
@ -436,6 +444,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
focusNode: _model.textFieldFocusNode3, focusNode: _model.textFieldFocusNode3,
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
showCursor: false,
enabled: false,
cursorColor: FlutterFlowTheme.of(context).primary,
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'rvi5z7wg' /* Término */, 'rvi5z7wg' /* Término */,
@ -534,6 +546,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
focusNode: _model.textFieldFocusNode4, focusNode: _model.textFieldFocusNode4,
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
showCursor: false,
enabled: false,
cursorColor: FlutterFlowTheme.of(context).primary,
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'yxilg7ek' /* Motivo da Visita */, 'yxilg7ek' /* Motivo da Visita */,
@ -622,6 +638,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
focusNode: _model.textFieldFocusNode5, focusNode: _model.textFieldFocusNode5,
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
showCursor: false,
enabled: false,
cursorColor: FlutterFlowTheme.of(context).primary,
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'dgr3pk3a' /* Nível de Acesso */, 'dgr3pk3a' /* Nível de Acesso */,
@ -714,6 +734,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
focusNode: _model.textFieldFocusNode6, focusNode: _model.textFieldFocusNode6,
autofocus: false, autofocus: false,
obscureText: false, obscureText: false,
showCursor: false,
enabled: false,
cursorColor: FlutterFlowTheme.of(context).primary,
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
labelText: FFLocalizations.of(context).getText( labelText: FFLocalizations.of(context).getText(
'lppn9rxa' /* Observações da Visita */, 'lppn9rxa' /* Observações da Visita */,
@ -785,24 +809,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
], ],
), ),
), ),
Align( Builder(
alignment: const AlignmentDirectional(0.0, 1.0),
child: Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(0.0, 6.0, 0.0, 0.0),
child: Container(
width: double.infinity,
height: 35.0,
decoration: BoxDecoration(
color: widget.visitStatusColor,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(0.0),
bottomRight: Radius.circular(0.0),
topLeft: Radius.circular(0.0),
topRight: Radius.circular(0.0),
),
),
child: Builder(
builder: (context) { builder: (context) {
if (widget.visitStatusStr == 'A') { if (widget.visitStatusStr == 'A') {
return Row( return Row(
@ -813,10 +820,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
borderRadius: 20.0, borderRadius: 20.0,
borderWidth: 1.0, borderWidth: 1.0,
buttonSize: 40.0, buttonSize: 40.0,
// fillColor: widget.visitStatusColor,
icon: Icon( icon: Icon(
Icons.block_sharp, Icons.block_sharp,
color: FlutterFlowTheme.of(context) color: FlutterFlowTheme.of(context).error,
.primaryBackground,
size: 24.0, size: 24.0,
), ),
onPressed: () async { onPressed: () async {
@ -835,6 +842,8 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
false) { false) {
Navigator.pop(context); Navigator.pop(context);
} else { } else {
final error =
await DialogUtil.errorDefault(context);
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@ -842,14 +851,8 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
context: context, context: context,
builder: (context) { builder: (context) {
return Padding( return Padding(
padding: padding: MediaQuery.viewInsetsOf(context),
MediaQuery.viewInsetsOf(context), child: error,
child: ThrowExceptionWidget(
msg: PhpGroup.deleteVisitCall.msg(
(_model.deleteVisit?.jsonBody ??
''),
)!,
),
); );
}, },
).then((value) => safeSetState(() {})); ).then((value) => safeSetState(() {}));
@ -865,12 +868,10 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
buttonSize: 40.0, buttonSize: 40.0,
icon: Icon( icon: Icon(
Icons.share, Icons.share,
color: FlutterFlowTheme.of(context) color: FlutterFlowTheme.of(context).accent1,
.primaryBackground,
size: 24.0, size: 24.0,
), ),
onPressed: () { onPressed: () {
log('IconButton pressed ...');
// Implement share functionality here // Implement share functionality here
Share.share( Share.share(
'Visita agendada para ${widget.visitStartDate} com término previsto para ${widget.visitEndDate}. Motivo: ${widget.visitReasonStr}. Nível de acesso: ${widget.visitLevelStr}. Observações: ${widget.visitObsStr}.', 'Visita agendada para ${widget.visitStartDate} com término previsto para ${widget.visitEndDate}. Motivo: ${widget.visitReasonStr}. Nível de acesso: ${widget.visitLevelStr}. Observações: ${widget.visitObsStr}.',
@ -898,8 +899,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
dateTimeFormat( dateTimeFormat(
'd/M/y H:mm:ss', 'd/M/y H:mm:ss',
getCurrentTimestamp, getCurrentTimestamp,
locale: FFLocalizations.of(context) locale: FFLocalizations.of(context).languageCode,
.languageCode,
), ),
ParamType.String, ParamType.String,
), ),
@ -937,7 +937,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
}, },
child: Icon( child: Icon(
Icons.repeat, Icons.repeat,
color: FlutterFlowTheme.of(context).secondaryText, color: widget.visitStatusColor,
size: 24.0, size: 24.0,
), ),
); );
@ -946,17 +946,13 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
width: 100.0, width: 100.0,
height: 100.0, height: 100.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: FlutterFlowTheme.of(context) color: FlutterFlowTheme.of(context).primaryBackground,
.secondaryBackground,
), ),
); );
} }
}, },
), ),
), ].addToEnd(const SizedBox(height: 5.0)),
),
),
],
), ),
), ),
); );

View File

@ -1,3 +1,5 @@
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';
import 'package:hub/components/templates_components/view_visit_detail/view_visit_detail_widget.dart'; import 'package:hub/components/templates_components/view_visit_detail/view_visit_detail_widget.dart';

View File

@ -1,3 +1,6 @@
import 'dart:developer';
import 'package:flutter/services.dart';
import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart'; import 'package:hub/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart';
import 'package:hub/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart';
@ -34,7 +37,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
late VisitorSearchModalTemplateComponentModel _model; late VisitorSearchModalTemplateComponentModel _model;
@override @override
void setState(VoidCallback callback) { safeSetState(VoidCallback callback) {
super.setState(callback); super.setState(callback);
_model.onUpdate(); _model.onUpdate();
} }
@ -84,51 +87,8 @@ class _VisitorSearchModalTemplateComponentWidgetState
controller: _model.textController, controller: _model.textController,
focusNode: _model.textFieldFocusNode, focusNode: _model.textFieldFocusNode,
onFieldSubmitted: (_) async { onFieldSubmitted: (_) async {
setState(() { await addVisitor(context);
_model.textController?.text = _model.textController.text; safeSetState(() {});
_model.textController?.selection = TextSelection.collapsed(
offset: _model.textController!.text.length);
});
_model.getVisitorByDoc =
await PhpGroup.getVisitorByDocCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
atividade: 'getVisitante',
documento: _model.textController.text,
);
if (PhpGroup.getVisitorByDocCall.vistanteId(
(_model.getVisitorByDoc?.jsonBody ?? ''),
) !=
'0') {
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
(_model.getVisitorByDoc?.jsonBody ?? ''),
));
setState(() {});
_model.addToDocs(_model.textController.text);
setState(() {});
} else {
await showAdaptiveDialog(
useSafeArea: true,
context: context,
builder: (context) {
return Dialog(
child: Padding(
padding: MediaQuery.viewInsetsOf(context),
child: Container(
color: Colors.transparent,
// width: MediaQuery.of(context).size.height * 0.1,
// height:
// MediaQuery.of(context).size.height * 0.4,
child: const VisitorNotFoundComponentWidget()),
),
);
},
).then((value) => safeSetState(() {}));
}
setState(() {});
}, },
autofocus: false, autofocus: false,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
@ -146,9 +106,6 @@ class _VisitorSearchModalTemplateComponentWidgetState
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap().containsKey(
FlutterFlowTheme.of(context).labelMediumFamily), FlutterFlowTheme.of(context).labelMediumFamily),
), ),
hintText: FFLocalizations.of(context).getText(
'8i1qszba' /* test */,
),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
color: FlutterFlowTheme.of(context).accent1, color: FlutterFlowTheme.of(context).accent1,
@ -212,6 +169,9 @@ class _VisitorSearchModalTemplateComponentWidgetState
), ),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: _model.textControllerValidator.asValidator(context), validator: _model.textControllerValidator.asValidator(context),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
],
), ),
), ),
if (_model.visitors.isNotEmpty && _model.visitors.length > 0) if (_model.visitors.isNotEmpty && _model.visitors.length > 0)
@ -396,7 +356,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
onPressed: () async { onPressed: () async {
_model.removeFromVisitors( _model.removeFromVisitors(
visitorItem); visitorItem);
setState(() {}); safeSetState(() {});
}, },
), ),
], ],
@ -427,18 +387,23 @@ class _VisitorSearchModalTemplateComponentWidgetState
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
FFButtonWidget( FFButtonWidget(
onPressed: () async { onPressed: MediaQuery.of(context).viewInsets.bottom > 0
await widget.getVisitors?.call( ? () async {
_model.visitors, await addVisitor(context);
);
await widget.getDocs?.call( safeSetState(() {});
_model.docs, }
); : () async {
Navigator.pop(context); await sendVisitors(context);
}, },
text: FFLocalizations.of(context).getVariableText( text: MediaQuery.of(context).viewInsets.bottom > 0
? FFLocalizations.of(context).getVariableText(
enText: 'Add', enText: 'Add',
ptText: 'Adicionar', ptText: 'Adicionar',
)
: FFLocalizations.of(context).getVariableText(
enText: 'Submit',
ptText: 'Enviar',
), ),
options: FFButtonOptions( options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3, width: MediaQuery.of(context).size.width * 0.3,
@ -472,11 +437,70 @@ class _VisitorSearchModalTemplateComponentWidgetState
], ],
), ),
const SizedBox( const SizedBox(
height: 10.0, height: 20.0,
) )
], ],
), ),
), ),
); );
} }
Future<void> sendVisitors(BuildContext context) async {
await widget.getVisitors?.call(
_model.visitors,
);
await widget.getDocs?.call(
_model.docs,
);
Navigator.pop(context);
}
Future<void> addVisitor(BuildContext context) async {
safeSetState(() {
_model.textController?.text = _model.textController.text;
_model.textController?.selection =
TextSelection.collapsed(offset: _model.textController!.text.length);
});
_model.getVisitorByDoc = await PhpGroup.getVisitorByDocCall.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID,
atividade: 'getVisitante',
documento: _model.textController.text,
);
if (PhpGroup.getVisitorByDocCall.vistanteId(
(_model.getVisitorByDoc?.jsonBody ?? ''),
) !=
'0' &&
PhpGroup.getVisitorByDocCall
.error((_model.getVisitorByDoc?.jsonBody ?? '')) ==
false &&
PhpGroup.getVisitorByDocCall
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
null) {
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
(_model.getVisitorByDoc?.jsonBody ?? ''),
));
safeSetState(() {});
_model.addToDocs(_model.textController.text);
safeSetState(() {});
} else {
await showAdaptiveDialog(
useSafeArea: true,
context: context,
builder: (context) {
return Dialog(
child: VisitorNotFoundComponentWidget(
doc: _model.textController.text,
),
);
},
).then((value) => safeSetState(() {
if (value != null) {
addVisitor(context);
}
}));
}
}
} }

View File

@ -1,5 +1,3 @@
import '/backend/schema/structs/index.dart'; import '/backend/schema/structs/index.dart';
import 'dart:developer'; import 'dart:developer';
import '/backend/schema/enums/enums.dart'; import '/backend/schema/enums/enums.dart';
@ -12,29 +10,14 @@ import 'package:flutter/material.dart';
import 'dart:io'; import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart'; import 'package:device_info_plus/device_info_plus.dart';
Future<String?> getDevUUID() async { Future<String?> getDevUUID() async {
var deviceInfo = DeviceInfoPlugin(); var deviceInfo = DeviceInfoPlugin();
if (Platform.isIOS) { if (Platform.isIOS) {
// import 'dart:io' // import 'dart:io'
var iosDeviceInfo = await deviceInfo.iosInfo; var iosDeviceInfo = await deviceInfo.iosInfo;
log('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
log('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
log('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
log('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
log('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
log('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
return iosDeviceInfo.identifierForVendor; // unique ID on iOS return iosDeviceInfo.identifierForVendor; // unique ID on iOS
} else if (Platform.isAndroid) { } else if (Platform.isAndroid) {
var androidDeviceInfo = await deviceInfo.androidInfo; var androidDeviceInfo = await deviceInfo.androidInfo;
// log('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
log('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
return androidDeviceInfo.id; // unique ID on Android return androidDeviceInfo.id; // unique ID on Android
} }
} }
@ -44,21 +27,9 @@ Future<String?> getSerialNumber() async {
if (Platform.isIOS) { if (Platform.isIOS) {
// import 'dart:io' // import 'dart:io'
var iosDeviceInfo = await deviceInfo.iosInfo; var iosDeviceInfo = await deviceInfo.iosInfo;
log('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
log('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
log('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
log('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
log('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
log('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
return iosDeviceInfo.identifierForVendor; // unique ID on iOS return iosDeviceInfo.identifierForVendor; // unique ID on iOS
} else if (Platform.isAndroid) { } else if (Platform.isAndroid) {
var androidDeviceInfo = await deviceInfo.androidInfo; var androidDeviceInfo = await deviceInfo.androidInfo;
// log('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
log('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
log('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
return androidDeviceInfo.serialNumber; // unique ID on Android return androidDeviceInfo.serialNumber; // unique ID on Android
} }
} }

View File

@ -60,7 +60,6 @@
// final path = _getStoragePath(_firebasePathPrefix(), // final path = _getStoragePath(_firebasePathPrefix(),
// widget.imageFile!.name!, false, 0); // widget.imageFile!.name!, false, 0);
// uploadData(path, image).then((value) { // uploadData(path, image).then((value) {
// log('image cropped');
// widget.callBackAction!.call(value!); // widget.callBackAction!.call(value!);
// loading = false; // loading = false;
// }); // });
@ -95,7 +94,6 @@
// setState(() { // setState(() {
// loading = true; // loading = true;
// }); // });
// log('Button pressed ...');
// _crop_controller.crop(); // _crop_controller.crop();
// //widget.loading = true; // //widget.loading = true;

View File

@ -5,6 +5,9 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:from_css_color/from_css_color.dart'; import 'package:from_css_color/from_css_color.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'dart:math' show pow, pi, sin; import 'dart:math' show pow, pi, sin;
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:json_path/json_path.dart'; import 'package:json_path/json_path.dart';
@ -505,7 +508,8 @@ void setDarkModeSetting(BuildContext context, ThemeMode themeMode) =>
void showSnackbar( void showSnackbar(
BuildContext context, BuildContext context,
String message, { String message,
bool error, {
bool loading = false, bool loading = false,
int duration = 4, int duration = 4,
}) { }) {
@ -515,24 +519,101 @@ void showSnackbar(
content: Row( content: Row(
children: [ children: [
if (loading) if (loading)
const Padding( Padding(
padding: EdgeInsetsDirectional.only(end: 10.0), padding: const EdgeInsetsDirectional.only(end: 10.0),
child: SizedBox( child: SizedBox(
height: 20, height: 20,
width: 20, width: 20,
child: CircularProgressIndicator( child: CircularProgressIndicator(
color: Colors.white, color: FlutterFlowTheme.of(context).info,
), ),
), ),
), ),
Text(message), Text(
message,
style: TextStyle(
color: FlutterFlowTheme.of(context).info,
),
),
], ],
), ),
duration: Duration(seconds: duration), duration: Duration(seconds: duration),
backgroundColor: error
? FlutterFlowTheme.of(context).error
: FlutterFlowTheme.of(context).success,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
), ),
); );
} }
void showAlertDialog(BuildContext context, String title, String content,
Future<void> Function() action) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
title: Text(title),
content: Text(content),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: [
FFButtonWidget(
onPressed: () => Navigator.pop(context),
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
elevation: 0,
),
text: FFLocalizations.of(context).getVariableText(
enText: 'No',
ptText: 'Não',
),
),
FFButtonWidget(
onPressed: () async {
action();
},
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
elevation: 0,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
text: FFLocalizations.of(context).getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
),
],
),
],
);
});
}
extension FFStringExt on String { extension FFStringExt on String {
String maybeHandleOverflow({int? maxChars, String replacement = ''}) => String maybeHandleOverflow({int? maxChars, String replacement = ''}) =>
maxChars != null && length > maxChars maxChars != null && length > maxChars

View File

@ -76,15 +76,14 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
FFRoute( FFRoute(
name: 'homePage', name: 'homePage',
path: '/homePage', path: '/homePage',
builder: (context, params) => params.isEmpty builder: (context, params) =>
? const HomePageWidget() params.isEmpty ? const HomePageWidget() : const HomePageWidget(),
: const HomePageWidget(),
),
FFRoute(
name: 'visitHistoryPage',
path: '/visitHistoryPage',
builder: (context, params) => const VisitHistoryPageWidget(),
), ),
// FFRoute(
// name: 'visitHistoryPage',
// path: '/visitHistoryPage',
// builder: (context, params) => const VisitHistoryPageWidget(),
// ),
FFRoute( FFRoute(
name: 'messageHistoryPage', name: 'messageHistoryPage',
path: '/messageHistoryPage', path: '/messageHistoryPage',
@ -98,38 +97,10 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
name: 'scheduleCompleteVisitPage', name: 'scheduleCompleteVisitPage',
path: '/scheduleCompleteVisitPage', path: '/scheduleCompleteVisitPage',
builder: (context, params) => ScheduleCompleteVisitPageWidget( builder: (context, params) => ScheduleCompleteVisitPageWidget(
// get current datatime picker dd/mm/aaaa hh:mm:ss
// visitStartDateStr: DateTime.now().toString(),
// post 1 day
// visitEndDateStr: DateTime.now().add(const Duration(days: 1)).toString(),
visitorStrList: params.getParam( visitorStrList: params.getParam(
'visitorStrList', 'visitorStrList',
ParamType.String, ParamType.String,
), ),
visitStartDateStr: params.getParam(
'visitStartDateStr',
ParamType.String,
),
visitEndDateStr: params.getParam(
'visitEndDateStr',
ParamType.String,
),
visitReasonStr: params.getParam(
'visitReasonStr',
ParamType.String,
),
visitLevelStr: params.getParam(
'visitLevelStr',
ParamType.String,
),
visitTempBol: params.getParam(
'visitTempBol',
ParamType.bool,
),
visitObsStr: params.getParam(
'visitObsStr',
ParamType.String,
),
visitorJsonList: params.getParam<dynamic>( visitorJsonList: params.getParam<dynamic>(
'visitorJsonList', 'visitorJsonList',
ParamType.JSON, ParamType.JSON,
@ -148,7 +119,10 @@ GoRouter createRouter(AppStateNotifier appStateNotifier) => GoRouter(
path: '/fastPassPage', path: '/fastPassPage',
builder: (context, params) => /*const*/ FastPassPageWidget(), builder: (context, params) => /*const*/ FastPassPageWidget(),
), ),
FFRoute(name: 'preferencesSettings', path: '/preferencesSettings', builder: (context, params) => const PreferencesPageWidget( FFRoute(
name: 'preferencesSettings',
path: '/preferencesSettings',
builder: (context, params) => const PreferencesPageWidget(
key: Key('preferencesSettings'), key: Key('preferencesSettings'),
)), )),
FFRoute( FFRoute(

View File

@ -10,7 +10,6 @@ import '../../flutter_flow/lat_lng.dart';
import '../../flutter_flow/place.dart'; import '../../flutter_flow/place.dart';
import '../../flutter_flow/uploaded_file.dart'; import '../../flutter_flow/uploaded_file.dart';
/// SERIALIZATION HELPERS /// SERIALIZATION HELPERS
String dateTimeRangeToString(DateTimeRange dateTimeRange) { String dateTimeRangeToString(DateTimeRange dateTimeRange) {
@ -85,7 +84,6 @@ String? serializeParam(
} }
return data; return data;
} catch (e) { } catch (e) {
log('Error serializing parameter: $e');
return null; return null;
} }
} }
@ -226,7 +224,6 @@ dynamic deserializeParam<T>(
return null; return null;
} }
} catch (e) { } catch (e) {
log('Error deserializing parameter: $e');
return null; return null;
} }
} }

View File

@ -11,7 +11,7 @@ import 'package:video_player/video_player.dart';
import 'flutter_flow_theme.dart'; import 'flutter_flow_theme.dart';
import 'flutter_flow_util.dart'; import 'flutter_flow_util.dart';
const allowedFormats = {'image/png', 'image/jpeg', 'video/mp4', 'image/gif'}; const allowedFormats = {'image/png', 'image/jpeg'};
class SelectedFile { class SelectedFile {
const SelectedFile({ const SelectedFile({

View File

@ -20,17 +20,16 @@ void main() async {
DeviceOrientation.portraitUp, DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown, DeviceOrientation.portraitDown,
]); ]);
await initializeApp(); await init();
runApp(ChangeNotifierProvider( runApp(ChangeNotifierProvider(
create: (context) => FFAppState(), create: (context) => FFAppState(),
child: const MyApp(), child: const MyApp(),
)); ));
} }
Future<void> initializeApp() async { Future<void> init() async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError; FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterError;
await FlutterFlowTheme.initialize(); await FlutterFlowTheme.initialize();
await FFLocalizations.initialize(); await FFLocalizations.initialize();
final appState = FFAppState(); final appState = FFAppState();

View File

@ -354,10 +354,8 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
Widget _accessHistoryCardMoleculeWidget( Widget _accessHistoryCardMoleculeWidget(
BuildContext context, dynamic accessHistoryItem) { BuildContext context, dynamic accessHistoryItem) {
return CardItemTemplateComponentWidget( return CardItemTemplateComponentWidget(
imageHashMap: Map<String, String>.from({ imagePath:
'key': accessHistoryItem['PES_ID'] ?? '', 'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${accessHistoryItem['PES_ID'] ?? ''}&tipo=${accessHistoryItem['PES_TIPO'] ?? ''}',
'value': accessHistoryItem['PES_TIPO'] ?? '',
}),
labelsHashMap: Map<String, String>.from({ labelsHashMap: Map<String, String>.from({
'Nome:': accessHistoryItem['PES_NOME'] ?? '', 'Nome:': accessHistoryItem['PES_NOME'] ?? '',
'Acesso:': accessHistoryItem['ACE_DATAHORA'] ?? '', 'Acesso:': accessHistoryItem['ACE_DATAHORA'] ?? '',

View File

@ -298,9 +298,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
color: FlutterFlowTheme.of(context).info, color: FlutterFlowTheme.of(context).info,
size: 24.0, size: 24.0,
), ),
onPressed: () { onPressed: () {},
log('IconButton pressed ...');
},
), ),
), ),
), ),
@ -545,7 +543,7 @@ class _HomePageWidgetState extends State<HomePageWidget> {
), ),
FFButtonWidget( FFButtonWidget(
onPressed: () async { onPressed: () async {
FFAppState().isLogged = false; FFAppState().deleteAll();
setState(() {}); setState(() {});
context.goNamed( context.goNamed(

View File

@ -12,6 +12,7 @@ import 'package:hub/flutter_flow/custom_functions.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/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:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
@ -21,7 +22,6 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:hub/pages/liberation_history/liberation_history_model.dart'; import 'package:hub/pages/liberation_history/liberation_history_model.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class LiberationHistoryWidget extends StatefulWidget { class LiberationHistoryWidget extends StatefulWidget {
const LiberationHistoryWidget({super.key}); const LiberationHistoryWidget({super.key});
@ -53,7 +53,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
void onUpdate(BuildContext context) { void onUpdate(BuildContext context) {
_model.clearGetLiberationsCache(); _model.clearGetLiberationsCache();
setState(() {}); safeSetState(() {});
} }
@override @override
@ -258,9 +258,7 @@ Widget liberationDynamicListView(
.where((item) => jsonToStr(getJsonField( .where((item) => jsonToStr(getJsonField(
item, item,
r'''$.VTE_NOME''', r'''$.VTE_NOME''',
)) )).toLowerCase().contains(
.toLowerCase()
.contains(
_model.textController.text.toLowerCase(), _model.textController.text.toLowerCase(),
)) ))
.toList() .toList()
@ -300,20 +298,19 @@ Widget liberationDynamicListView(
Widget liberationHistoryItemCard( Widget liberationHistoryItemCard(
BuildContext context, dynamic liberationHistoryItem) { BuildContext context, dynamic liberationHistoryItem) {
return CardItemTemplateComponentWidget( return CardItemTemplateComponentWidget(
imageHashMap: Map<String, String>.from({ imagePath:
'key': liberationHistoryItem['VTE_ID'], 'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
'value': 'E',
}),
labelsHashMap: Map<String, String>.from({ labelsHashMap: Map<String, String>.from({
'Nome:': liberationHistoryItem['VTE_NOME'], 'Nome:': liberationHistoryItem['VTE_NOME'],
'Data:': liberationHistoryItem['NOT_DTENVIO'], 'Data:': liberationHistoryItem['NOT_DTENVIO'],
'Motivo:': liberationHistoryItem['NOT_MOTIVO'], 'Motivo:': liberationHistoryItem['NOT_MOTIVO'],
}), }),
statusHashMap: [liberationHistoryItem['NOT_STATUS'] == 'L' statusHashMap: [
liberationHistoryItem['NOT_STATUS'] == 'L'
? Map<String, Color>.from({ ? Map<String, Color>.from({
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
ptText: 'Ativo', ptText: 'Finalizado',
enText: 'Active', enText: 'Finished',
): FlutterFlowTheme.of(context).success, ): FlutterFlowTheme.of(context).success,
}) })
: liberationHistoryItem['NOT_STATUS'] == 'B' : liberationHistoryItem['NOT_STATUS'] == 'B'
@ -325,35 +322,102 @@ Widget liberationHistoryItemCard(
}) })
: Map<String, Color>.from({ : Map<String, Color>.from({
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
ptText: 'Pendente', ptText: 'Ativo',
enText: 'Pending', enText: 'Active',
): FlutterFlowTheme.of(context).warning, ): FlutterFlowTheme.of(context).warning,
})], })
],
onTapCardItemAction: () async { onTapCardItemAction: () async {
showModalBottomSheet( showDialog(
isScrollControlled: true, // isScrollControlled: true,
isDismissible: true, // isDismissible: true,
backgroundColor: Colors.transparent, // backgroundColor: Colors.transparent,
useSafeArea: true, useSafeArea: true,
context: context, context: context,
builder: (context) { builder: (context) {
return DetailsComponentWidget( return Dialog(
vteName: liberationHistoryItem['VTE_NOME'], alignment: Alignment.center,
vteReason: liberationHistoryItem['NOT_MOTIVO'], child: DetailsComponentWidget(
vawDate: liberationHistoryItem['NOT_STATUS'] == 'S' // vteName: liberationHistoryItem['VTE_NOME'],
? liberationHistoryItem['NOT_DTENVIO'] // vteReason: liberationHistoryItem['NOT_MOTIVO'],
: liberationHistoryItem['NOT_DTRESPOSTA'], // vawDate: liberationHistoryItem['NOT_STATUS'] == 'S'
vawStatus: liberationHistoryItem['NOT_STATUS'], // ? liberationHistoryItem['NOT_DTENVIO']
vteMsg: liberationHistoryItem['NOT_MSGENVIO'], // : liberationHistoryItem['NOT_DTRESPOSTA'],
vteUUID: liberationHistoryItem['VTE_ID'], // vawStatus: liberationHistoryItem['NOT_STATUS'],
cliUUID: FFAppState().cliUUID, // vteMsg: liberationHistoryItem['NOT_MSGENVIO'],
msgUUID: liberationHistoryItem['NOT_ID'], // vteUUID: liberationHistoryItem['VTE_ID'],
vawDestino: liberationHistoryItem['NOT_DESTINO'], // cliUUID: FFAppState().cliUUID,
vawUUID: liberationHistoryItem['NOT_ID'], // msgUUID: liberationHistoryItem['NOT_ID'],
vawName: liberationHistoryItem['NOT_NOME'], // vawDestino: liberationHistoryItem['NOT_DESTINO'],
vawRef: liberationHistoryItem['NOT_ID'], // vawUUID: liberationHistoryItem['NOT_ID'],
changeStatusAction: changeStatusAction, // vawName: liberationHistoryItem['NOT_NOME'],
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'], // vawRef: liberationHistoryItem['NOT_ID'],
labelsHashMap: Map<String, String>.from({
'Nome:': liberationHistoryItem['VTE_NOME'],
'Data:': liberationHistoryItem['NOT_DTENVIO'],
'Motivo:': liberationHistoryItem['NOT_MOTIVO'],
'Mensagem:': liberationHistoryItem['NOT_MSGENVIO'],
// 'Resposta:': liberationHistoryItem['NOT_MSGRESPOSTA'],
}),
buttons: [
if (liberationHistoryItem['NOT_STATUS'] == 'S')
FlutterFlowIconButton(
icon: const Icon(Icons.done),
onPressed: () async {
Navigator.pop(context);
await answersRequest
.call(
context,
liberationHistoryItem['NOT_ID'].toString(),
'L',
'Mensagem',
liberationHistoryItem['VTE_ID'].toString(),
)
.then((value) {
if (value) {
return showSnackbar(
context,
FFLocalizations.of(context).getVariableText(
enText: 'Successfully resolved visit',
ptText: 'Visita resolvida com sucesso'),
false);
} else {
return showSnackbar(
context,
FFLocalizations.of(context).getVariableText(
enText: 'Error resolving visit',
ptText: 'Erro ao resolver visita'),
true);
}
});
},
),
],
statusHashMap: [
liberationHistoryItem['NOT_STATUS'] == 'L'
? Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Finalizado',
enText: 'Finished',
): FlutterFlowTheme.of(context).success,
})
: liberationHistoryItem['NOT_STATUS'] == 'B'
? Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Bloqueado',
enText: 'Blocked',
): FlutterFlowTheme.of(context).error,
})
: Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Ativo',
enText: 'Active',
): FlutterFlowTheme.of(context).warning,
})
],
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
),
); );
}, },
).then((_) { ).then((_) {
@ -362,9 +426,13 @@ Widget liberationHistoryItemCard(
_pushNotificationService.onMessageReceived.listen((received) { _pushNotificationService.onMessageReceived.listen((received) {
if (received.data['click_action'] == 'cancel_request') { if (received.data['click_action'] == 'cancel_request') {
log('Aprovado');
_pushNotificationService.dispose(); _pushNotificationService.dispose();
snackbar(context, opt: true); showSnackbar(
context,
FFLocalizations.of(context).getVariableText(
enText: 'Successfully resolved visit',
ptText: 'Visita resolvida com sucesso'),
false);
context.pushReplacementNamed( context.pushReplacementNamed(
'liberationHistory', 'liberationHistory',
extra: <String, dynamic>{ extra: <String, dynamic>{

View File

@ -1,10 +1,7 @@
// import 'dart:js_interop';
import 'dart:developer'; import 'dart:developer';
import 'package:hub/app_state.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/backend/api_requests/api_manager.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';
@ -15,6 +12,8 @@ import 'package:hub/pages/message_history_page/message_history_page_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/shared/utils/dialog_util.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class MessageHistoryPageWidget extends StatefulWidget { class MessageHistoryPageWidget extends StatefulWidget {
@ -31,16 +30,48 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
late ScrollController _scrollController;
int _pageNumber = 1;
final int _pageSize = 10;
bool _hasData = false;
bool _loading = false;
String _destinyType = "P";
late Future<void> _messageFuture;
List<dynamic> _messageWrap = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_model = createModel(context, () => MessageHistoryPageModel()); _model = createModel(context, () => MessageHistoryPageModel());
_model.tabBarController = TabController( _messageFuture = fetchMessage();
vsync: this,
length: 3, _scrollController = ScrollController()
initialIndex: 1, ..addListener(() {
)..addListener(() => setState(() {})); if (_scrollController.position.atEdge &&
_scrollController.position.pixels != 0) {
_loadMore();
}
});
_model.tabBarController =
TabController(vsync: this, length: 3, initialIndex: 0)
..addListener(() {
if (_model.tabBarController?.index == 0) {
_destinyType = "P";
} else if (_model.tabBarController?.index == 1) {
_destinyType = "A";
} else {
_destinyType = "T";
}
_pageNumber = 1;
_messageWrap = [];
_messageFuture = fetchMessage();
});
_model.textController ??= TextEditingController(); _model.textController ??= TextEditingController();
_model.textFieldFocusNode ??= FocusNode(); _model.textFieldFocusNode ??= FocusNode();
@ -49,13 +80,13 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
@override @override
void dispose() { void dispose() {
_model.dispose(); _model.dispose();
_scrollController.dispose();
super.dispose(); super.dispose();
} }
void onUpdate(BuildContext context) { void onUpdate(BuildContext context) {
_model.clearGetLiberationsCache(); _model.clearGetLiberationsCache();
setState(() {}); safeSetState(() {});
} }
@override @override
@ -64,13 +95,63 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
return Scaffold( return Scaffold(
key: scaffoldKey, key: scaffoldKey,
backgroundColor: FlutterFlowTheme.of(context).primaryBackground, backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
appBar: appBarMessage(context), appBar: _appBar(context),
body: bodyMessage(context, _model), body: _body(context),
); );
} }
Future<ApiCallResponse?> fetchMessage() async {
try {
setState(() => _loading = true);
var response = await PhpGroup.getMessagesCall.call(
devUUID: FFAppState().devUUID.toString(),
userUUID: FFAppState().userUUID.toString(),
cliID: FFAppState().cliUUID.toString(),
atividade: 'getMensagens',
pageSize: _pageSize.toString(),
pageNumber: _pageNumber.toString(),
tipoDestino: _destinyType,
);
final List<dynamic> messages = response.jsonBody['mensagens'] ?? [];
if (messages != null && messages.isNotEmpty) {
setState(() {
_messageWrap.addAll(messages);
_hasData = true;
_loading = false;
});
return response;
}
_showNoMoreDataSnackBar(context);
setState(() {
_hasData = false;
_loading = false;
});
return null;
} catch (e, s) {
DialogUtil.errorDefault(context);
LogUtil.requestAPIFailed(
"proccessRequest.php", "", "Consulta de Mensagems", e, s);
setState(() {
_hasData = false;
_loading = false;
});
}
} }
PreferredSizeWidget appBarMessage(BuildContext context) { void _loadMore() {
if (_hasData == true) {
_pageNumber++;
_messageFuture = fetchMessage();
}
}
PreferredSizeWidget _appBar(BuildContext context) {
return AppBar( return AppBar(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground, backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
@ -106,7 +187,7 @@ PreferredSizeWidget appBarMessage(BuildContext context) {
); );
} }
Widget bodyMessage(BuildContext context, MessageHistoryPageModel _model) { Widget _body(BuildContext context) {
return SafeArea( return SafeArea(
top: true, top: true,
child: Column( child: Column(
@ -149,160 +230,167 @@ Widget bodyMessage(BuildContext context, MessageHistoryPageModel _model) {
), ),
], ],
controller: _model.tabBarController, controller: _model.tabBarController,
onTap: (i) async { ),
[() async {}, () async {}][i](); ),
if (_hasData == false && _pageNumber <= 1 && _loading == false)
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Center(
child: Text(FFLocalizations.of(context).getVariableText(
ptText: "Nenhuma mensagem encontrada!",
enText: "No message found")),
)
],
),
)
else if (_hasData == true || _pageNumber >= 1)
Expanded(
child: FutureBuilder<void>(
future: _messageFuture,
builder: (context, snapshot) {
return ListView.builder(
shrinkWrap: true,
physics: const BouncingScrollPhysics(),
controller: _scrollController,
itemCount: _messageWrap.length,
itemBuilder: (context, index) {
final item = _messageWrap[index];
return _item(context, item);
});
}, },
), ),
), ),
Expanded( if (_hasData == true && _loading == true)
child: TabBarView(controller: _model.tabBarController, children: [ Container(
liberationDynamicListView(context, _model, 'P'), padding: const EdgeInsets.only(top: 15, bottom: 15),
liberationDynamicListView(context, _model, 'A'), child: Center(
liberationDynamicListView(context, _model, 'T'), child: CircularProgressIndicator(
])), valueColor: AlwaysStoppedAnimation<Color>(
FlutterFlowTheme.of(context).primary,
),
),
),
)
].addToStart(const SizedBox(height: 0)), ].addToStart(const SizedBox(height: 0)),
), ),
); );
} }
Widget liberationDynamicListView( void _showNoMoreDataSnackBar(BuildContext context) {
BuildContext context, MessageHistoryPageModel _model, String DestIndex) { ScaffoldMessenger.of(context).showSnackBar(
return Container( SnackBar(
width: double.infinity, content: Text(
height: double.infinity, FFLocalizations.of(context).getVariableText(
decoration: const BoxDecoration(), ptText: "Não há mais dados.", enText: "No more data."),
child: FutureBuilder<ApiCallResponse>(
future: PhpGroup.getMessagesCall
.call(
devUUID: FFAppState().devUUID.toString(),
userUUID: FFAppState().userUUID.toString(),
cliID: FFAppState().cliUUID.toString(),
atividade: 'getMensagens',
pageSize: '100',
pageNumber: '1',
tipoDestino: DestIndex,
)
.catchError((error) {
log('Error: ${error.toString()}');
return Future.delayed(Duration(seconds: 1), () {
return Center(
child: Text('Erro ao carregar mensagens'),
);
});
}),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: SizedBox(
width: 50.0,
height: 50.0,
child: SpinKitCircle(
color: FlutterFlowTheme.of(context).primary,
size: 50.0,
), ),
), duration: const Duration(seconds: 3),
); backgroundColor: FlutterFlowTheme.of(context).primary,
}
if (snapshot.hasError == true || snapshot.data == null) {
log('Error: ${snapshot.error.toString()}');
// log('Error: ${snapshot.data!.jsonBody['mensagens']}');
return const Center(
child: Text('Erro ao carregar mensagens'),
);
}
final mensagens = snapshot.data!.jsonBody['mensagens'];
final totalRows = snapshot.data!.jsonBody['total_rows'];
if (totalRows == 0 || mensagens == null || mensagens.isEmpty) {
return const Center(
child: Text('Nenhuma mensagem encontrada'),
);
}
return ListView.builder(
itemCount: totalRows,
addAutomaticKeepAlives: false,
addRepaintBoundaries: true,
cacheExtent: 1000.0,
itemBuilder: (BuildContext context, int index) {
return messageHistoryItem(
context,
snapshot.data!.jsonBody['mensagens'][index],
);
},
);
},
), ),
); );
} }
Widget messageHistoryItem(BuildContext context, dynamic jsonBody) { Widget _item(BuildContext context, dynamic jsonBody) {
log(jsonBody.toString());
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 15), padding: const EdgeInsets.symmetric(horizontal: 15),
child: Card( child: Card(
color: FlutterFlowTheme.of(context).primaryBackground,
child: Container( child: Container(
// height: 100, // height: 100,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Text(
jsonBody['MSG_DATE'].toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 10,
color: FlutterFlowTheme.of(context).customColor6,
overflow: TextOverflow.ellipsis,
),
),
),
],
),
Row(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0), padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Icon(
jsonBody['MSG_DESTINO_TP'] == 'T'
? Icons.language
: jsonBody['MSG_DESTINO_TP'] == 'P'
? Icons.person
: Icons.home,
color: FlutterFlowTheme.of(context).primary,
size: 25,
),
Expanded(
child: Text( child: Text(
jsonBody['MSG_ORIGEM_DESC'].toString(), jsonBody['MSG_ORIGEM_DESC'].toString(),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12, fontSize: 15,
color: FlutterFlowTheme.of(context).primary, color: FlutterFlowTheme.of(context).primary,
), ),
overflow: TextOverflow.fade, overflow: TextOverflow.fade,
), ),
), ),
Icon( ].divide(const SizedBox(width: 10)),
jsonBody['MSG_DESTINO_TP'] == 'T'
? Icons.group
: Icons.person,
color: FlutterFlowTheme.of(context).primary,
), ),
], Row(
), mainAxisAlignment: MainAxisAlignment.start,
], mainAxisSize: MainAxisSize.max,
), children: [
SizedBox(height: 8),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.only(left: 5),
child: Icon(
Icons.history,
color:
FlutterFlowTheme.of(context).customColor6,
size: 15,
),
),
Expanded(
child: Text(
jsonBody['MSG_DATE'].toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 10,
color:
FlutterFlowTheme.of(context).customColor6,
),
overflow: TextOverflow.ellipsis,
),
),
].divide(const SizedBox(width: 15)),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: const EdgeInsets.only(left: 5),
child: Icon(
Icons.message,
color:
FlutterFlowTheme.of(context).customColor6,
size: 15,
),
),
Expanded(
child: Text( child: Text(
jsonBody['MSG_TEXTO'].toString(), jsonBody['MSG_TEXTO'].toString(),
), ),
), ),
SizedBox(height: 8), ].divide(const SizedBox(width: 15)),
], ),
].divide(const SizedBox(height: 4)),
),
),
].divide(
const SizedBox(height: 8),
), ),
), ),
), ),
), ),
); ));
}
} }

View File

@ -8,6 +8,7 @@ import 'package:hub/components/templates_components/change_passs_qr_code_pass_ke
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/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:share_plus/share_plus.dart'; import 'package:share_plus/share_plus.dart';
@ -38,26 +39,115 @@ class PreferencesPageModel with ChangeNotifier {
padding: MediaQuery.viewInsetsOf(context), padding: MediaQuery.viewInsetsOf(context),
child: PassKeyTemplateWidget( child: PassKeyTemplateWidget(
toggleActionStatus: (key) async { toggleActionStatus: (key) async {
log(key);
FFAppState().fingerprintPass = key; FFAppState().fingerprintPass = key;
FFAppState().fingerprint = true; FFAppState().fingerprint = true;
}, },
), ),
); );
}, },
).whenComplete(() => notifyListeners()); ).then((value) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Fingerprint changed successfully',
ptText: 'Impressão digital alterada com sucesso',
),
style: TextStyle(color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).success,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}).catchError((err, stack) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar impressão digital',
enText: 'Error changing fingerprint',
),
style: TextStyle(color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}).whenComplete(() => notifyListeners());
} }
} }
void enablePerson(BuildContext context) { void enablePerson(BuildContext context) {
notifyListeners(); notifyListeners();
Share.share( Share.share(
FFAppState().userDevUUID, FFLocalizations.of(context).getVariableText(
ptText:
'Este é o meu identificador de acesso: ${FFAppState().userDevUUID}',
enText: 'This is my access identifier: ${FFAppState().userDevUUID}',
),
); );
} }
void toggleNotify(BuildContext context) { void toggleNotify(BuildContext context) {
FFAppState().notify = !FFAppState().notify; showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
title: Text(
FFLocalizations.of(context).getVariableText(
enText: FFAppState().notify
? 'Disable Access Notification'
: 'Access Notification',
ptText: FFAppState().notify
? 'Desativar notificação de acesso'
: 'Notificação de acesso'),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: FFAppState().notify
? 'Tem certeza que deseja desativar as suas notificações de acesso?'
: 'Tem certeza que deseja receber as suas notificações de acesso?',
enText: FFAppState().notify
? 'Are you sure you want to disable your access notifications?'
: 'Are you sure you want to receive your access notifications?'),
),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
elevation: 0,
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
onPressed: () async {
try {
PhpGroup.changeNotifica PhpGroup.changeNotifica
.call( .call(
userUUID: FFAppState().userUUID, userUUID: FFAppState().userUUID,
@ -66,8 +156,55 @@ class PreferencesPageModel with ChangeNotifier {
atividade: 'updVisitado', atividade: 'updVisitado',
notifica: FFAppState().notify ? 'S' : 'N', notifica: FFAppState().notify ? 'S' : 'N',
) )
.catchError((err) { .then((value) {
log(err.toString()); if (value.jsonBody['error'] == false) {
Navigator.pop(context);
FFAppState().notify = !FFAppState().notify;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Notificação alterada com sucesso',
enText:
'Notification changed successfully',
),
style: TextStyle(
color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).success,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar notificação',
enText: 'Error changing notification',
),
style: TextStyle(
color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}
}).catchError((err) {
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
@ -75,8 +212,150 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Error changing notification', enText: 'Error changing notification',
ptText: 'Erro ao alterar notificação', ptText: 'Erro ao alterar notificação',
), ),
style: TextStyle(color: FlutterFlowTheme.of(context).info)), style: TextStyle(
backgroundColor: FlutterFlowTheme.of(context).error, color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}).whenComplete(() => notifyListeners());
} on Exception catch (e) {
log(e.toString());
Navigator.pop(context);
}
},
text: FFLocalizations.of(context).getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
options: FFButtonOptions(
elevation: 0,
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
),
],
);
});
notifyListeners();
}
void localUnlink(BuildContext context) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
title: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Unlink device',
ptText: 'Desvincular dispositivo',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Are you sure you want to unlink this device?',
ptText: 'Tem certeza que deseja desvincular este dispositivo?',
),
),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Cancel',
ptText: 'Cancelar',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
onPressed: () async {
try {
await PhpGroup.resopndeVinculo
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
tarefa: 'I',
)
.then((value) {
if (value.jsonBody['error'] == false) {
FFAppState().deleteCliUUID();
FFAppState().deleteLocal();
FFAppState().deleteOwnerUUID();
Navigator.pop(context);
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Device unlinked successfully',
ptText:
'Dispositivo desvinculado com sucesso',
),
style: TextStyle(
color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).success,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}
})
// ignore: body_might_complete_normally_catch_error
.catchError((err, stack) {
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error unlinking device',
ptText: 'Erro ao desvincular dispositivo',
),
style: TextStyle(
color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3), duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -86,18 +365,8 @@ class PreferencesPageModel with ChangeNotifier {
); );
}); });
notifyListeners(); notifyListeners();
} } catch (err, stack) {
Navigator.pop(context);
void localUnlink(BuildContext context) {
PhpGroup.resopndeVinculo
.call(
userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID,
tarefa: 'I',
)
.catchError((err) {
log(err.toString());
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( SnackBar(
content: Text( content: Text(
@ -105,7 +374,8 @@ class PreferencesPageModel with ChangeNotifier {
enText: 'Error unlinking device', enText: 'Error unlinking device',
ptText: 'Erro ao desvincular dispositivo', ptText: 'Erro ao desvincular dispositivo',
), ),
style: TextStyle(color: FlutterFlowTheme.of(context).info)), style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error, backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3), duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
@ -114,18 +384,87 @@ class PreferencesPageModel with ChangeNotifier {
), ),
), ),
); );
}).then( }
(value) {
FFAppState().deleteCliUUID();
FFAppState().deleteLocal();
FFAppState().deleteOwnerUUID();
Navigator.pop(context);
}, },
text: FFLocalizations.of(context).getVariableText(
enText: 'Unlink',
ptText: 'Desvincular',
),
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
),
],
); );
});
notifyListeners(); notifyListeners();
} }
void deleteAccount(BuildContext context) { void deleteAccount(BuildContext context) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
title: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Delete account',
ptText: 'Deletar conta',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Are you sure you want to delete your account?',
ptText: 'Tem certeza que deseja deletar sua conta?',
),
),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: [
FFButtonWidget(
onPressed: () => Navigator.pop(context),
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
text: FFLocalizations.of(context).getVariableText(
enText: 'Cancel',
ptText: 'Cancelar',
),
),
FFButtonWidget(
onPressed: () async {
try {
await PhpGroup.deleteAccount
.call(
devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID,
)
.then((value) {
if (value.jsonBody['error'] == false) {
FFAppState().deleteAll(); FFAppState().deleteAll();
FFAppState().isLogged = false; FFAppState().isLogged = false;
context.goNamed( context.goNamed(
@ -139,14 +478,83 @@ class PreferencesPageModel with ChangeNotifier {
}, },
); );
} }
}).catchError((err) {
log(err.toString());
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error deleting account',
ptText: 'Erro ao deletar conta',
),
style: TextStyle(
color:
FlutterFlowTheme.of(context).info)),
backgroundColor:
FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
});
notifyListeners();
} catch (err, stack) {
Navigator.pop(context);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Error deleting account',
ptText: 'Erro ao deletar conta',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}
},
options: FFButtonOptions(
width: MediaQuery.of(context).size.width * 0.3,
height: MediaQuery.of(context).size.height * 0.05,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
text: FFLocalizations.of(context).getVariableText(
enText: 'Delete',
ptText: 'Deletar',
),
),
],
),
],
);
});
notifyListeners();
}
Future<void> togglePass(BuildContext context) async { Future<void> togglePass(BuildContext context) async {
debugPrint('pass: ${FFAppState().pass}'); // if (FFAppState().pass) {
if (FFAppState().pass) { // FFAppState().pass = false;
FFAppState().pass = false; // FFAppState().deleteAccessPass();
FFAppState().deleteAccessPass(); // notifyListeners();
notifyListeners(); // } else {
} else {
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@ -159,7 +567,6 @@ class PreferencesPageModel with ChangeNotifier {
toggleActionStatus: (key) async { toggleActionStatus: (key) async {
FFAppState().accessPass = key; FFAppState().accessPass = key;
notifyListeners(); notifyListeners();
debugPrint('key: $key');
await PhpGroup.changePass await PhpGroup.changePass
.call( .call(
userUUID: FFAppState().userUUID, userUUID: FFAppState().userUUID,
@ -169,33 +576,75 @@ class PreferencesPageModel with ChangeNotifier {
newSenha: FFAppState().accessPass, newSenha: FFAppState().accessPass,
) )
.then((value) { .then((value) {
FFAppState().pass = true;
// var error = jsonDecode(value.jsonBody['error'].toString()); // var error = jsonDecode(value.jsonBody['error'].toString());
// log('${jsonDecode(value.jsonBody['error'].toString())}');
if (jsonDecode(value.jsonBody['error'].toString()) == false) { if (jsonDecode(value.jsonBody['error'].toString()) == false) {
FFAppState().pass = true; FFAppState().pass = true;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Access password changed successfully',
ptText: 'Senha de acesso alterada com sucesso',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).success,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
} else { } else {
FFAppState().pass = false; ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de acesso',
enText: 'Error changing access password',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
// FFAppState().pass = false;
} }
}).onError((error, StackTrace) { }).catchError((error, StackTrace) {
FFAppState().pass = false; // FFAppState().pass = false;
log(error.toString()); ScaffoldMessenger.of(context).showSnackBar(
log(StackTrace.toString()); SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de acesso',
enText: 'Error changing access password',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}).whenComplete(() => notifyListeners()); }).whenComplete(() => notifyListeners());
}, },
), ),
); );
}, },
); );
} // }
} }
Future<void> togglePanic(BuildContext context) async { Future<void> togglePanic(BuildContext context) async {
if (FFAppState().panic) {
FFAppState().panic = false;
FFAppState().deletePanicPass();
notifyListeners();
} else {
await showModalBottomSheet( await showModalBottomSheet(
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@ -208,25 +657,75 @@ class PreferencesPageModel with ChangeNotifier {
toggleActionStatus: (key) async { toggleActionStatus: (key) async {
FFAppState().panicPass = key; FFAppState().panicPass = key;
notifyListeners(); notifyListeners();
await PhpGroup.changePass await PhpGroup.changePanic
.call( .call(
userUUID: FFAppState().userUUID, userUUID: FFAppState().userUUID,
devUUID: FFAppState().devUUID, devUUID: FFAppState().devUUID,
cliID: FFAppState().cliUUID, cliID: FFAppState().cliUUID,
atividade: 'updVisitado', atividade: 'updVisitado',
newSenha: FFAppState().panicPass, newSenhaPanico: FFAppState().panicPass,
) )
.then((value) { .then((value) {
FFAppState().panic = true; FFAppState().panic = true;
if (jsonDecode(value.jsonBody['error'].toString()) == false) { if (jsonDecode(value.jsonBody['error'].toString()) == false) {
FFAppState().panic = true; FFAppState().panic = true;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
enText: 'Panic password changed successfully',
ptText: 'Senha de pânico alterada com sucesso',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).success,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
} else { } else {
FFAppState().panic = false; ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de pânico',
enText: 'Error changing panic password',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
// FFAppState().panic = false;
} }
}).onError((e, s) { }).catchError((e, s) {
FFAppState().panic = false; // FFAppState().panic = false;
log(e.toString());
log(s.toString()); ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Erro ao alterar senha de pânico',
enText: 'Error changing panic password',
),
style: TextStyle(
color: FlutterFlowTheme.of(context).info)),
backgroundColor: FlutterFlowTheme.of(context).error,
duration: const Duration(seconds: 3),
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
);
}).whenComplete(() => notifyListeners()); }).whenComplete(() => notifyListeners());
}, },
), ),
@ -234,7 +733,6 @@ class PreferencesPageModel with ChangeNotifier {
}, },
); );
} }
}
@override @override
void dispose() { void dispose() {

View File

@ -16,7 +16,6 @@ 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:percent_indicator/circular_percent_indicator.dart'; import 'package:percent_indicator/circular_percent_indicator.dart';
import 'dart:async'; import 'dart:async';
// import 'package:barcode_widget/barcode_widget.dart'; // import 'package:barcode_widget/barcode_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -27,24 +26,17 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
class QrCodePageWidget extends StatefulWidget { class QrCodePageWidget extends StatefulWidget {
const QrCodePageWidget({super.key}); const QrCodePageWidget({super.key});
@override @override
State<QrCodePageWidget> createState() => _QrCodePageWidgetState(); State<QrCodePageWidget> createState() => _QrCodePageWidgetState();
} }
class _QrCodePageWidgetState extends State<QrCodePageWidget> class _QrCodePageWidgetState extends State<QrCodePageWidget>
with TickerProviderStateMixin { with TickerProviderStateMixin {
late QrCodePageModel _model; late QrCodePageModel _model;
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
final animationsMap = <String, AnimationInfo>{}; final animationsMap = <String, AnimationInfo>{};
@ -97,7 +89,9 @@ void initState() {
void dispose() { void dispose() {
// Removendo o ouvinte antes de chamar super.dispose para evitar vazamentos de memória // Removendo o ouvinte antes de chamar super.dispose para evitar vazamentos de memória
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
animationsMap['barcodeOnActionTriggerAnimation']!.controller.removeStatusListener((status) {}); animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.removeStatusListener((status) {});
} }
super.dispose(); super.dispose();
@ -116,7 +110,8 @@ void dispose() {
Widget buildBody(BuildContext context) { Widget buildBody(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width; double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height; double screenHeight = MediaQuery.of(context).size.height;
double smallerDimension = screenWidth < screenHeight ? screenWidth : screenHeight; double smallerDimension =
screenWidth < screenHeight ? screenWidth : screenHeight;
double dimension = smallerDimension * 0.75; double dimension = smallerDimension * 0.75;
double totalTimeInSeconds = 100.0; double totalTimeInSeconds = 100.0;
return SafeArea( return SafeArea(
@ -132,8 +127,7 @@ void dispose() {
enText: 'Use this QR Code for access', enText: 'Use this QR Code for access',
), ),
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
FlutterFlowTheme.of(context).bodyMediumFamily,
fontSize: 20.0, fontSize: 20.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -147,13 +141,13 @@ void dispose() {
Align( Align(
alignment: const AlignmentDirectional(0.0, 0.0), alignment: const AlignmentDirectional(0.0, 0.0),
child: InkWell( child: InkWell(
onTap: () { onTap: () async {
safeSetState(() async { safeSetState(() async {
_resetAnimationAndToggleAccess(); _resetAnimationAndToggleAccess();
FFAppState().fingerprint ? await _showBiometricsAuth(context) : await _showQrCodeBottomSheet(context);
}); });
FFAppState().fingerprint
? await _showBiometricsAuth(context)
: await _showQrCodeBottomSheet(context);
}, },
child: buildQrCode( child: buildQrCode(
dimension: dimension, dimension: dimension,
@ -206,7 +200,9 @@ void dispose() {
alignment: const AlignmentDirectional(0.0, 0.0), alignment: const AlignmentDirectional(0.0, 0.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: () async { onPressed: () async {
FFAppState().fingerprint ? await _showBiometricsAuth(context) : await _showQrCodeBottomSheet(context); FFAppState().fingerprint
? await _showBiometricsAuth(context)
: await _showQrCodeBottomSheet(context);
}, },
text: FFLocalizations.of(context).getVariableText( text: FFLocalizations.of(context).getVariableText(
ptText: 'Gerar QR Code', ptText: 'Gerar QR Code',
@ -227,8 +223,7 @@ void dispose() {
color: Colors.white, color: Colors.white,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap()
.containsKey( .containsKey(FlutterFlowTheme.of(context)
FlutterFlowTheme.of(context)
.titleSmallFamily), .titleSmallFamily),
), ),
elevation: 3.0, elevation: 3.0,
@ -253,7 +248,8 @@ void dispose() {
visible: _model.isAccess == true, visible: _model.isAccess == true,
child: Text( child: Text(
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
ptText: 'Certifique-se de que o QRCode está visivel para o leitor', ptText:
'Certifique-se de que o QRCode está visivel para o leitor',
enText: 'Make sure the QRCode is visible to the reader', enText: 'Make sure the QRCode is visible to the reader',
// '6z6kvmhl' /* Certifique-se de que o QRCode ... */, // '6z6kvmhl' /* Certifique-se de que o QRCode ... */,
), ),
@ -291,15 +287,13 @@ void dispose() {
// 'wkjkxd2e' /* Trocando QR code em */, // 'wkjkxd2e' /* Trocando QR code em */,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context).bodyMedium.override(
.bodyMedium fontFamily:
.override( FlutterFlowTheme.of(context).bodyMediumFamily,
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap().containsKey(
.containsKey(FlutterFlowTheme.of(context) FlutterFlowTheme.of(context)
.bodyMediumFamily), .bodyMediumFamily),
), ),
), ),
@ -313,7 +307,8 @@ void dispose() {
child: StreamBuilder<double>( child: StreamBuilder<double>(
stream: getProgressValue(), stream: getProgressValue(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState ==
ConnectionState.waiting) {
return CircularProgressIndicator(); return CircularProgressIndicator();
} else if (snapshot.hasError) { } else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}');
@ -332,16 +327,23 @@ void dispose() {
onAnimationEnd: () { onAnimationEnd: () {
_resetAnimationAndToggleAccess(); _resetAnimationAndToggleAccess();
}, },
progressColor: FlutterFlowTheme.of(context).primary, progressColor:
backgroundColor: FlutterFlowTheme.of(context).primaryText, FlutterFlowTheme.of(context).primary,
backgroundColor:
FlutterFlowTheme.of(context).primaryText,
center: Text( center: Text(
'${(progress * totalTimeInSeconds / 5).toStringAsFixed(1)}s', '${(progress * totalTimeInSeconds / 5).toStringAsFixed(1)}s',
style: FlutterFlowTheme.of(context).headlineSmall.override( style: FlutterFlowTheme.of(context)
fontFamily: FlutterFlowTheme.of(context).headlineSmallFamily, .headlineSmall
.override(
fontFamily: FlutterFlowTheme.of(context)
.headlineSmallFamily,
fontSize: 14.0, fontSize: 14.0,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap()
FlutterFlowTheme.of(context).headlineSmallFamily), .containsKey(
FlutterFlowTheme.of(context)
.headlineSmallFamily),
), ),
), ),
startAngle: 20.0, startAngle: 20.0,
@ -359,16 +361,18 @@ void dispose() {
); );
} }
Future<void> _showBiometricsAuth(BuildContext context) async { Future<void> _showBiometricsAuth(BuildContext context) async {
FFAppState().checkBiometrics() FFAppState()
.then((value) => FFAppState().authenticateBiometric() .checkBiometrics()
.then( (value) { .then((value) => FFAppState().authenticateBiometric().then((value) {
safeSetState(() { safeSetState(() {
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); animationsMap['barcodeOnActionTriggerAnimation']!
animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); .controller
.stop();
animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.reverse();
} }
_model.isAccess = !_model.isAccess; _model.isAccess = !_model.isAccess;
_model.key = FFAppState().fingerprintPass; _model.key = FFAppState().fingerprintPass;
@ -377,7 +381,6 @@ void dispose() {
.onError((error, StackTrace) { .onError((error, StackTrace) {
_showQrCodeBottomSheet(context); _showQrCodeBottomSheet(context);
}); });
} }
Future<void> _showQrCodeBottomSheet(BuildContext context) async { Future<void> _showQrCodeBottomSheet(BuildContext context) async {
@ -388,22 +391,22 @@ void dispose() {
context: context, context: context,
builder: (context) { builder: (context) {
return GestureDetector( return GestureDetector(
onTap: () => _model onTap: () => _model.unfocusNode.canRequestFocus
.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode)
? FocusScope.of(context)
.requestFocus(_model.unfocusNode)
: FocusScope.of(context).unfocus(), : FocusScope.of(context).unfocus(),
child: Padding( child: Padding(
padding: padding: MediaQuery.viewInsetsOf(context),
MediaQuery.viewInsetsOf(context), child: QrCodePassKeyTemplateComponentWidget(
child:
QrCodePassKeyTemplateComponentWidget(
toggleActionStatus: (key) async { toggleActionStatus: (key) async {
log('Key: $key');
safeSetState(() { safeSetState(() {
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { if (animationsMap['barcodeOnActionTriggerAnimation'] !=
animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); null) {
animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.stop();
animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.reverse();
} }
_model.isAccess = !_model.isAccess; _model.isAccess = !_model.isAccess;
_model.key = key; _model.key = key;
@ -413,10 +416,7 @@ void dispose() {
), ),
); );
}, },
) ).catchError((error) => safeSetState(() {
.catchError((error) => safeSetState((){
log('Error: $error');
_resetAnimationAndToggleAccess(); _resetAnimationAndToggleAccess();
})); }));
unawaited( unawaited(

View File

@ -2,6 +2,7 @@ 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/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/flutter_flow_util.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/internationalization.dart';
import 'package:hub/flutter_flow/request_manager.dart'; import 'package:hub/flutter_flow/request_manager.dart';
@ -29,6 +30,31 @@ class ScheduleCompleteVisitPageModel
/// Local state fields for this page. /// Local state fields for this page.
String convertDateFormat(String dateStr) {
try {
// Formato original
DateFormat originalFormat = DateFormat('d/M/y H:mm:ss');
// Novo formato
DateFormat newFormat = DateFormat('y-M-d H:mm:ss');
// Validate the input string format
if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$')
.hasMatch(dateStr)) {
return 'Invalid date format';
}
// Converte a string para DateTime
DateTime dateTime = originalFormat.parse(dateStr);
// Converte DateTime para a nova string formatada
String formattedDate = newFormat.format(dateTime);
return formattedDate;
} catch (e) {
// Handle the exception by returning an error message or a default value
return 'Invalid date format';
}
}
List<dynamic> visitorJsonList = []; List<dynamic> visitorJsonList = [];
void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item); void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item);
void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item); void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item);
@ -164,11 +190,21 @@ class ScheduleCompleteVisitPageModel
); );
textFieldFocusNode1 = FocusNode(); textFieldFocusNode1 = FocusNode();
textController1 = TextEditingController(); textController1 = TextEditingController(
text: dateTimeFormat(
'd/M/y H:mm:ss',
DateTime.now().add(const Duration(minutes: 10)),
// locale: FFLocalizations.of(context).languageCode,
));
textController1Validator = _textController1Validator; textController1Validator = _textController1Validator;
textFieldFocusNode2 = FocusNode(); textFieldFocusNode2 = FocusNode();
textController2 = TextEditingController(); textController2 = TextEditingController(
text: dateTimeFormat(
'd/M/y H:mm:ss',
DateTime.now().add(const Duration(days: 1)),
// locale: FFLocalizations.of(context).languageCode,
));
textController2Validator = _textController2Validator; textController2Validator = _textController2Validator;
textFieldFocusNode3 = FocusNode(); textFieldFocusNode3 = FocusNode();

View File

@ -53,7 +53,6 @@
// imageHashMap: imageKeyValue, // imageHashMap: imageKeyValue,
// onTapCardItemAction: () async { // onTapCardItemAction: () async {
// // Ação ao tocar no card // // Ação ao tocar no card
// log('Card tapped');
// }, // },
// ); // );
// }), // }),

View File

@ -1,108 +1 @@
import 'package:flutter/material.dart';
import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart';
import 'package:hub/flutter_flow/form_field_controller.dart';
import 'package:hub/flutter_flow/request_manager.dart';
import 'package:hub/pages/visit_history_page/visit_history_page_widget.dart';
class VisitHistoryPageModel extends FlutterFlowModel<VisitHistoryPageWidget> {
final _visitHistoryManager = FutureRequestManager<ApiCallResponse>();
Future<ApiCallResponse> visitHistory({
String? uniqueQueryKey,
bool? overrideCache,
required Future<ApiCallResponse> Function() requestFn,
}) =>
_visitHistoryManager.performRequest(
uniqueQueryKey: uniqueQueryKey,
overrideCache: overrideCache,
requestFn: requestFn,
);
void clearVisitHistoryCache() => _visitHistoryManager.clear();
void clearVisitHistoryCacheKey(String? uniqueKey) =>
_visitHistoryManager.clearRequest(uniqueKey);
/// Local state fields for this page.
List<dynamic> visitorJsonList = [];
void addToVisitorJsonList(dynamic item) => visitorJsonList.add(item);
void removeFromVisitorJsonList(dynamic item) => visitorJsonList.remove(item);
void removeAtIndexFromVisitorJsonList(int index) =>
visitorJsonList.removeAt(index);
void insertAtIndexInVisitorJsonList(int index, dynamic item) =>
visitorJsonList.insert(index, item);
void updateVisitorJsonListAtIndex(int index, Function(dynamic) updateFn) =>
visitorJsonList[index] = updateFn(visitorJsonList[index]);
String visitorStrList = '0';
/// State fields for stateful widgets in this page.
final unfocusNode = FocusNode();
// State field(s) for TabBar widget.
TabController? tabBarController;
int get tabBarCurrentIndex =>
tabBarController != null ? tabBarController!.index : 0;
// State field(s) for TextField widget.
FocusNode? textFieldFocusNode1;
TextEditingController? textController1;
String? Function(BuildContext, String?)? textController1Validator;
DateTime? datePicked1;
// State field(s) for TextField widget.
FocusNode? textFieldFocusNode2;
TextEditingController? textController2;
String? Function(BuildContext, String?)? textController2Validator;
DateTime? datePicked2;
// State field(s) for DropDown widget.
String? dropDownValue1;
FormFieldController<String>? dropDownValueController1;
// State field(s) for DropDown widget.
String? dropDownValue2;
FormFieldController<String>? dropDownValueController2;
// State field(s) for Switch widget.
bool? switchValue;
// State field(s) for TextField widget.
FocusNode? textFieldFocusNode3;
TextEditingController? textController3;
String? Function(BuildContext, String?)? textController3Validator;
@override
void initState(BuildContext context) {}
@override
void dispose() {
unfocusNode.dispose();
tabBarController?.dispose();
textFieldFocusNode1?.dispose();
textController1?.dispose();
textFieldFocusNode2?.dispose();
textController2?.dispose();
textFieldFocusNode3?.dispose();
textController3?.dispose();
clearVisitHistoryCache();
}
/// Action blocks.
Future getVisitorsActionPage(
BuildContext context, {
List<dynamic>? visitorsJsonList,
}) async {
visitorJsonList = visitorsJsonList!.toList().cast<dynamic>();
}
Future<bool> toggleCurrentSelectionHeader(
BuildContext context, {
required bool? toggleIndexValue,
}) async {
if (toggleIndexValue == true) {
return true;
}
return false;
}
}

View File

@ -1,757 +1,199 @@
import 'dart:developer'; import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:hub/actions/actions.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:hub/app_state.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/backend/api_requests/api_manager.dart';
import 'package:hub/components/templates_components/visit_details_modal_template_component/visit_details_modal_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/custom_functions.dart'; import 'package:hub/components/templates_components/details_component/details_component_action.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/flutter_flow/nav/nav.dart'; import 'package:hub/flutter_flow/internationalization.dart';
import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart';
import 'package:hub/pages/visit_history_page/visit_history_page_model.dart'; class VisitHistoryWidget extends StatefulWidget {
import 'package:provider/provider.dart'; VisitHistoryWidget({
Key? key,
}) : super(key: key);
class VisitHistoryPageWidget extends StatefulWidget {
const VisitHistoryPageWidget({
super.key,
this.visitorStrList,
this.visitStartDateStr,
this.visitEndDateStr,
this.visitReasonStr,
this.visitLevelStr,
this.visitTempBol,
this.visitObsStr,
this.visitorJsonList,
});
final String? visitorStrList;
final String? visitStartDateStr;
final String? visitEndDateStr;
final String? visitReasonStr;
final String? visitLevelStr;
final bool? visitTempBol;
final String? visitObsStr;
final List<dynamic>? visitorJsonList;
@override @override
State<VisitHistoryPageWidget> createState() => _VisitHistoryPageWidgetState(); _VisitHistoryWidgetState createState() => _VisitHistoryWidgetState();
} }
class _VisitHistoryPageWidgetState extends State<VisitHistoryPageWidget> class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
with TickerProviderStateMixin { List<dynamic> visitaWrap = [];
late VisitHistoryPageModel _model; var pageNumber = 1;
int _visitHistoryLoadingIdx = 0; late Future<void> visitFuture;
final int _visitHistoryLoadingCount = 10;
List<dynamic> _visitHistoryList = [];
ScrollController _visitHistoryController = ScrollController();
final scaffoldKey = GlobalKey<ScaffoldState>();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_model = createModel(context, () => VisitHistoryPageModel()); visitFuture = _fetchVisits();
// On page load action.
SchedulerBinding.instance.addPostFrameCallback((_) async {
if ((widget.visitorStrList != null && widget.visitorStrList != '') &&
((widget.visitorJsonList != null &&
(widget.visitorJsonList)!.isNotEmpty) !=
null)) {
_model.visitorJsonList = widget.visitorJsonList!
.where((e) =>
widget.visitorStrList ==
getJsonField(
e,
r'''$.VTE_DOCUMENTO''',
).toString().toString())
.toList()
.toList()
.cast<dynamic>();
_model.visitorStrList = widget.visitorStrList!;
setState(() {});
} else {
return;
}
});
_model.tabBarController = TabController(
vsync: this,
length: 2,
initialIndex: 0,
)..addListener(() => setState(() {}));
_model.textController1 ??= TextEditingController();
_model.textFieldFocusNode1 ??= FocusNode();
_model.textController2 ??= TextEditingController();
_model.textFieldFocusNode2 ??= FocusNode();
_model.switchValue = true;
_model.textController3 ??= TextEditingController();
_model.textFieldFocusNode3 ??= FocusNode();
} }
void _loadMoreVisitHistory() async { Future<ApiCallResponse?> _fetchVisits() async {
// Simulate fetching data from an API or database try {
Future<List<String>> fetchVisitHistory(int start, int limit) async { var response = await ScheduleCompleteVisitPageModel().visitHistory(
// Simulate network delay
await Future.delayed(Duration(seconds: 1));
// Generate a list of visit history items
return List.generate(limit, (index) => "Item ${start + index}");
}
// Calculate the start index for the next batch of items to load
final int start = _visitHistoryLoadingIdx * _visitHistoryLoadingCount;
// Fetch the next batch of items
final List<String> newItems =
await fetchVisitHistory(start, _visitHistoryLoadingCount);
// If new items were fetched, add them to the list and update the index
if (newItems.isNotEmpty) {
_visitHistoryList.addAll(newItems);
_visitHistoryLoadingIdx++;
setState(() {});
}
}
void_scrollListener() {
if (_visitHistoryController.position.pixels ==
_visitHistoryController.position.maxScrollExtent) {
_loadMoreVisitHistory();
}
}
@override
void dispose() {
_model.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode)
: FocusScope.of(context).unfocus(),
child: Scaffold(
key: scaffoldKey,
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
appBar: appBarScheduleCompleteVisit(context),
body:
bodyScheduleCompleteVisit(context, _model, setState, safeSetState),
),
);
}
}
PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
return AppBar(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
automaticallyImplyLeading: false,
leading: FlutterFlowIconButton(
borderColor: Colors.transparent,
borderRadius: 30.0,
borderWidth: 1.0,
buttonSize: 60.0,
icon: Icon(
Icons.keyboard_arrow_left,
color: FlutterFlowTheme.of(context).primaryText,
size: 30.0,
),
onPressed: () async {
context.pop();
},
),
title: Text(
FFLocalizations.of(context).getText(
'61lcxdgm' /* Agendar Visita */,
),
style: FlutterFlowTheme.of(context).headlineMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 15.0,
letterSpacing: 0.0,
fontWeight: FontWeight.bold,
useGoogleFonts: GoogleFonts.asMap().containsKey('Nunito'),
),
),
actions: const [],
centerTitle: true,
);
}
Widget bodyScheduleCompleteVisit(BuildContext context,
VisitHistoryPageModel _model, Function setState, Function safeSetState) {
return SafeArea(
top: true,
child: visitHistory(context, _model, safeSetState),
);
}
Widget visitHistory(
BuildContext context,
VisitHistoryPageModel _model,
Function safeSetState,
) {
return Container(
width: double.infinity,
height: 900.0,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
FlutterFlowIconButton(
borderColor: Colors.transparent,
borderRadius: 20.0,
borderWidth: 1.0,
buttonSize: 40.0,
icon: Icon(
Icons.settings_sharp,
color: FlutterFlowTheme.of(context).primary,
size: 24.0,
),
onPressed: () {
log('IconButton pressed ...');
},
),
],
),
FutureBuilder<ApiCallResponse>(
future: _model.visitHistory(
requestFn: () => PhpGroup.getVisitsCall.call( requestFn: () => PhpGroup.getVisitsCall.call(
devUUID: FFAppState().devUUID, devUUID: FFAppState().devUUID,
userUUID: FFAppState().userUUID, userUUID: FFAppState().userUUID,
cliID: FFAppState().cliUUID, cliID: FFAppState().cliUUID,
atividade: 'getVisitas', atividade: 'getVisitas',
pageSize: 10,
pageNumber: pageNumber,
), ),
), );
var newVisits = response.jsonBody['visitas']
as List<dynamic>?; // Ajuste conforme a estrutura da resposta
if (newVisits != null && newVisits.isNotEmpty) {
safeSetState(() {
visitaWrap.addAll(newVisits);
});
return response;
} else {
log('No new visits found');
return null;
}
} catch (err) {
log('Erro ao carregar mais visitas: $err');
}
}
void _loadMoreVisits() {
pageNumber++;
visitFuture = _fetchVisits();
}
@override
Widget build(BuildContext context) {
return FutureBuilder<void>(
future: visitFuture,
builder: (context, snapshot) { builder: (context, snapshot) {
// Customize what your widget looks like when it's loading. if (snapshot.connectionState == ConnectionState.waiting &&
if (!snapshot.hasData) { visitaWrap.isEmpty) {
return Center( return Center(
child: SizedBox( child: CircularProgressIndicator(
width: 50.0, valueColor: AlwaysStoppedAnimation<Color>(
height: 50.0, FlutterFlowTheme.of(context).primary,
child: SpinKitCircle( ),
color: FlutterFlowTheme.of(context).primary, ),
size: 50.0, );
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else if (visitaWrap.isEmpty) {
return Center(
child: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Nenhum visitante foi encontrado',
enText: 'No visitors found',
), ),
), ),
); );
} }
final wrapGetVisitsResponse = snapshot.data!;
return Builder(
builder: (context) {
final visitaWrap = PhpGroup.getVisitsCall
.visitasList(
wrapGetVisitsResponse.jsonBody,
)
?.toList() ??
[];
return ListView.builder(
itemCount: visitaWrap.length,
shrinkWrap: true,
scrollDirection: Axis.vertical,
physics: const BouncingScrollPhysics(),
addAutomaticKeepAlives: true,
cacheExtent: 1000.0,
addRepaintBoundaries: true,
addSemanticIndexes: true,
itemBuilder: (context, index) {
final visitaWrapItem = visitaWrap[index];
// visitaWrap.length, (visitaWrapIndex) {
return InkWell( return ListView.builder(
splashColor: Colors.transparent, itemCount: visitaWrap.length + 1,
focusColor: Colors.transparent, shrinkWrap: true,
hoverColor: Colors.transparent, physics: const BouncingScrollPhysics(),
highlightColor: Colors.transparent, itemBuilder: (context, index) {
onTap: () async { if (index == visitaWrap.length) {
await showModalBottomSheet( _loadMoreVisits();
isScrollControlled: true, return Center(
backgroundColor: Colors.transparent, child: CircularProgressIndicator(
enableDrag: false, valueColor: AlwaysStoppedAnimation<Color>(
FlutterFlowTheme.of(context).primary,
),
),
);
}
final visitaWrapItem = visitaWrap[index];
return CardItemTemplateComponentWidget(
imagePath:
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${visitaWrapItem['VTE_DOCUMENTO'] ?? ''}&tipo=E',
labelsHashMap: {
'Nome:': visitaWrapItem['VTE_NOME'] ?? '',
'Inicio:': visitaWrapItem['VAW_DTINICIO'] ?? '',
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
},
statusHashMap: [
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.active)
{
FFLocalizations.of(context).getVariableText(
ptText: 'Ativo',
enText: 'Active',
): FlutterFlowTheme.of(context).warning,
},
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.finished)
{
FFLocalizations.of(context).getVariableText(
ptText: 'Finalizado',
enText: 'Finished',
): FlutterFlowTheme.of(context).success,
},
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.unknown)
{
FFLocalizations.of(context).getVariableText(
ptText: 'Desconhecido',
enText: 'Unknown',
): FlutterFlowTheme.of(context).alternate,
},
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.canceled)
{
FFLocalizations.of(context).getVariableText(
ptText: 'Cancelado',
enText: 'Canceled',
): FlutterFlowTheme.of(context).error,
},
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.blocked)
{
FFLocalizations.of(context).getVariableText(
ptText: 'Bloqueado',
enText: 'Blocked',
): FlutterFlowTheme.of(context).error,
},
if (getStatus(visitaWrapItem['VAW_STATUS']) == status.inactive)
{
FFLocalizations.of(context).getVariableText(
ptText: 'Inativo',
enText: 'Inactive',
): FlutterFlowTheme.of(context).error,
},
],
onTapCardItemAction: () async {
await showDialog(
useSafeArea: true, useSafeArea: true,
context: context, context: context,
builder: (context) { builder: (context) {
return GestureDetector( return Dialog(
onTap: () => alignment: Alignment.center,
_model.unfocusNode.canRequestFocus child: buildDetails(
? FocusScope.of(context)
.requestFocus(_model.unfocusNode)
: FocusScope.of(context).unfocus(),
child: Padding(
padding: MediaQuery.viewInsetsOf(context),
child:
VisitDetailsModalTemplateComponentWidget(
visitStatusStr: getJsonField(
visitaWrapItem, visitaWrapItem,
r'''$.VAW_STATUS''', context,
).toString(), changeStatusAction,
visitStartDateStr: getJsonField(
visitaWrapItem,
r'''$.VAW_DTINICIO''',
).toString(),
visitEndDateStr: getJsonField(
visitaWrapItem,
r'''$.VAW_DTFIM''',
).toString(),
visitReasonStr: getJsonField(
visitaWrapItem,
r'''$.MOT_DESCRICAO''',
).toString(),
visitLevelStr: getJsonField(
visitaWrapItem,
r'''$.NAC_DESCRICAO''',
).toString(),
visitTempStr: getJsonField(
visitaWrapItem,
r'''$.VTE_UNICA''',
).toString(),
visitObsStr: getJsonField(
visitaWrapItem,
r'''$.VAW_OBS''',
).toString(),
visitorImgPath: valueOrDefault<String>(
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
visitaWrapItem,
r'''$.VTE_DOCUMENTO''',
).toString()}&tipo=E",
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
visitorStrList: getJsonField(
visitaWrapItem,
r'''$.VTE_DOCUMENTO''',
).toString(),
visitIdStr: getJsonField(
visitaWrapItem,
r'''$.VAW_ID''',
).toString(),
visitStatusColor: getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
).toString() ==
'A'
? FlutterFlowTheme.of(context).success
: FlutterFlowTheme.of(context).error,
visitorJsonList:
PhpGroup.getVisitsCall.visitasList(
wrapGetVisitsResponse.jsonBody,
),
updateToggleIdx: () async {},
repeatVisitSchedule: () async {},
),
), ),
); );
}, },
).then((value) => safeSetState(() {})); ).whenComplete(() {
}, // updateVisitFuture();
child: Card( _fetchVisits().then((response) {
clipBehavior: Clip.antiAliasWithSaveLayer, safeSetState(() {
color: FlutterFlowTheme.of(context) visitaWrap = PhpGroup.getVisitsCall
.secondaryBackground, .visitasList(response!.jsonBody)
elevation: 5.0, ?.toList() ??
shape: RoundedRectangleBorder( [];
borderRadius: BorderRadius.circular(8.0), visitFuture = Future.value(response);
),
child: Container(
width: 350.0,
height: 115.0,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Container(
width: 100.0,
height: 100.0,
decoration: const BoxDecoration(),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Text(
FFLocalizations.of(context)
.getText(
'i46frqyi' /* Visitante: */,
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight:
FontWeight.bold,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
Align(
alignment:
const AlignmentDirectional(
-1.0, -1.0),
child: Text(
getJsonField(
visitaWrapItem,
r'''$.VTE_NOME''',
).toString(),
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
),
].addToStart(
const SizedBox(width: 10.0)),
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
FFLocalizations.of(context)
.getText(
'73b1kj59' /* Início em: */,
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight:
FontWeight.bold,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
Text(
getJsonField(
visitaWrapItem,
r'''$.VAW_DTINICIO''',
).toString(),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
].addToStart(
const SizedBox(width: 10.0)),
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
FFLocalizations.of(context)
.getText(
'klzzrfbn' /* Fim em: */,
),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
fontWeight:
FontWeight.bold,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
Text(
getJsonField(
visitaWrapItem,
r'''$.VAW_DTFIM''',
).toString(),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
fontSize: 12.5,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
].addToStart(
const SizedBox(width: 10.0)),
),
Align(
alignment:
const AlignmentDirectional(
-1.0, 0.0),
child: Padding(
padding:
const EdgeInsetsDirectional
.fromSTEB(
10.0, 0.0, 0.0, 0.0),
child: Container(
width: 200.0,
height: 27.0,
decoration: BoxDecoration(
color: valueOrDefault<Color>(
() {
if (jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"A\"') {
return FlutterFlowTheme
.of(context)
.success;
} else if ((
jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"C\"') ||
(jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"F\"') ||
(jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"B\"') ||
(jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"I\"')) {
return FlutterFlowTheme
.of(context)
.error;
} else if (
jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"I\"') {
return FlutterFlowTheme
.of(context)
.warning;
} else {
return FlutterFlowTheme
.of(context)
.primary;
}
}(),
FlutterFlowTheme.of(context)
.primary,
),
borderRadius:
BorderRadius.circular(
5.0),
),
child: Align(
alignment:
const AlignmentDirectional(
0.0, 0.0),
child: Text(
() {
if (jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"A\"') {
return FFLocalizations
.of(context)
.getVariableText(
ptText: 'Ativo',
enText: 'Active',
);
} else if ((
jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"F\"') ||
(jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"C\"') ||
(jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"B\"') ||
(jsonToStr(
getJsonField(
visitaWrapItem,
r'''$.VAW_STATUS''',
)) ==
'\"I\"')) {
return FFLocalizations
.of(context)
.getVariableText(
ptText: 'Cancelado',
enText: 'Canceled',
);
} else {
return FFLocalizations
.of(context)
.getVariableText(
ptText: 'Pendente',
enText: 'Pending',
);
}
}(),
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily:
FlutterFlowTheme.of(
context)
.bodyMediumFamily,
color: FlutterFlowTheme
.of(context)
.info,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts
.asMap()
.containsKey(
FlutterFlowTheme.of(
context)
.bodyMediumFamily),
),
),
),
),
),
),
].divide(const SizedBox(height: 3.0)),
),
),
),
ClipRRect(
borderRadius: BorderRadius.circular(0.0),
child: CachedNetworkImage(
fadeInDuration:
const Duration(milliseconds: 500),
fadeOutDuration:
const Duration(milliseconds: 500),
imageUrl: valueOrDefault<String>(
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
visitaWrapItem,
r'''$.VTE_DOCUMENTO''',
).toString()}&tipo=E',
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
),
fit: BoxFit.cover,
),
),
],
),
),
),
);
}); });
});
}).catchError((err, stack) {});
},
);
}, },
); );
}, },
)
],
),
),
); );
} }
}

View File

@ -137,6 +137,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.18.0" version: "1.18.0"
connectivity_plus:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "2056db5241f96cdc0126bd94459fc4cdc13876753768fc7a31c425e50a7177d0"
url: "https://pub.dev"
source: hosted
version: "6.0.5"
connectivity_plus_platform_interface:
dependency: transitive
description:
name: connectivity_plus_platform_interface
sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
crop_your_image: crop_your_image:
dependency: "direct main" dependency: "direct main"
description: description:
@ -941,6 +957,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
nm:
dependency: transitive
description:
name: nm
sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
octo_image: octo_image:
dependency: transitive dependency: transitive
description: description:

View File

@ -3,7 +3,7 @@ description: A new Flutter project.
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages. # pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application. # The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43 # A version number is three numbers separated by dots, like 1.2.43
@ -48,6 +48,7 @@ dependencies:
flutter_cache_manager: 3.3.2 flutter_cache_manager: 3.3.2
flutter_plugin_android_lifecycle: 2.0.20 flutter_plugin_android_lifecycle: 2.0.20
share_plus: ^9.0.0 share_plus: ^9.0.0
connectivity_plus: ^6.0.5
flutter_secure_storage: 9.2.2 flutter_secure_storage: 9.2.2
flutter_secure_storage_linux: 1.2.1 flutter_secure_storage_linux: 1.2.1
flutter_secure_storage_macos: 3.1.2 flutter_secure_storage_macos: 3.1.2
@ -99,7 +100,6 @@ dependencies:
video_player_platform_interface: 6.2.2 video_player_platform_interface: 6.2.2
video_player_web: 2.3.1 video_player_web: 2.3.1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0 cupertino_icons: ^1.0.0
@ -123,24 +123,20 @@ dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_launcher_icons: flutter_launcher_icons:
android: 'launcher_icon' android: "launcher_icon"
ios: true ios: true
web: web:
generate: true generate: true
image_path: 'assets/images/app_launcher_icon.svg' image_path: "assets/images/app_launcher_icon.svg"
adaptive_icon_background: 'assets/images/adaptive_background_icon.svg' adaptive_icon_background: "assets/images/adaptive_background_icon.svg"
adaptive_icon_foreground: 'assets/images/adaptive_foreground_icon.svg' adaptive_icon_foreground: "assets/images/adaptive_foreground_icon.svg"
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter. # The following section is specific to Flutter.
flutter: flutter:
# The following line ensures that the Material Icons font is # The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in # included with your application, so that you can use the icons in
# the material Icons class. # the material Icons class.
@ -158,7 +154,7 @@ flutter:
- assets/rive_animations/ - assets/rive_animations/
- assets/pdfs/ - assets/pdfs/
fonts: fonts:
- family: 'SF Pro' - family: "SF Pro"
fonts: fonts:
- asset: assets/fonts/SFPRODISPLAYREGULAR.OTF - asset: assets/fonts/SFPRODISPLAYREGULAR.OTF
- asset: assets/fonts/SFPRODISPLAYMEDIUM.OTF - asset: assets/fonts/SFPRODISPLAYMEDIUM.OTF
@ -173,7 +169,6 @@ flutter:
fonts: fonts:
- asset: assets/fonts/menu.ttf - asset: assets/fonts/menu.ttf
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#resolution-aware.

View File

@ -0,0 +1,6 @@
#!/bin/bash
# Encontra e remove todos os arquivos com final :Zone.Identifier
find . -type f -name '*:Zone.Identifier' -exec rm -f {} +
echo "Todos os arquivos :Zone.Identifier foram removidos."