Merge branch 'main' into bugfix/webview

This commit is contained in:
Ivan Antunes 2024-07-16 10:50:37 -03:00
commit d9781f21cd
22 changed files with 1465 additions and 1418 deletions

View File

@ -77,7 +77,7 @@ Future<Color> manageStatusColorAction(
BuildContext context, { BuildContext context, {
required String? visitStatusStr, required String? visitStatusStr,
}) async { }) async {
debugPrint('visitStatusStr: $visitStatusStr'); 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') ||
@ -357,17 +357,17 @@ Future<bool> visitRequestComponentAction(
if (respondeSolicitacaoCall.statusCode == 200) { if (respondeSolicitacaoCall.statusCode == 200) {
return true; return true;
} else { } else {
debugPrint('headers: ${respondeSolicitacaoCall.headers}'); log('headers: ${respondeSolicitacaoCall.headers}');
debugPrint('bodyText: ${respondeSolicitacaoCall.bodyText}'); log('bodyText: ${respondeSolicitacaoCall.bodyText}');
debugPrint('jsonBody: ${respondeSolicitacaoCall.jsonBody}'); log('jsonBody: ${respondeSolicitacaoCall.jsonBody}');
debugPrint('userUUID: ${FFAppState().userUUID}'); log('userUUID: ${FFAppState().userUUID}');
debugPrint('devUUID: ${FFAppState().devUUID}'); log('devUUID: ${FFAppState().devUUID}');
debugPrint('cliUUID: ${FFAppState().cliUUID}'); log('cliUUID: ${FFAppState().cliUUID}');
debugPrint('atividade: respondeSolicitacao'); log('atividade: respondeSolicitacao');
debugPrint('referencia: $refUUID'); log('referencia: $refUUID');
debugPrint('tarefa: $actionValue'); log('tarefa: $actionValue');
debugPrint('resposta: $responseValue'); log('resposta: $responseValue');
debugPrint('idVisitante: $vteUUID'); log('idVisitante: $vteUUID');
return false; return false;
} }
} }
@ -413,7 +413,7 @@ 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']) {
debugPrint("checkLocals => Erro encontrado na resposta"); log("checkLocals => Erro encontrado na resposta");
return false; return false;
} }
@ -425,10 +425,10 @@ 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) {
debugPrint("checkLocals => Item encontrado com CLI_ID $uuid e CLU_STATUS A"); log("checkLocals => Item encontrado com CLI_ID $uuid e CLU_STATUS A");
return true; return true;
} else { } else {
debugPrint("checkLocals => Item não encontrado com CLI_ID $uuid e CLU_STATUS A"); 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,
@ -458,7 +458,7 @@ Future changeStatusAction(
String msg, String msg,
String vteUUID, String vteUUID,
) async { ) async {
debugPrint('status: $status'); log('status: $status');
switch (status) { switch (status) {
case 'L': case 'L':
@ -474,9 +474,9 @@ Future changeStatusAction(
); );
if (!context.mounted) return; if (!context.mounted) return;
if (approveVisitRequest == true) { if (approveVisitRequest == true) {
debugPrint('Aprovado'); log('Aprovado');
} else { } else {
debugPrint('Erro ao aprovar'); log('Erro ao aprovar');
} }
break; break;
case 'B': case 'B':
@ -492,9 +492,9 @@ Future changeStatusAction(
); );
if (!context.mounted) return; if (!context.mounted) return;
if (blockVisitRequest == true) { if (blockVisitRequest == true) {
debugPrint('Bloqueado'); log('Bloqueado');
} else { } else {
debugPrint('Erro ao bloquear'); log('Erro ao bloquear');
} }
break; break;
default: default:

View File

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@ -2297,7 +2298,7 @@ String _serializeList(List? list) {
return json.encode(list, toEncodable: _toEncodable); return json.encode(list, toEncodable: _toEncodable);
} catch (_) { } catch (_) {
if (kDebugMode) { if (kDebugMode) {
print("List serialization failed. Returning empty list."); log("List serialization failed. Returning empty list.");
} }
return '[]'; return '[]';
} }
@ -2309,7 +2310,7 @@ String _serializeJson(dynamic jsonVar, [bool isList = false]) {
return json.encode(jsonVar, toEncodable: _toEncodable); return json.encode(jsonVar, toEncodable: _toEncodable);
} catch (_) { } catch (_) {
if (kDebugMode) { if (kDebugMode) {
print("Json serialization failed. Returning empty json."); log("Json serialization failed. Returning empty json.");
} }
return isList ? '[]' : '{}'; return isList ? '[]' : '{}';
} }

View File

@ -1,7 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'dart:io'; import 'dart:io';
import 'dart:math'; import 'dart:math' as math;
import 'package:f_r_e_hub/actions/actions.dart'; import 'package:f_r_e_hub/actions/actions.dart';
import 'package:f_r_e_hub/app_state.dart'; import 'package:f_r_e_hub/app_state.dart';
@ -49,9 +50,9 @@ class PushNotificationService {
sound: true, sound: true,
); );
if (settings.authorizationStatus == AuthorizationStatus.authorized) { if (settings.authorizationStatus == AuthorizationStatus.authorized) {
debugPrint('User granted permission'); log('User granted permission');
} else { } else {
debugPrint('User declined or has not accepted permission'); log('User declined or has not accepted permission');
} }
} }
@ -91,7 +92,7 @@ class PushNotificationService {
// Passo 4: Decodificar o JSON corrigido // Passo 4: Decodificar o JSON corrigido
return jsonDecode(correctedJson); return jsonDecode(correctedJson);
} catch (e) { } catch (e) {
print('Error decoding JSON: $e'); log('Error decoding JSON: $e');
return {}; return {};
} }
} }
@ -118,17 +119,17 @@ class PushNotificationService {
_flutterLocalNotificationsPlugin.initialize( _flutterLocalNotificationsPlugin.initialize(
initializationSettings, initializationSettings,
onDidReceiveNotificationResponse: (NotificationResponse response) async { onDidReceiveNotificationResponse: (NotificationResponse response) async {
debugPrint('Response payload:${response.payload}'); 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!);
debugPrint('Notification payload: $message'); log('Notification payload: $message');
var data = _notificationDetails; // Assuming getOnMessage() now returns the latest RemoteMessage var data = _notificationDetails; // Assuming getOnMessage() now returns the latest RemoteMessage
debugPrint('Extra: ${data.value}'); log('Extra: ${data.value}');
_handleNotificationClick(message, extra: data.value ?? {'extra': 'extra'}); _handleNotificationClick(message, extra: data.value ?? {'extra': 'extra'});
} catch (e) { } catch (e) {
debugPrint('Error decoding notification payload: $e'); log('Error decoding notification payload: $e');
} }
} }
}, },
@ -165,8 +166,8 @@ class PushNotificationService {
void _listenToForegroundMessages(BuildContext context) { void _listenToForegroundMessages(BuildContext context) {
FirebaseMessaging.onMessage.listen((RemoteMessage message) { FirebaseMessaging.onMessage.listen((RemoteMessage message) {
debugPrint('Got a message whilst in the foreground!'); log('Got a message whilst in the foreground!');
debugPrint('Message data: ${message.toMap()}'); 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);
@ -179,16 +180,16 @@ class PushNotificationService {
void _listenToNotificationClicks(BuildContext context) { void _listenToNotificationClicks(BuildContext context) {
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
debugPrint('Notification clicked!'); log('Notification clicked!');
_onMessage.add(message); _onMessage.add(message);
debugPrint('Extra: ${message.notification?.body}'); 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.listen(_handleTokenUpdate).onError((err) {
debugPrint("Error refreshing token: $err"); log("Error refreshing token: $err");
}); });
} }
@ -196,14 +197,14 @@ class PushNotificationService {
FFAppState().token = token; FFAppState().token = token;
final ApiCallResponse? response = await _updateTokenOnServer(token); final ApiCallResponse? response = await _updateTokenOnServer(token);
if (_isTokenUpdateSuccessful(response)) { if (_isTokenUpdateSuccessful(response)) {
debugPrint('Token updated successfully on server. Token: $token'); log('Token updated successfully on server. Token: $token');
} else { } else {
debugPrint('Error updating token on server'); log('Error updating token on server');
} }
} }
Future<void> _handleTokenUpdate(String newToken) async { Future<void> _handleTokenUpdate(String newToken) async {
debugPrint('Token refreshed: $newToken'); log('Token refreshed: $newToken');
await _updateToken(newToken); await _updateToken(newToken);
} }
@ -216,17 +217,17 @@ class PushNotificationService {
final String? deviceToken = await _firebaseMessaging.getToken(); final String? deviceToken = await _firebaseMessaging.getToken();
if (deviceToken != null) { if (deviceToken != null) {
debugPrint('Push Messaging token: $deviceToken'); log('Push Messaging token: $deviceToken');
await _updateToken(deviceToken); await _updateToken(deviceToken);
} else { } else {
debugPrint('Failed to get Firebase Messaging token'); log('Failed to get Firebase Messaging token');
} }
} }
Future<NotificationSettings> _requestNotificationPermission() async { Future<NotificationSettings> _requestNotificationPermission() async {
final NotificationSettings settings = final NotificationSettings settings =
await _firebaseMessaging.requestPermission(); await _firebaseMessaging.requestPermission();
debugPrint(settings.authorizationStatus == AuthorizationStatus.authorized log(settings.authorizationStatus == AuthorizationStatus.authorized
? 'User granted permission' ? 'User granted permission'
: 'User declined or has not accepted permission'); : 'User declined or has not accepted permission');
return settings; return settings;
@ -235,7 +236,7 @@ class PushNotificationService {
Future<void> _fetchAndLogApnsToken(NotificationSettings settings) async { Future<void> _fetchAndLogApnsToken(NotificationSettings settings) async {
if (settings.authorizationStatus == AuthorizationStatus.authorized) { if (settings.authorizationStatus == AuthorizationStatus.authorized) {
final String? apnsToken = await _firebaseMessaging.getAPNSToken(); final String? apnsToken = await _firebaseMessaging.getAPNSToken();
debugPrint(apnsToken != null log(apnsToken != null
? 'APNS Token: $apnsToken' ? 'APNS Token: $apnsToken'
: 'Failed to get APNS token'); : 'Failed to get APNS token');
} }
@ -273,10 +274,10 @@ class PushNotificationService {
var generalNotificationDetails = var generalNotificationDetails =
NotificationDetails(android: androidDetails, iOS: iOSDetails); NotificationDetails(android: androidDetails, iOS: iOSDetails);
debugPrint('Showing notification: ${message.messageId.hashCode}'); log('Showing notification: ${message.messageId.hashCode}');
await _flutterLocalNotificationsPlugin.show( await _flutterLocalNotificationsPlugin.show(
// DateTime.now().millisecondsSinceEpoch % (1 << 31), // DateTime.now().millisecondsSinceEpoch % (1 << 31),
Random().nextInt(1 << 30), math.Random().nextInt(1 << 30),
message.notification?.title, message.notification?.title,
message.notification?.body, message.notification?.body,
generalNotificationDetails, generalNotificationDetails,
@ -288,13 +289,13 @@ class PushNotificationService {
switch (payload.isNotEmpty) { switch (payload.isNotEmpty) {
case true: case true:
// Print the 'data' property // Print the 'data' property
debugPrint('Notification payload: $payload'); log('Notification payload: $payload');
debugPrint('Extra: $extra'); 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:
debugPrint('Notification payload is empty'); log('Notification payload is empty');
// Handle the message notification as needed // Handle the message notification as needed
break; break;
} }
@ -302,15 +303,15 @@ class PushNotificationService {
static Future<void> _firebaseMessagingBackgroundHandler( static Future<void> _firebaseMessagingBackgroundHandler(
RemoteMessage message) async { RemoteMessage message) async {
debugPrint('Handling a background message: ${message.messageId}'); 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 {}}) {
debugPrint('Notification Received!'); log('Notification Received!');
message.forEach((key, value) { message.forEach((key, value) {
debugPrint('$key: $value'); log('$key: $value');
}); });
switch (message['click_action']) { switch (message['click_action']) {
@ -327,10 +328,10 @@ class NotificationHandler {
_showMessageNotificationDialog(message, context, extra); _showMessageNotificationDialog(message, context, extra);
break; break;
case 'enroll_cond': case 'enroll_cond':
debugPrint('enroll_cond'); log('enroll_cond');
break; break;
default: default:
debugPrint('Notification type not recognized'); log('Notification type not recognized');
} }
} }
@ -350,10 +351,10 @@ class NotificationHandler {
void _showAcessNotificationModal( void _showAcessNotificationModal(
Map<String, dynamic> message, BuildContext context) { Map<String, dynamic> message, BuildContext context) {
debugPrint('Showing access notification dialog'); log('Showing access notification dialog');
debugPrint('USR_TIPO: ${message['USR_TIPO']}'); log('USR_TIPO: ${message['USR_TIPO']}');
debugPrint('USR_ID: ${message['USR_ID']}'); log('USR_ID: ${message['USR_ID']}');
debugPrint('USR_DOCUMENTO: ${message['USR_DOCUMENTO']}'); log('USR_DOCUMENTO: ${message['USR_DOCUMENTO']}');
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
@ -379,8 +380,8 @@ 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) {
debugPrint('Showing message notification dialog'); log('Showing message notification dialog');
debugPrint('Notification "message": $message'); log('Notification "message": $message');
showDialog( showDialog(
useSafeArea: true, useSafeArea: true,
context: context, context: context,
@ -401,7 +402,7 @@ class NotificationHandler {
void _showVisitRequestDialog( void _showVisitRequestDialog(
Map<String, dynamic> message, BuildContext context) { Map<String, dynamic> message, BuildContext context) {
debugPrint('Showing visit request notification dialog'); log('Showing visit request notification dialog');
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {

View File

@ -37,7 +37,7 @@
// void openedAppVisitRequestNotification( // void openedAppVisitRequestNotification(
// RemoteMessage message, BuildContext context) { // RemoteMessage message, BuildContext context) {
// debugPrint('openedAppVisitRequestNotification'); // log('openedAppVisitRequestNotification');
// showDialog( // showDialog(
// context: context, // context: context,
// builder: (BuildContext context) { // builder: (BuildContext context) {
@ -55,9 +55,9 @@
// // Método para tratar mensagens recebidas // // Método para tratar mensagens recebidas
// void handleMessage(RemoteMessage message, BuildContext context) { // void handleMessage(RemoteMessage message, BuildContext context) {
// debugPrint('Notification Received!'); // log('Notification Received!');
// message.data.forEach((key, value) { // message.data.forEach((key, value) {
// debugPrint('$key: $value'); // log('$key: $value');
// }); // });
// switch (message.data['type']) { // switch (message.data['type']) {
@ -67,7 +67,7 @@
// case '': // case '':
// break; // break;
// default: // default:
// debugPrint('Notification type not recognized'); // log('Notification type not recognized');
// } // }
// } // }

View File

@ -1,3 +1,5 @@
import 'dart:developer';
import '/backend/api_requests/api_calls.dart'; import '/backend/api_requests/api_calls.dart';
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/flutter_flow_util.dart';
@ -136,18 +138,17 @@ class _BottomArrowLinkedLocalsComponentWidgetState
setState(() {}); setState(() {});
FFAppState().ownerUUID = localItem['CLU_OWNER_ID']; FFAppState().ownerUUID = localItem['CLU_OWNER_ID'];
setState(() {}); setState(() {});
debugPrint('Local: ${FFAppState().local}'); log('Local: ${FFAppState().local}');
Navigator.pop(context); Navigator.pop(context);
} else { } else {
debugPrint('Local não disponível'); log('Local não disponível');
debugPrint(localItem.toString()); ScaffoldMessenger.of(context).showSnackBar(
// ScaffoldMessenger.of(context).showSnackBar( const SnackBar(
// SnackBar( content: Text(
// content: Text( 'Local não disponível',
// 'Local não disponível', ),
// ), ),
// ), );
// );
} }
}, },

View File

@ -1,3 +1,5 @@
import 'package:f_r_e_hub/actions/actions.dart';
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';
@ -10,7 +12,10 @@ import 'local_profile_component_model.dart';
export 'local_profile_component_model.dart'; export 'local_profile_component_model.dart';
class LocalProfileComponentWidget extends StatefulWidget { class LocalProfileComponentWidget extends StatefulWidget {
const LocalProfileComponentWidget({super.key}); const LocalProfileComponentWidget({
required bool localStatus,
super.key
});
@override @override
State<LocalProfileComponentWidget> createState() => State<LocalProfileComponentWidget> createState() =>
@ -44,104 +49,99 @@ class _LocalProfileComponentWidgetState
Widget build(BuildContext context) { Widget build(BuildContext context) {
context.watch<FFAppState>(); context.watch<FFAppState>();
return Visibility( return Container(
visible: random_data.randomInteger(0, 10) != null, decoration: const BoxDecoration(),
child: Container( child: Align(
decoration: const BoxDecoration(), alignment: const AlignmentDirectional(0.0, -1.0),
child: Align( child: Material(
alignment: const AlignmentDirectional(0.0, -1.0), color: Colors.transparent,
child: Material( elevation: 0.0,
color: Colors.transparent, child: Container(
elevation: 0.0, width: double.infinity,
child: Container( height: 119.0,
width: double.infinity, decoration: BoxDecoration(
height: 119.0, color: const Color(0xFF1AAB5F),
decoration: BoxDecoration( border: Border.all(
color: const Color(0xFF1AAB5F), color: const Color(0xFF1AAB5F),
border: Border.all(
color: const Color(0xFF1AAB5F),
),
), ),
child: Row( ),
mainAxisSize: MainAxisSize.max, child: Row(
children: [ mainAxisSize: MainAxisSize.max,
Align( children: [
alignment: const AlignmentDirectional(-1.0, 0.0), Align(
child: Padding( alignment: const AlignmentDirectional(-1.0, 0.0),
padding: const EdgeInsets.all(2.0), child: Padding(
child: InkWell( padding: const EdgeInsets.all(2.0),
splashColor: Colors.transparent, child: InkWell(
focusColor: Colors.transparent, splashColor: Colors.transparent,
hoverColor: Colors.transparent, focusColor: Colors.transparent,
highlightColor: Colors.transparent, hoverColor: Colors.transparent,
onTap: () async { highlightColor: Colors.transparent,
showModalBottomSheet( onTap: () async {
isScrollControlled: true, showModalBottomSheet(
backgroundColor: const Color(0x00FFFFFF), isScrollControlled: true,
context: context, backgroundColor: const Color(0x00FFFFFF),
builder: (context) { context: context,
return Padding( builder: (context) {
padding: MediaQuery.viewInsetsOf(context), return Padding(
child: const SizedBox( padding: MediaQuery.viewInsetsOf(context),
height: double.infinity, child: const SizedBox(
child: height: double.infinity,
BottomArrowLinkedLocalsComponentWidget(), child:
), BottomArrowLinkedLocalsComponentWidget(),
); ),
}, );
).then((value) => safeSetState(() {})); },
}, ).then((value) => safeSetState(() {}));
child: ClipRRect( },
borderRadius: BorderRadius.circular(200.0), child: ClipRRect(
child: Image.network( borderRadius: BorderRadius.circular(200.0),
valueOrDefault<String>( child:
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png', Image.network(
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', 'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
), width: 80.0,
height: 80.0,
fit: BoxFit.cover,
alignment: const Alignment(0.0, 0.0),
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',
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) => errorBuilder: (context, error, stackTrace) => Image.asset('assets/images/error_image.svg'),
Image.asset(
'assets/images/error_image.svg',
width: 80.0,
height: 80.0,
fit: BoxFit.cover,
alignment: const Alignment(0.0, 0.0),
),
), ),
)
), ),
), ),
), ),
), ),
Column( Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
valueOrDefault<String>( valueOrDefault<String>(
functions.convertToUppercase(FFAppState().local), functions.convertToUppercase(FFAppState().local),
'NOME DO LOCAL', 'NOME DO LOCAL',
),
style:
FlutterFlowTheme.of(context).labelMedium.override(
fontFamily: 'Nunito',
color: FlutterFlowTheme.of(context).info,
fontSize: 14.0,
letterSpacing: 0.0,
fontWeight: FontWeight.w500,
useGoogleFonts:
GoogleFonts.asMap().containsKey('Nunito'),
),
), ),
], style:
), FlutterFlowTheme.of(context).labelMedium.override(
] fontFamily: 'Nunito',
.divide(const SizedBox(width: 20.0)) color: FlutterFlowTheme.of(context).info,
.addToStart(const SizedBox(width: 20.0)) fontSize: 14.0,
.addToEnd(const SizedBox(width: 20.0)), letterSpacing: 0.0,
), fontWeight: FontWeight.w500,
useGoogleFonts:
GoogleFonts.asMap().containsKey('Nunito'),
),
),
],
),
]
.divide(const SizedBox(width: 20.0))
.addToStart(const SizedBox(width: 20.0))
.addToEnd(const SizedBox(width: 20.0)),
), ),
), ),
), ),

View File

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:f_r_e_hub/app_state.dart'; import 'package:f_r_e_hub/app_state.dart';
import 'package:f_r_e_hub/backend/api_requests/api_calls.dart'; import 'package:f_r_e_hub/backend/api_requests/api_calls.dart';
import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart'; import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart';
@ -7,31 +9,26 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class MessageWellComponentWidget extends StatefulWidget { class MessageWellComponentWidget extends StatefulWidget {
const MessageWellComponentWidget({super.key}); const MessageWellComponentWidget({Key? key}) : super(key: key);
@override @override
State<MessageWellComponentWidget> createState() => State<MessageWellComponentWidget> createState() =>
_MessageWellComponentWidgetState(); _MessageWellComponentWidgetState();
} }
class _MessageWellComponentWidgetState extends State<MessageWellComponentWidget> { class _MessageWellComponentWidgetState
extends State<MessageWellComponentWidget> {
late ScrollController _listViewController; late ScrollController _listViewController;
bool _allowScrollInSingleChildScrollView = true; late VoidCallback _scrollListener;
final dropdownValueNotifier = ValueNotifier<String>('All');
VoidCallback get _scrollListener => MessageWellNotifier()._scrollListener;
final dropdownValueNotifier = ValueNotifier<String>('All'); // Using ValueNotifier for state management
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_listViewController = ScrollController(); _listViewController = ScrollController();
_listViewController.addListener(_scrollListener); // Adicione esta linha _scrollListener = MessageWellNotifier()._scrollListener;
// WidgetsBinding.instance?.addPostFrameCallback((_) { _listViewController.addListener(_scrollListener);
// context.read<MessageWellNotifier>().fetchMessages();
// });
} }
@override @override
@ -77,84 +74,80 @@ class _MessageWellComponentWidgetState extends State<MessageWellComponentWidget>
); );
} }
bool _buildScrollMessageListManager(ScrollNotification notification) {
bool _buildScrollMessageListManager(ScrollNotification notification) { final notifier = context.read<MessageWellNotifier>();
final notifier = context.read<MessageWellNotifier>(); if (notification is ScrollUpdateNotification) {
if (notification is ScrollUpdateNotification) { log('Scrolling ...');
debugPrint('Scrolling ...'); if (_listViewController.offset <= 0 && notification.scrollDelta! < 0) {
if (_listViewController.offset <= 0 && notification.scrollDelta! < 0) { log('Scrolling up ...');
debugPrint('Scrolling up ...'); setState(() {});
setState(() { } else {
_allowScrollInSingleChildScrollView = true; log('Scrolling down ...');
}); if (_listViewController.position.extentAfter == 0) {
} else { log('Reached end of list. Incrementing pageNumber...');
debugPrint('Scrolling down ...'); notifier.incrementPageNumber();
if (_listViewController.position.extentAfter == 0) { }
debugPrint('Reached end of list. Incrementing pageNumber...'); setState(() {});
notifier.incrementPageNumber();
} }
setState(() {
_allowScrollInSingleChildScrollView = false;
// MessageWellNotifier().fetchMessages();
});
} }
return true;
} }
return true;
}
Widget _buildMenuMessageWell(BuildContext context, FlutterFlowTheme theme, ValueNotifier<String> dropdownValueNotifier) { Widget _buildMenuMessageWell(BuildContext context, FlutterFlowTheme theme,
ValueNotifier<String> dropdownValueNotifier) {
final locations = FFLocalizations.of(context);
final all = locations.getVariableText(enText: 'All', ptText: 'All');
final personal =
locations.getVariableText(enText: 'Personal', ptText: 'Pessoal');
final global = locations.getVariableText(enText: 'Global', ptText: 'Global');
final locations = FFLocalizations.of(context); return SizedBox(
late String all = locations.getVariableText(enText: 'All', ptText: 'All'); key: UniqueKey(),
late String personal = locations.getVariableText(enText: 'Personal', ptText: 'Pessoal'); width: 200,
late String global = locations.getVariableText(enText: 'Global', ptText: 'Global'); height: 40,
child: ValueListenableBuilder<String>(
return SizedBox( valueListenable: dropdownValueNotifier,
key: UniqueKey(), builder: (context, value, child) {
width: 200, return DropdownButtonFormField<String>(
height: 40, value: value,
child: ValueListenableBuilder<String>( decoration: InputDecoration(
valueListenable: dropdownValueNotifier, contentPadding: EdgeInsets.symmetric(horizontal: 10.0),
builder: (context, value, child) { border: OutlineInputBorder(
return DropdownButtonFormField<String>( borderSide: BorderSide(
value: value, color: theme.primary,
decoration: InputDecoration( width: 2,
contentPadding: EdgeInsets.symmetric(horizontal: 10.0), ),
border: OutlineInputBorder( borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(
color: theme.primary, // Assuming FlutterFlowTheme.of(context).primary is the correct usage
width: 2, // Adjusted width to a reasonable value
), ),
borderRadius: BorderRadius.circular(10), filled: true,
fillColor: theme.primary,
), ),
filled: true, onChanged: (String? newValue) {
fillColor: theme.primary, if (newValue != null) {
), dropdownValueNotifier.value = newValue;
onChanged: (String? newValue) { }
if (newValue != null) { },
// logger.log('DropDown value: $newValue'); // Assuming logger is correctly initialized elsewhere items: [
dropdownValueNotifier.value = newValue; // Update the ValueNotifier value DropdownMenuItem<String>(value: all, child: Text(all)),
} DropdownMenuItem<String>(value: personal, child: Text(personal)),
}, DropdownMenuItem<String>(value: global, child: Text(global)),
items: [ ],
DropdownMenuItem<String>(value: all, child: Text(all)), style: theme.labelMedium.override(
DropdownMenuItem<String>(value: personal, child: Text(personal)), fontFamily: theme.labelMediumFamily,
DropdownMenuItem<String>(value: global, child: Text(global)), color: theme.primaryText,
], useGoogleFonts:
style: theme.labelMedium.override( GoogleFonts.asMap().containsKey(theme.labelMediumFamily),
fontFamily: theme.labelMediumFamily, ),
color: theme.primaryText, );
useGoogleFonts: GoogleFonts.asMap().containsKey(theme.labelMediumFamily), },
), ),
); );
}, }
),
);
}
Text _buildHandleMessageWell(BuildContext context, FlutterFlowTheme theme) { Text _buildHandleMessageWell(
BuildContext context, FlutterFlowTheme theme) {
return Text( return Text(
FFLocalizations.of(context).getText('8fworxmb'), // Mural de Mensagens FFLocalizations.of(context).getText('8fworxmb'),
style: theme.bodyMedium.override( style: theme.bodyMedium.override(
fontFamily: 'Nunito Sans', fontFamily: 'Nunito Sans',
letterSpacing: 0.0, letterSpacing: 0.0,
@ -163,81 +156,84 @@ Widget _buildMenuMessageWell(BuildContext context, FlutterFlowTheme theme, Value
); );
} }
Widget _buildMessageItem(BuildContext context, dynamic message, int index) { Widget _buildMessageItem(
final theme = Theme.of(context); BuildContext context, dynamic message, int index) {
String formatMessageOrigin(String messageOrigin) { final theme = Theme.of(context);
final words = messageOrigin.split(' '); String formatMessageOrigin(String messageOrigin) {
final formattedWords = words.map((word) { final words = messageOrigin.split(' ');
final firstLetter = word.substring(0, 1).toUpperCase(); final formattedWords = words.map((word) {
final remainingLetters = word.substring(1).toLowerCase(); final firstLetter = word.substring(0, 1).toUpperCase();
return '$firstLetter$remainingLetters'; final remainingLetters = word.substring(1).toLowerCase();
}); return '$firstLetter$remainingLetters';
return formattedWords.join(' '); });
} return formattedWords.join(' ');
return GestureDetector( }
onTap: () => print('Message tapped ...\nmessage[$index]: $message'),
child: Padding( return GestureDetector(
padding: const EdgeInsets.fromLTRB(20, 5, 20, 5), onTap: () =>
child: Container( log('Message tapped ...\nmessage[$index]: $message'),
width: MediaQuery.of(context).size.width * 0.9, child: Padding(
height: 127.0, padding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
decoration: const BoxDecoration( child: Container(
borderRadius: BorderRadius.all(Radius.circular(10)), width: MediaQuery.of(context).size.width * 0.9,
), height: 127.0,
child: Row( decoration: const BoxDecoration(
mainAxisSize: MainAxisSize.max, borderRadius: BorderRadius.all(Radius.circular(10)),
mainAxisAlignment: MainAxisAlignment.start, ),
children: [ child: Row(
Padding( mainAxisSize: MainAxisSize.max,
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0), mainAxisAlignment: MainAxisAlignment.start,
child: Container( children: [
width: 64.0, Padding(
height: 64.0, padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
decoration: const BoxDecoration(shape: BoxShape.circle), child: Container(
width: 64.0,
height: 64.0,
decoration: const BoxDecoration(shape: BoxShape.circle),
),
), ),
), Expanded(
Expanded( child: Column(
child: Column( mainAxisSize: MainAxisSize.max,
mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ const SizedBox(height: 8.0),
const SizedBox(height: 8.0), Center(
Center( child: Text(
child: Text(
'~ ${formatMessageOrigin(message['MSG_ORIGEM_DESC'].toString())}', '~ ${formatMessageOrigin(message['MSG_ORIGEM_DESC'].toString())}',
style: theme.textTheme.headlineMedium!.copyWith( style: theme.textTheme.headlineMedium!.copyWith(
fontFamily: 'Nunito Sans',
color: FlutterFlowTheme.of(context).primary,
fontSize: 14.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 8.0),
Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Text(
formatMessageOrigin(message['MSG_TEXTO'].toString()),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: 'Nunito Sans', fontFamily: 'Nunito Sans',
color: FlutterFlowTheme.of(context).primaryText, color: FlutterFlowTheme.of(context).primary,
fontSize: 14.0, fontSize: 14.0,
fontWeight: FontWeight.bold,
), ),
softWrap: true,
maxLines: 10,
), ),
), ),
), const SizedBox(height: 8.0),
], Expanded(
), child: SingleChildScrollView(
) scrollDirection: Axis.vertical,
], child: Text(
formatMessageOrigin(message['MSG_TEXTO'].toString()),
style: theme.textTheme.bodyMedium!.copyWith(
fontFamily: 'Nunito Sans',
color: FlutterFlowTheme.of(context).primaryText,
fontSize: 14.0,
),
softWrap: true,
maxLines: 10,
),
),
),
],
),
)
],
),
), ),
), ),
), );
); }
}
} }
class MessageWellState { class MessageWellState {
@ -262,7 +258,9 @@ class MessageWellState {
return MessageWellState( return MessageWellState(
messages: messages ?? this.messages, messages: messages ?? this.messages,
pageNumber: pageNumber ?? this.pageNumber, pageNumber: pageNumber ?? this.pageNumber,
allowScrollInSingleChildScrollView: allowScrollInSingleChildScrollView ?? this.allowScrollInSingleChildScrollView, allowScrollInSingleChildScrollView:
allowScrollInSingleChildScrollView ??
this.allowScrollInSingleChildScrollView,
listViewController: listViewController ?? this.listViewController, listViewController: listViewController ?? this.listViewController,
); );
} }
@ -272,7 +270,10 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
var totalPageNumber = 1; var totalPageNumber = 1;
MessageWellNotifier() MessageWellNotifier()
: super(MessageWellState(messages: [], allowScrollInSingleChildScrollView: true, listViewController: ScrollController())) { : super(MessageWellState(
messages: [],
allowScrollInSingleChildScrollView: true,
listViewController: ScrollController())) {
state.listViewController.addListener(_scrollListener); state.listViewController.addListener(_scrollListener);
fetchMessages(); fetchMessages();
} }
@ -291,22 +292,25 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
); );
if (response.statusCode == 200) { if (response.statusCode == 200) {
var messagesData = response.jsonBody['mensagens']; var messagesData = response.jsonBody['mensagens'];
debugPrint('inputs: ${FFAppState().devUUID}, ${FFAppState().userUUID}, ${FFAppState().cliUUID}'); log('inputs: ${FFAppState().devUUID}, ${FFAppState().userUUID}, ${FFAppState().cliUUID}');
debugPrint('response: ${response.jsonBody}'); log('response: ${response.jsonBody}');
debugPrint('response[mensagens]: $messagesData'); log('response[mensagens]: $messagesData');
debugPrint('response[mensagens][0][MSG_TEXTO]: ${messagesData[0]['MSG_TEXTO']}'); log('response[mensagens][0][MSG_TEXTO]: ${messagesData[0]['MSG_TEXTO']}');
var newMessages = [...state.messages, ...messagesData]; var newMessages = [...state.messages, ...messagesData];
var rExp = RegExp(r'\d+').allMatches(newMessages.toString()).map((e) => e.group(0)).toList(); var rExp = RegExp(r'\d+')
debugPrint('rExp: $rExp'); .allMatches(newMessages.toString())
debugPrint('newMessages: $newMessages'); .map((e) => e.group(0))
.toList();
log('rExp: $rExp');
log('newMessages: $newMessages');
state = state.copyWith(messages: newMessages); state = state.copyWith(messages: newMessages);
totalPageNumber = int.parse(response.jsonBody['total_pages']); totalPageNumber = int.parse(response.jsonBody['total_pages']);
debugPrint('totalPageNumber: $totalPageNumber'); log('totalPageNumber: $totalPageNumber');
} else { } else {
debugPrint('Error fetching messages: ${response.statusCode}'); log('Error fetching messages: ${response.statusCode}');
} }
} else { } else {
debugPrint('No more messages to fetch ...'); log('No more messages to fetch ...');
} }
} }
@ -318,7 +322,7 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
if (!state.allowScrollInSingleChildScrollView) { if (!state.allowScrollInSingleChildScrollView) {
if (state.pageNumber <= totalPageNumber) { if (state.pageNumber <= totalPageNumber) {
state = state.copyWith(pageNumber: state.pageNumber + 1); state = state.copyWith(pageNumber: state.pageNumber + 1);
debugPrint('state.pageNumber: ${state.pageNumber}'); log('state.pageNumber: ${state.pageNumber}');
fetchMessages(); fetchMessages();
} }
} }
@ -333,18 +337,12 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
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);
debugPrint('state.pageNumber: ${state.pageNumber}'); log('state.pageNumber: ${state.pageNumber}');
} }
} }
} }
final messageWellProvider =
mixin Logger { StateNotifierProvider<MessageWellNotifier, MessageWellState>((ref) {
static void log(String message) {
debugPrint('Logger: $message');
}
}
final messageWellProvider = StateNotifierProvider<MessageWellNotifier, MessageWellState>((ref) {
return MessageWellNotifier(); return MessageWellNotifier();
}); });

View File

@ -1,4 +1,5 @@
import 'dart:collection'; import 'dart:collection';
import 'dart:developer';
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';
@ -69,7 +70,7 @@ class _CardItemTemplateComponentWidgetState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
context.watch<FFAppState>(); context.watch<FFAppState>();
debugPrint('imageHashMap: ${widget.imageHashMap}'); log('imageHashMap: ${widget.imageHashMap}');
return InkWell( return InkWell(
splashColor: Colors.transparent, splashColor: Colors.transparent,

View File

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
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';
@ -58,7 +59,7 @@ List<dynamic>? findVisitorById(List<dynamic>? jsonList, String? id) {
); );
return foundItem != null ? [foundItem] : null; return foundItem != null ? [foundItem] : null;
} catch (e) { } catch (e) {
print("Error searching item: $e"); log("Error searching item: $e");
return null; return null;
} }
} }
@ -860,7 +861,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
size: 24.0, size: 24.0,
), ),
onPressed: () { onPressed: () {
print('IconButton pressed ...'); log('IconButton pressed ...');
}, },
), ),
], ],

View File

@ -1,5 +1,7 @@
// Automatic FlutterFlow imports
import '/backend/schema/structs/index.dart'; import '/backend/schema/structs/index.dart';
import 'dart:developer';
import '/backend/schema/enums/enums.dart'; import '/backend/schema/enums/enums.dart';
import '/actions/actions.dart' as action_blocks; import '/actions/actions.dart' as action_blocks;
import '/flutter_flow/flutter_flow_theme.dart'; import '/flutter_flow/flutter_flow_theme.dart';
@ -7,11 +9,7 @@ import '/flutter_flow/flutter_flow_util.dart';
import 'index.dart'; // Imports other custom actions import 'index.dart'; // Imports other custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Begin custom action code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
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 {
@ -19,22 +17,21 @@ Future<String?> getDevUUID() async {
if (Platform.isIOS) { if (Platform.isIOS) {
// import 'dart:io' // import 'dart:io'
var iosDeviceInfo = await deviceInfo.iosInfo; var iosDeviceInfo = await deviceInfo.iosInfo;
debugPrint('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1" log('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS" log('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3" log('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone" log('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone" log('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E" 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;
print(AndroidDeviceInfo); // log('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
// debugPrint('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E" log('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
return androidDeviceInfo.id; // unique ID on Android return androidDeviceInfo.id; // unique ID on Android
} }
} }
@ -44,22 +41,21 @@ 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;
debugPrint('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1" log('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS" log('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3" log('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone" log('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone" log('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
debugPrint('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E" 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;
print(AndroidDeviceInfo); // log('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
// debugPrint('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E" log('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone" log('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
debugPrint('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
return androidDeviceInfo.serialNumber; // unique ID on Android return androidDeviceInfo.serialNumber; // unique ID on Android
} }
} }

View File

@ -58,7 +58,7 @@ class _ImageCropperState extends State<ImageCropper> {
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) {
print('image cropped'); log('image cropped');
widget.callBackAction!.call(value!); widget.callBackAction!.call(value!);
loading = false; loading = false;
}); });
@ -93,7 +93,7 @@ class _ImageCropperState extends State<ImageCropper> {
setState(() { setState(() {
loading = true; loading = true;
}); });
print('Button pressed ...'); log('Button pressed ...');
_crop_controller.crop(); _crop_controller.crop();
//widget.loading = true; //widget.loading = true;

View File

@ -113,7 +113,7 @@ Stream<double> getProgressValue() {
return Stream.periodic(duration, (int count) { return Stream.periodic(duration, (int count) {
final currentTime = DateTime.now().millisecondsSinceEpoch; final currentTime = DateTime.now().millisecondsSinceEpoch;
final elapsedTime = currentTime - startTime; final elapsedTime = currentTime - startTime;
final progress = math.min(1.0, elapsedTime / (endTime - startTime)); final progress = math.max(0.0, 1.0 - (elapsedTime / (endTime - startTime)));
return progress; return progress;
}); });
} }

View File

@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -83,7 +84,7 @@ String? serializeParam(
} }
return data; return data;
} catch (e) { } catch (e) {
print('Error serializing parameter: $e'); log('Error serializing parameter: $e');
return null; return null;
} }
} }
@ -224,7 +225,7 @@ dynamic deserializeParam<T>(
return null; return null;
} }
} catch (e) { } catch (e) {
print('Error deserializing parameter: $e'); log('Error deserializing parameter: $e');
return null; return null;
} }
} }

View File

@ -1,3 +1,5 @@
import 'dart:developer';
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';
@ -51,7 +53,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
_AcessHistoryPageWidgetState(Map<String, String> opt) _AcessHistoryPageWidgetState(Map<String, String> opt)
: selectedTypeSubject = BehaviorSubject.seeded(opt) { : selectedTypeSubject = BehaviorSubject.seeded(opt) {
selectedTypeSubject.listen((value) { selectedTypeSubject.listen((value) {
print("selectedTypeSubject changed: $value"); log("selectedTypeSubject changed: $value");
}); });
} }
@ -59,7 +61,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
void initState() { void initState() {
super.initState(); super.initState();
_model = createModel(context, () => AcessHistoryPageModel()); _model = createModel(context, () => AcessHistoryPageModel());
debugPrint("initState called in _AcessHistoryPageWidgetState"); log("initState called in _AcessHistoryPageWidgetState");
} }
@override @override
@ -126,7 +128,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
} }
Widget _appBarFilterButtonAtomWidget(BuildContext context) { Widget _appBarFilterButtonAtomWidget(BuildContext context) {
debugPrint('selectedTypeSubject: ${selectedTypeSubject.value}'); log('selectedTypeSubject: ${selectedTypeSubject.value}');
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
@ -148,7 +150,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
); );
if (selectedFilter != null) { if (selectedFilter != null) {
debugPrint('Selected Filter: $selectedFilter'); log('Selected Filter: $selectedFilter');
_updateAccessHistoryAction(selectedFilter); _updateAccessHistoryAction(selectedFilter);
} }
}, },
@ -170,14 +172,14 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
}); });
if (needsUpdate) { if (needsUpdate) {
selectedTypeSubject.add(updatedType); selectedTypeSubject.add(updatedType);
print("updateAccessHistory called with newType: $newType"); log("updateAccessHistory called with newType: $newType");
safeSetState(() {}); safeSetState(() {});
} }
} }
} }
Stream<ApiCallResponse> fetchAccessHistoryService(String selectedType) { Stream<ApiCallResponse> fetchAccessHistoryService(String selectedType) {
debugPrint('Calling API with type: $selectedType'); log('Calling API with type: $selectedType');
switch (selectedType) { switch (selectedType) {
case 'E': case 'E':
return _model.accessHistory( return _model.accessHistory(
@ -239,13 +241,13 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
Future<List<dynamic>> fetchCardListViewService( Future<List<dynamic>> fetchCardListViewService(
Map<String, String> select) async { Map<String, String> select) async {
debugPrint('Fetching access history'); log('Fetching access history');
final response = final response =
await fetchAccessHistoryService(select['personType']!).first; await fetchAccessHistoryService(select['personType']!).first;
debugPrint('Response: ${response.jsonBody}'); log('Response: ${response.jsonBody}');
final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? []; final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? [];
debugPrint('Access History Before Filtering: $accessHistory'); log('Access History Before Filtering: $accessHistory');
debugPrint( log(
'Filtering for: Person Type - ${select['personType']}, Access Type - ${select['accessType']}, Search - ${select['search']}'); 'Filtering for: Person Type - ${select['personType']}, Access Type - ${select['accessType']}, Search - ${select['search']}');
return accessHistory.where((item) { return accessHistory.where((item) {
@ -258,20 +260,20 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
.toString() .toString()
.toLowerCase() .toLowerCase()
.contains(select['search']!.toLowerCase()); .contains(select['search']!.toLowerCase());
debugPrint('NOMES: ${item["PES_NOME"].toString().toLowerCase()}'); log('NOMES: ${item["PES_NOME"].toString().toLowerCase()}');
return personTypeMatches && accessTypeMatches && searchMatches; return personTypeMatches && accessTypeMatches && searchMatches;
}).toList(); }).toList();
} }
Widget _cardListViewOrganismWidget(Map<String, String> selected) { Widget _cardListViewOrganismWidget(Map<String, String> selected) {
debugPrint( log(
'Selected types in Card: ${selected['personType']}, ${selected['accessType']}'); 'Selected types in Card: ${selected['personType']}, ${selected['accessType']}');
debugPrint('_buildAccessHistoryList called'); log('_buildAccessHistoryList called');
return FutureBuilder<List<dynamic>>( return FutureBuilder<List<dynamic>>(
future: fetchCardListViewService(selected), future: fetchCardListViewService(selected),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
debugPrint('Waiting for data'); log('Waiting for data');
return Center( return Center(
child: SizedBox( child: SizedBox(
width: 50.0, width: 50.0,
@ -286,14 +288,14 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
return Text('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}');
} else { } else {
final accessHistory = snapshot.data!; final accessHistory = snapshot.data!;
debugPrint('Access History: $accessHistory'); log('Access History: $accessHistory');
return ListView.builder( return ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemCount: accessHistory.length, itemCount: accessHistory.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final accessHistoryItem = accessHistory[index]; final accessHistoryItem = accessHistory[index];
debugPrint( log(
'Access History Item: ${accessHistoryItem['PES_TIPO']}'); 'Access History Item: ${accessHistoryItem['PES_TIPO']}');
return _accessHistoryCardMoleculeWidget( return _accessHistoryCardMoleculeWidget(
context, accessHistoryItem); context, accessHistoryItem);
@ -306,7 +308,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
Widget _accessHistoryCardMoleculeWidget( Widget _accessHistoryCardMoleculeWidget(
BuildContext context, dynamic accessHistoryItem) { BuildContext context, dynamic accessHistoryItem) {
debugPrint('Access History Item: $accessHistoryItem'); log('Access History Item: $accessHistoryItem');
return CardItemTemplateComponentWidget( return CardItemTemplateComponentWidget(
imageHashMap: Map<String, String>.from({ imageHashMap: Map<String, String>.from({
'key': accessHistoryItem['PES_ID'] ?? '', 'key': accessHistoryItem['PES_ID'] ?? '',
@ -389,7 +391,7 @@ Widget _cardHeaderAtomWidget(BuildContext context, String urlImagem,
.replaceAll('"', ''); // Remove aspas .replaceAll('"', ''); // Remove aspas
// Debug: Imprime o valor de PES_TIPO ajustado // Debug: Imprime o valor de PES_TIPO ajustado
debugPrint('PES_TIPO FOR COLORING: $pesTipo'); log('PES_TIPO FOR COLORING: $pesTipo');
// Retorna a cor baseada na condição ajustada // Retorna a cor baseada na condição ajustada
return pesTipo == 'E' return pesTipo == 'E'

View File

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:f_r_e_hub/app_state.dart'; import 'package:f_r_e_hub/app_state.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
// import 'dart:js_interop'; // import 'dart:js_interop';
import 'dart:developer';
import 'package:f_r_e_hub/actions/actions.dart'; import 'package:f_r_e_hub/actions/actions.dart';
import 'package:f_r_e_hub/backend/push_notification/pushNotificationService.dart'; import 'package:f_r_e_hub/backend/push_notification/pushNotificationService.dart';
import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
@ -357,7 +359,7 @@ Widget liberationHistoryItemCard(
_pushNotificationService.onMessageReceived.listen((received) { _pushNotificationService.onMessageReceived.listen((received) {
if (received.data['click_action'] == 'cancel_request') { if (received.data['click_action'] == 'cancel_request') {
debugPrint('Aprovado'); log('Aprovado');
_pushNotificationService.dispose(); _pushNotificationService.dispose();
snackbar(context, opt: true); snackbar(context, opt: true);
context.pushReplacementNamed( context.pushReplacementNamed(

View File

@ -1,5 +1,7 @@
// import 'dart:js_interop'; // import 'dart:js_interop';
import 'dart:developer';
import 'package:f_r_e_hub/actions/actions.dart'; import 'package:f_r_e_hub/actions/actions.dart';
import 'package:f_r_e_hub/backend/push_notification/pushNotificationService.dart'; import 'package:f_r_e_hub/backend/push_notification/pushNotificationService.dart';
import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
@ -267,7 +269,7 @@ Widget liberationHistoryItemCard(
_pushNotificationService.onMessageReceived.listen((received) { _pushNotificationService.onMessageReceived.listen((received) {
if (received.data['click_action'] == 'cancel_request') { if (received.data['click_action'] == 'cancel_request') {
debugPrint('Aprovado'); log('Aprovado');
_pushNotificationService.dispose(); _pushNotificationService.dispose();
snackbar(context, opt: true); snackbar(context, opt: true);
context.pushReplacementNamed( context.pushReplacementNamed(

View File

@ -321,6 +321,8 @@ void dispose() {
final progress = snapshot.data!; final progress = snapshot.data!;
return CircularPercentIndicator( return CircularPercentIndicator(
percent: progress, percent: progress,
restartAnimation: true,
reverse: false,
radius: 30.0, radius: 30.0,
lineWidth: 7.0, lineWidth: 7.0,
animation: true, animation: true,

View File

@ -1,3 +1,5 @@
import 'dart:developer';
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';
import '/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart'; import '/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart';
@ -1953,7 +1955,7 @@ Widget visitHistory(
size: 24.0, size: 24.0,
), ),
onPressed: () { onPressed: () {
print('IconButton pressed ...'); log('IconButton pressed ...');
}, },
), ),
], ],

View File

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:f_r_e_hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart'; import 'package:f_r_e_hub/flutter_flow/flutter_flow_theme.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -51,7 +53,7 @@ class TestPage extends StatelessWidget {
imageHashMap: imageKeyValue, imageHashMap: imageKeyValue,
onTapCardItemAction: () async { onTapCardItemAction: () async {
// Ação ao tocar no card // Ação ao tocar no card
print('Card tapped'); log('Card tapped');
}, },
); );
}), }),

View File

@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:f_r_e_hub/pages/visit_history_page/visit_history_page_model.dart'; import 'package:f_r_e_hub/pages/visit_history_page/visit_history_page_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -223,7 +225,7 @@ Widget visitHistory(
size: 24.0, size: 24.0,
), ),
onPressed: () { onPressed: () {
print('IconButton pressed ...'); log('IconButton pressed ...');
}, },
), ),
], ],