Merge branch 'main' into bugfix/webview
This commit is contained in:
commit
d9781f21cd
|
@ -77,7 +77,7 @@ Future<Color> manageStatusColorAction(
|
|||
BuildContext context, {
|
||||
required String? visitStatusStr,
|
||||
}) async {
|
||||
debugPrint('visitStatusStr: $visitStatusStr');
|
||||
log('visitStatusStr: $visitStatusStr');
|
||||
if (visitStatusStr == 'A') {
|
||||
return FlutterFlowTheme.of(context).success;
|
||||
} else if ((visitStatusStr == 'C') ||
|
||||
|
@ -357,17 +357,17 @@ Future<bool> visitRequestComponentAction(
|
|||
if (respondeSolicitacaoCall.statusCode == 200) {
|
||||
return true;
|
||||
} else {
|
||||
debugPrint('headers: ${respondeSolicitacaoCall.headers}');
|
||||
debugPrint('bodyText: ${respondeSolicitacaoCall.bodyText}');
|
||||
debugPrint('jsonBody: ${respondeSolicitacaoCall.jsonBody}');
|
||||
debugPrint('userUUID: ${FFAppState().userUUID}');
|
||||
debugPrint('devUUID: ${FFAppState().devUUID}');
|
||||
debugPrint('cliUUID: ${FFAppState().cliUUID}');
|
||||
debugPrint('atividade: respondeSolicitacao');
|
||||
debugPrint('referencia: $refUUID');
|
||||
debugPrint('tarefa: $actionValue');
|
||||
debugPrint('resposta: $responseValue');
|
||||
debugPrint('idVisitante: $vteUUID');
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ Future<bool> checkLocals({
|
|||
|
||||
// Verificação rápida de erro para evitar processamento desnecessário.
|
||||
if (response.jsonBody['error']) {
|
||||
debugPrint("checkLocals => Erro encontrado na resposta");
|
||||
log("checkLocals => Erro encontrado na resposta");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -425,10 +425,10 @@ Future<bool> checkLocals({
|
|||
|
||||
// Log e retorno condicional baseado no resultado da busca.
|
||||
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;
|
||||
} 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.
|
||||
await showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
|
@ -458,7 +458,7 @@ Future changeStatusAction(
|
|||
String msg,
|
||||
String vteUUID,
|
||||
) async {
|
||||
debugPrint('status: $status');
|
||||
log('status: $status');
|
||||
|
||||
switch (status) {
|
||||
case 'L':
|
||||
|
@ -474,9 +474,9 @@ Future changeStatusAction(
|
|||
);
|
||||
if (!context.mounted) return;
|
||||
if (approveVisitRequest == true) {
|
||||
debugPrint('Aprovado');
|
||||
log('Aprovado');
|
||||
} else {
|
||||
debugPrint('Erro ao aprovar');
|
||||
log('Erro ao aprovar');
|
||||
}
|
||||
break;
|
||||
case 'B':
|
||||
|
@ -492,9 +492,9 @@ Future changeStatusAction(
|
|||
);
|
||||
if (!context.mounted) return;
|
||||
if (blockVisitRequest == true) {
|
||||
debugPrint('Bloqueado');
|
||||
log('Bloqueado');
|
||||
} else {
|
||||
debugPrint('Erro ao bloquear');
|
||||
log('Erro ao bloquear');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
|
@ -2297,7 +2298,7 @@ String _serializeList(List? list) {
|
|||
return json.encode(list, toEncodable: _toEncodable);
|
||||
} catch (_) {
|
||||
if (kDebugMode) {
|
||||
print("List serialization failed. Returning empty list.");
|
||||
log("List serialization failed. Returning empty list.");
|
||||
}
|
||||
return '[]';
|
||||
}
|
||||
|
@ -2309,7 +2310,7 @@ String _serializeJson(dynamic jsonVar, [bool isList = false]) {
|
|||
return json.encode(jsonVar, toEncodable: _toEncodable);
|
||||
} catch (_) {
|
||||
if (kDebugMode) {
|
||||
print("Json serialization failed. Returning empty json.");
|
||||
log("Json serialization failed. Returning empty json.");
|
||||
}
|
||||
return isList ? '[]' : '{}';
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
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/app_state.dart';
|
||||
|
@ -49,9 +50,9 @@ class PushNotificationService {
|
|||
sound: true,
|
||||
);
|
||||
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
|
||||
debugPrint('User granted permission');
|
||||
log('User granted permission');
|
||||
} 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
|
||||
return jsonDecode(correctedJson);
|
||||
} catch (e) {
|
||||
print('Error decoding JSON: $e');
|
||||
log('Error decoding JSON: $e');
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
@ -118,17 +119,17 @@ class PushNotificationService {
|
|||
_flutterLocalNotificationsPlugin.initialize(
|
||||
initializationSettings,
|
||||
onDidReceiveNotificationResponse: (NotificationResponse response) async {
|
||||
debugPrint('Response payload:${response.payload}');
|
||||
log('Response payload:${response.payload}');
|
||||
if (response.payload != null) {
|
||||
try {
|
||||
Map<String, dynamic> message =
|
||||
validJsonFromString(response.payload!);
|
||||
debugPrint('Notification payload: $message');
|
||||
log('Notification payload: $message');
|
||||
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'});
|
||||
} catch (e) {
|
||||
debugPrint('Error decoding notification payload: $e');
|
||||
log('Error decoding notification payload: $e');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -165,8 +166,8 @@ class PushNotificationService {
|
|||
|
||||
void _listenToForegroundMessages(BuildContext context) {
|
||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||
debugPrint('Got a message whilst in the foreground!');
|
||||
debugPrint('Message data: ${message.toMap()}');
|
||||
log('Got a message whilst in the foreground!');
|
||||
log('Message data: ${message.toMap()}');
|
||||
_onMessage.add(message);
|
||||
_notificationDetails.add(message.toMap()['notification']);
|
||||
_showNotification(message);
|
||||
|
@ -179,16 +180,16 @@ class PushNotificationService {
|
|||
|
||||
void _listenToNotificationClicks(BuildContext context) {
|
||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
||||
debugPrint('Notification clicked!');
|
||||
log('Notification clicked!');
|
||||
|
||||
_onMessage.add(message);
|
||||
debugPrint('Extra: ${message.notification?.body}');
|
||||
log('Extra: ${message.notification?.body}');
|
||||
NotificationHandler().handleMessage(message.data, context); });
|
||||
}
|
||||
|
||||
void configureTokenRefresh() {
|
||||
_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;
|
||||
final ApiCallResponse? response = await _updateTokenOnServer(token);
|
||||
if (_isTokenUpdateSuccessful(response)) {
|
||||
debugPrint('Token updated successfully on server. Token: $token');
|
||||
log('Token updated successfully on server. Token: $token');
|
||||
} else {
|
||||
debugPrint('Error updating token on server');
|
||||
log('Error updating token on server');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleTokenUpdate(String newToken) async {
|
||||
debugPrint('Token refreshed: $newToken');
|
||||
log('Token refreshed: $newToken');
|
||||
await _updateToken(newToken);
|
||||
}
|
||||
|
||||
|
@ -216,17 +217,17 @@ class PushNotificationService {
|
|||
|
||||
final String? deviceToken = await _firebaseMessaging.getToken();
|
||||
if (deviceToken != null) {
|
||||
debugPrint('Push Messaging token: $deviceToken');
|
||||
log('Push Messaging token: $deviceToken');
|
||||
await _updateToken(deviceToken);
|
||||
} else {
|
||||
debugPrint('Failed to get Firebase Messaging token');
|
||||
log('Failed to get Firebase Messaging token');
|
||||
}
|
||||
}
|
||||
|
||||
Future<NotificationSettings> _requestNotificationPermission() async {
|
||||
final NotificationSettings settings =
|
||||
await _firebaseMessaging.requestPermission();
|
||||
debugPrint(settings.authorizationStatus == AuthorizationStatus.authorized
|
||||
log(settings.authorizationStatus == AuthorizationStatus.authorized
|
||||
? 'User granted permission'
|
||||
: 'User declined or has not accepted permission');
|
||||
return settings;
|
||||
|
@ -235,7 +236,7 @@ class PushNotificationService {
|
|||
Future<void> _fetchAndLogApnsToken(NotificationSettings settings) async {
|
||||
if (settings.authorizationStatus == AuthorizationStatus.authorized) {
|
||||
final String? apnsToken = await _firebaseMessaging.getAPNSToken();
|
||||
debugPrint(apnsToken != null
|
||||
log(apnsToken != null
|
||||
? 'APNS Token: $apnsToken'
|
||||
: 'Failed to get APNS token');
|
||||
}
|
||||
|
@ -273,10 +274,10 @@ class PushNotificationService {
|
|||
var generalNotificationDetails =
|
||||
NotificationDetails(android: androidDetails, iOS: iOSDetails);
|
||||
|
||||
debugPrint('Showing notification: ${message.messageId.hashCode}');
|
||||
log('Showing notification: ${message.messageId.hashCode}');
|
||||
await _flutterLocalNotificationsPlugin.show(
|
||||
// DateTime.now().millisecondsSinceEpoch % (1 << 31),
|
||||
Random().nextInt(1 << 30),
|
||||
math.Random().nextInt(1 << 30),
|
||||
message.notification?.title,
|
||||
message.notification?.body,
|
||||
generalNotificationDetails,
|
||||
|
@ -288,13 +289,13 @@ class PushNotificationService {
|
|||
switch (payload.isNotEmpty) {
|
||||
case true:
|
||||
// Print the 'data' property
|
||||
debugPrint('Notification payload: $payload');
|
||||
debugPrint('Extra: $extra');
|
||||
log('Notification payload: $payload');
|
||||
log('Extra: $extra');
|
||||
// Handle the message data as needed
|
||||
NotificationHandler().handleMessage(payload, _context.value, extra: extra.isEmpty ? {} : extra);
|
||||
// Access the 'data' property of 'RemoteMessage'
|
||||
case false:
|
||||
debugPrint('Notification payload is empty');
|
||||
log('Notification payload is empty');
|
||||
// Handle the message notification as needed
|
||||
break;
|
||||
}
|
||||
|
@ -302,15 +303,15 @@ class PushNotificationService {
|
|||
|
||||
static Future<void> _firebaseMessagingBackgroundHandler(
|
||||
RemoteMessage message) async {
|
||||
debugPrint('Handling a background message: ${message.messageId}');
|
||||
log('Handling a background message: ${message.messageId}');
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationHandler {
|
||||
void handleMessage(Map<String, dynamic> message, BuildContext context, {Map<String, dynamic> extra = const {}}) {
|
||||
debugPrint('Notification Received!');
|
||||
log('Notification Received!');
|
||||
message.forEach((key, value) {
|
||||
debugPrint('$key: $value');
|
||||
log('$key: $value');
|
||||
});
|
||||
|
||||
switch (message['click_action']) {
|
||||
|
@ -327,10 +328,10 @@ class NotificationHandler {
|
|||
_showMessageNotificationDialog(message, context, extra);
|
||||
break;
|
||||
case 'enroll_cond':
|
||||
debugPrint('enroll_cond');
|
||||
log('enroll_cond');
|
||||
break;
|
||||
default:
|
||||
debugPrint('Notification type not recognized');
|
||||
log('Notification type not recognized');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,10 +351,10 @@ class NotificationHandler {
|
|||
|
||||
void _showAcessNotificationModal(
|
||||
Map<String, dynamic> message, BuildContext context) {
|
||||
debugPrint('Showing access notification dialog');
|
||||
debugPrint('USR_TIPO: ${message['USR_TIPO']}');
|
||||
debugPrint('USR_ID: ${message['USR_ID']}');
|
||||
debugPrint('USR_DOCUMENTO: ${message['USR_DOCUMENTO']}');
|
||||
log('Showing access notification dialog');
|
||||
log('USR_TIPO: ${message['USR_TIPO']}');
|
||||
log('USR_ID: ${message['USR_ID']}');
|
||||
log('USR_DOCUMENTO: ${message['USR_DOCUMENTO']}');
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
@ -379,8 +380,8 @@ class NotificationHandler {
|
|||
|
||||
void _showMessageNotificationDialog(
|
||||
Map<String, dynamic> message, BuildContext context, Map<String, dynamic> extra) {
|
||||
debugPrint('Showing message notification dialog');
|
||||
debugPrint('Notification "message": $message');
|
||||
log('Showing message notification dialog');
|
||||
log('Notification "message": $message');
|
||||
showDialog(
|
||||
useSafeArea: true,
|
||||
context: context,
|
||||
|
@ -401,7 +402,7 @@ class NotificationHandler {
|
|||
|
||||
void _showVisitRequestDialog(
|
||||
Map<String, dynamic> message, BuildContext context) {
|
||||
debugPrint('Showing visit request notification dialog');
|
||||
log('Showing visit request notification dialog');
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
// void openedAppVisitRequestNotification(
|
||||
// RemoteMessage message, BuildContext context) {
|
||||
// debugPrint('openedAppVisitRequestNotification');
|
||||
// log('openedAppVisitRequestNotification');
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
|
@ -55,9 +55,9 @@
|
|||
|
||||
// // Método para tratar mensagens recebidas
|
||||
// void handleMessage(RemoteMessage message, BuildContext context) {
|
||||
// debugPrint('Notification Received!');
|
||||
// log('Notification Received!');
|
||||
// message.data.forEach((key, value) {
|
||||
// debugPrint('$key: $value');
|
||||
// log('$key: $value');
|
||||
// });
|
||||
|
||||
// switch (message.data['type']) {
|
||||
|
@ -67,7 +67,7 @@
|
|||
// case '':
|
||||
// break;
|
||||
// default:
|
||||
// debugPrint('Notification type not recognized');
|
||||
// log('Notification type not recognized');
|
||||
// }
|
||||
// }
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import '/backend/api_requests/api_calls.dart';
|
||||
import '/flutter_flow/flutter_flow_theme.dart';
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
|
@ -136,19 +138,18 @@ class _BottomArrowLinkedLocalsComponentWidgetState
|
|||
setState(() {});
|
||||
FFAppState().ownerUUID = localItem['CLU_OWNER_ID'];
|
||||
setState(() {});
|
||||
debugPrint('Local: ${FFAppState().local}');
|
||||
log('Local: ${FFAppState().local}');
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
debugPrint('Local não disponível');
|
||||
debugPrint(localItem.toString());
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(
|
||||
// 'Local não disponível',
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
log('Local não disponível');
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Local não disponível',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
},
|
||||
child: Container(
|
||||
|
|
|
@ -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 '/flutter_flow/flutter_flow_theme.dart';
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
|
@ -10,7 +12,10 @@ import 'local_profile_component_model.dart';
|
|||
export 'local_profile_component_model.dart';
|
||||
|
||||
class LocalProfileComponentWidget extends StatefulWidget {
|
||||
const LocalProfileComponentWidget({super.key});
|
||||
const LocalProfileComponentWidget({
|
||||
required bool localStatus,
|
||||
super.key
|
||||
});
|
||||
|
||||
@override
|
||||
State<LocalProfileComponentWidget> createState() =>
|
||||
|
@ -44,104 +49,99 @@ class _LocalProfileComponentWidgetState
|
|||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
|
||||
return Visibility(
|
||||
visible: random_data.randomInteger(0, 10) != null,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: const AlignmentDirectional(0.0, -1.0),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
elevation: 0.0,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 119.0,
|
||||
decoration: BoxDecoration(
|
||||
return Container(
|
||||
decoration: const BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: const AlignmentDirectional(0.0, -1.0),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
elevation: 0.0,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 119.0,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF1AAB5F),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF1AAB5F),
|
||||
border: Border.all(
|
||||
color: const Color(0xFF1AAB5F),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
backgroundColor: const Color(0x00FFFFFF),
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Padding(
|
||||
padding: MediaQuery.viewInsetsOf(context),
|
||||
child: const SizedBox(
|
||||
height: double.infinity,
|
||||
child:
|
||||
BottomArrowLinkedLocalsComponentWidget(),
|
||||
),
|
||||
);
|
||||
},
|
||||
).then((value) => safeSetState(() {}));
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(200.0),
|
||||
child: Image.network(
|
||||
valueOrDefault<String>(
|
||||
'https://freaccess.com.br/freaccess/Images/Clients/${FFAppState().cliUUID}.png',
|
||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
focusColor: Colors.transparent,
|
||||
hoverColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
onTap: () async {
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
backgroundColor: const Color(0x00FFFFFF),
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Padding(
|
||||
padding: MediaQuery.viewInsetsOf(context),
|
||||
child: const SizedBox(
|
||||
height: double.infinity,
|
||||
child:
|
||||
BottomArrowLinkedLocalsComponentWidget(),
|
||||
),
|
||||
);
|
||||
},
|
||||
).then((value) => safeSetState(() {}));
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(200.0),
|
||||
child:
|
||||
Image.network(
|
||||
'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,
|
||||
height: 80.0,
|
||||
fit: BoxFit.cover,
|
||||
alignment: const Alignment(0.0, 0.0),
|
||||
errorBuilder: (context, error, stackTrace) =>
|
||||
Image.asset(
|
||||
'assets/images/error_image.svg',
|
||||
width: 80.0,
|
||||
height: 80.0,
|
||||
fit: BoxFit.cover,
|
||||
alignment: const Alignment(0.0, 0.0),
|
||||
),
|
||||
errorBuilder: (context, error, stackTrace) => Image.asset('assets/images/error_image.svg'),
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
valueOrDefault<String>(
|
||||
functions.convertToUppercase(FFAppState().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'),
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
valueOrDefault<String>(
|
||||
functions.convertToUppercase(FFAppState().local),
|
||||
'NOME DO LOCAL',
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
.divide(const SizedBox(width: 20.0))
|
||||
.addToStart(const SizedBox(width: 20.0))
|
||||
.addToEnd(const SizedBox(width: 20.0)),
|
||||
),
|
||||
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'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
.divide(const SizedBox(width: 20.0))
|
||||
.addToStart(const SizedBox(width: 20.0))
|
||||
.addToEnd(const SizedBox(width: 20.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
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/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:provider/provider.dart';
|
||||
|
||||
|
||||
class MessageWellComponentWidget extends StatefulWidget {
|
||||
const MessageWellComponentWidget({super.key});
|
||||
const MessageWellComponentWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<MessageWellComponentWidget> createState() =>
|
||||
_MessageWellComponentWidgetState();
|
||||
}
|
||||
|
||||
class _MessageWellComponentWidgetState extends State<MessageWellComponentWidget> {
|
||||
class _MessageWellComponentWidgetState
|
||||
extends State<MessageWellComponentWidget> {
|
||||
late ScrollController _listViewController;
|
||||
bool _allowScrollInSingleChildScrollView = true;
|
||||
|
||||
VoidCallback get _scrollListener => MessageWellNotifier()._scrollListener;
|
||||
final dropdownValueNotifier = ValueNotifier<String>('All'); // Using ValueNotifier for state management
|
||||
|
||||
late VoidCallback _scrollListener;
|
||||
final dropdownValueNotifier = ValueNotifier<String>('All');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_listViewController = ScrollController();
|
||||
_listViewController.addListener(_scrollListener); // Adicione esta linha
|
||||
// WidgetsBinding.instance?.addPostFrameCallback((_) {
|
||||
// context.read<MessageWellNotifier>().fetchMessages();
|
||||
// });
|
||||
_scrollListener = MessageWellNotifier()._scrollListener;
|
||||
_listViewController.addListener(_scrollListener);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -77,84 +74,80 @@ class _MessageWellComponentWidgetState extends State<MessageWellComponentWidget>
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
bool _buildScrollMessageListManager(ScrollNotification notification) {
|
||||
final notifier = context.read<MessageWellNotifier>();
|
||||
if (notification is ScrollUpdateNotification) {
|
||||
debugPrint('Scrolling ...');
|
||||
if (_listViewController.offset <= 0 && notification.scrollDelta! < 0) {
|
||||
debugPrint('Scrolling up ...');
|
||||
setState(() {
|
||||
_allowScrollInSingleChildScrollView = true;
|
||||
});
|
||||
} else {
|
||||
debugPrint('Scrolling down ...');
|
||||
if (_listViewController.position.extentAfter == 0) {
|
||||
debugPrint('Reached end of list. Incrementing pageNumber...');
|
||||
notifier.incrementPageNumber();
|
||||
bool _buildScrollMessageListManager(ScrollNotification notification) {
|
||||
final notifier = context.read<MessageWellNotifier>();
|
||||
if (notification is ScrollUpdateNotification) {
|
||||
log('Scrolling ...');
|
||||
if (_listViewController.offset <= 0 && notification.scrollDelta! < 0) {
|
||||
log('Scrolling up ...');
|
||||
setState(() {});
|
||||
} else {
|
||||
log('Scrolling down ...');
|
||||
if (_listViewController.position.extentAfter == 0) {
|
||||
log('Reached end of list. Incrementing pageNumber...');
|
||||
notifier.incrementPageNumber();
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
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);
|
||||
late String all = locations.getVariableText(enText: 'All', ptText: 'All');
|
||||
late String personal = locations.getVariableText(enText: 'Personal', ptText: 'Pessoal');
|
||||
late String global = locations.getVariableText(enText: 'Global', ptText: 'Global');
|
||||
|
||||
return SizedBox(
|
||||
key: UniqueKey(),
|
||||
width: 200,
|
||||
height: 40,
|
||||
child: ValueListenableBuilder<String>(
|
||||
valueListenable: dropdownValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return DropdownButtonFormField<String>(
|
||||
value: value,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: theme.primary, // Assuming FlutterFlowTheme.of(context).primary is the correct usage
|
||||
width: 2, // Adjusted width to a reasonable value
|
||||
return SizedBox(
|
||||
key: UniqueKey(),
|
||||
width: 200,
|
||||
height: 40,
|
||||
child: ValueListenableBuilder<String>(
|
||||
valueListenable: dropdownValueNotifier,
|
||||
builder: (context, value, child) {
|
||||
return DropdownButtonFormField<String>(
|
||||
value: value,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 10.0),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: theme.primary,
|
||||
width: 2,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
filled: true,
|
||||
fillColor: theme.primary,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: theme.primary,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
if (newValue != null) {
|
||||
// logger.log('DropDown value: $newValue'); // Assuming logger is correctly initialized elsewhere
|
||||
dropdownValueNotifier.value = newValue; // Update the ValueNotifier value
|
||||
}
|
||||
},
|
||||
items: [
|
||||
DropdownMenuItem<String>(value: all, child: Text(all)),
|
||||
DropdownMenuItem<String>(value: personal, child: Text(personal)),
|
||||
DropdownMenuItem<String>(value: global, child: Text(global)),
|
||||
],
|
||||
style: theme.labelMedium.override(
|
||||
fontFamily: theme.labelMediumFamily,
|
||||
color: theme.primaryText,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(theme.labelMediumFamily),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
onChanged: (String? newValue) {
|
||||
if (newValue != null) {
|
||||
dropdownValueNotifier.value = newValue;
|
||||
}
|
||||
},
|
||||
items: [
|
||||
DropdownMenuItem<String>(value: all, child: Text(all)),
|
||||
DropdownMenuItem<String>(value: personal, child: Text(personal)),
|
||||
DropdownMenuItem<String>(value: global, child: Text(global)),
|
||||
],
|
||||
style: theme.labelMedium.override(
|
||||
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(
|
||||
FFLocalizations.of(context).getText('8fworxmb'), // Mural de Mensagens
|
||||
FFLocalizations.of(context).getText('8fworxmb'),
|
||||
style: theme.bodyMedium.override(
|
||||
fontFamily: 'Nunito Sans',
|
||||
letterSpacing: 0.0,
|
||||
|
@ -163,81 +156,84 @@ Widget _buildMenuMessageWell(BuildContext context, FlutterFlowTheme theme, Value
|
|||
);
|
||||
}
|
||||
|
||||
Widget _buildMessageItem(BuildContext context, dynamic message, int index) {
|
||||
final theme = Theme.of(context);
|
||||
String formatMessageOrigin(String messageOrigin) {
|
||||
final words = messageOrigin.split(' ');
|
||||
final formattedWords = words.map((word) {
|
||||
final firstLetter = word.substring(0, 1).toUpperCase();
|
||||
final remainingLetters = word.substring(1).toLowerCase();
|
||||
return '$firstLetter$remainingLetters';
|
||||
});
|
||||
return formattedWords.join(' ');
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: () => print('Message tapped ...\nmessage[$index]: $message'),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: 127.0,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||
child: Container(
|
||||
width: 64.0,
|
||||
height: 64.0,
|
||||
decoration: const BoxDecoration(shape: BoxShape.circle),
|
||||
Widget _buildMessageItem(
|
||||
BuildContext context, dynamic message, int index) {
|
||||
final theme = Theme.of(context);
|
||||
String formatMessageOrigin(String messageOrigin) {
|
||||
final words = messageOrigin.split(' ');
|
||||
final formattedWords = words.map((word) {
|
||||
final firstLetter = word.substring(0, 1).toUpperCase();
|
||||
final remainingLetters = word.substring(1).toLowerCase();
|
||||
return '$firstLetter$remainingLetters';
|
||||
});
|
||||
return formattedWords.join(' ');
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () =>
|
||||
log('Message tapped ...\nmessage[$index]: $message'),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 5, 20, 5),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.9,
|
||||
height: 127.0,
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||
child: Container(
|
||||
width: 64.0,
|
||||
height: 64.0,
|
||||
decoration: const BoxDecoration(shape: BoxShape.circle),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 8.0),
|
||||
Center(
|
||||
child: Text(
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 8.0),
|
||||
Center(
|
||||
child: Text(
|
||||
'~ ${formatMessageOrigin(message['MSG_ORIGEM_DESC'].toString())}',
|
||||
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',
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
color: FlutterFlowTheme.of(context).primary,
|
||||
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 {
|
||||
|
@ -262,7 +258,9 @@ class MessageWellState {
|
|||
return MessageWellState(
|
||||
messages: messages ?? this.messages,
|
||||
pageNumber: pageNumber ?? this.pageNumber,
|
||||
allowScrollInSingleChildScrollView: allowScrollInSingleChildScrollView ?? this.allowScrollInSingleChildScrollView,
|
||||
allowScrollInSingleChildScrollView:
|
||||
allowScrollInSingleChildScrollView ??
|
||||
this.allowScrollInSingleChildScrollView,
|
||||
listViewController: listViewController ?? this.listViewController,
|
||||
);
|
||||
}
|
||||
|
@ -272,7 +270,10 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
|
|||
var totalPageNumber = 1;
|
||||
|
||||
MessageWellNotifier()
|
||||
: super(MessageWellState(messages: [], allowScrollInSingleChildScrollView: true, listViewController: ScrollController())) {
|
||||
: super(MessageWellState(
|
||||
messages: [],
|
||||
allowScrollInSingleChildScrollView: true,
|
||||
listViewController: ScrollController())) {
|
||||
state.listViewController.addListener(_scrollListener);
|
||||
fetchMessages();
|
||||
}
|
||||
|
@ -291,22 +292,25 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
|
|||
);
|
||||
if (response.statusCode == 200) {
|
||||
var messagesData = response.jsonBody['mensagens'];
|
||||
debugPrint('inputs: ${FFAppState().devUUID}, ${FFAppState().userUUID}, ${FFAppState().cliUUID}');
|
||||
debugPrint('response: ${response.jsonBody}');
|
||||
debugPrint('response[mensagens]: $messagesData');
|
||||
debugPrint('response[mensagens][0][MSG_TEXTO]: ${messagesData[0]['MSG_TEXTO']}');
|
||||
log('inputs: ${FFAppState().devUUID}, ${FFAppState().userUUID}, ${FFAppState().cliUUID}');
|
||||
log('response: ${response.jsonBody}');
|
||||
log('response[mensagens]: $messagesData');
|
||||
log('response[mensagens][0][MSG_TEXTO]: ${messagesData[0]['MSG_TEXTO']}');
|
||||
var newMessages = [...state.messages, ...messagesData];
|
||||
var rExp = RegExp(r'\d+').allMatches(newMessages.toString()).map((e) => e.group(0)).toList();
|
||||
debugPrint('rExp: $rExp');
|
||||
debugPrint('newMessages: $newMessages');
|
||||
var rExp = RegExp(r'\d+')
|
||||
.allMatches(newMessages.toString())
|
||||
.map((e) => e.group(0))
|
||||
.toList();
|
||||
log('rExp: $rExp');
|
||||
log('newMessages: $newMessages');
|
||||
state = state.copyWith(messages: newMessages);
|
||||
totalPageNumber = int.parse(response.jsonBody['total_pages']);
|
||||
debugPrint('totalPageNumber: $totalPageNumber');
|
||||
log('totalPageNumber: $totalPageNumber');
|
||||
} else {
|
||||
debugPrint('Error fetching messages: ${response.statusCode}');
|
||||
log('Error fetching messages: ${response.statusCode}');
|
||||
}
|
||||
} 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.pageNumber <= totalPageNumber) {
|
||||
state = state.copyWith(pageNumber: state.pageNumber + 1);
|
||||
debugPrint('state.pageNumber: ${state.pageNumber}');
|
||||
log('state.pageNumber: ${state.pageNumber}');
|
||||
fetchMessages();
|
||||
}
|
||||
}
|
||||
|
@ -329,22 +333,16 @@ class MessageWellNotifier extends StateNotifier<MessageWellState> {
|
|||
state.listViewController.removeListener(_scrollListener);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
void incrementPageNumber() {
|
||||
if (state.pageNumber <= totalPageNumber) {
|
||||
state = state.copyWith(pageNumber: state.pageNumber + 1);
|
||||
debugPrint('state.pageNumber: ${state.pageNumber}');
|
||||
log('state.pageNumber: ${state.pageNumber}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mixin Logger {
|
||||
static void log(String message) {
|
||||
debugPrint('Logger: $message');
|
||||
}
|
||||
}
|
||||
|
||||
final messageWellProvider = StateNotifierProvider<MessageWellNotifier, MessageWellState>((ref) {
|
||||
final messageWellProvider =
|
||||
StateNotifierProvider<MessageWellNotifier, MessageWellState>((ref) {
|
||||
return MessageWellNotifier();
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:collection';
|
||||
import 'dart:developer';
|
||||
|
||||
import '/flutter_flow/flutter_flow_theme.dart';
|
||||
import '/flutter_flow/flutter_flow_util.dart';
|
||||
|
@ -69,7 +70,7 @@ class _CardItemTemplateComponentWidgetState
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.watch<FFAppState>();
|
||||
debugPrint('imageHashMap: ${widget.imageHashMap}');
|
||||
log('imageHashMap: ${widget.imageHashMap}');
|
||||
|
||||
return InkWell(
|
||||
splashColor: Colors.transparent,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import '/backend/api_requests/api_calls.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;
|
||||
} catch (e) {
|
||||
print("Error searching item: $e");
|
||||
log("Error searching item: $e");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -860,7 +861,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
|||
size: 24.0,
|
||||
),
|
||||
onPressed: () {
|
||||
print('IconButton pressed ...');
|
||||
log('IconButton pressed ...');
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Automatic FlutterFlow imports
|
||||
|
||||
|
||||
import '/backend/schema/structs/index.dart';
|
||||
import 'dart:developer';
|
||||
import '/backend/schema/enums/enums.dart';
|
||||
import '/actions/actions.dart' as action_blocks;
|
||||
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 '/flutter_flow/custom_functions.dart'; // Imports custom functions
|
||||
import 'package:flutter/material.dart';
|
||||
// Begin custom action code
|
||||
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
|
||||
Future<String?> getDevUUID() async {
|
||||
|
@ -19,22 +17,21 @@ Future<String?> getDevUUID() async {
|
|||
if (Platform.isIOS) {
|
||||
// import 'dart:io'
|
||||
var iosDeviceInfo = await deviceInfo.iosInfo;
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
||||
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
|
||||
} else if (Platform.isAndroid) {
|
||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||
print(AndroidDeviceInfo);
|
||||
// debugPrint('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
@ -44,22 +41,21 @@ Future<String?> getSerialNumber() async {
|
|||
if (Platform.isIOS) {
|
||||
// import 'dart:io'
|
||||
var iosDeviceInfo = await deviceInfo.iosInfo;
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.utsname.machine: ${iosDeviceInfo.utsname.machine}'); // e.g. "iPod7,1"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemName: ${iosDeviceInfo.systemName}'); // e.g. "iOS"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.systemVersion: ${iosDeviceInfo.systemVersion}'); // e.g. "13.3"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.model: ${iosDeviceInfo.model}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.localizedModel: ${iosDeviceInfo.localizedModel}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPlugin => iosDeviceInfo.identifierForVendor: ${iosDeviceInfo.identifierForVendor}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
||||
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
|
||||
} else if (Platform.isAndroid) {
|
||||
var androidDeviceInfo = await deviceInfo.androidInfo;
|
||||
print(AndroidDeviceInfo);
|
||||
// debugPrint('Running on ${androidDeviceInfo.androidId}'); // e.g. "A8E9F7C8-4D1F-4D97-9C3B-3A3D0F0F3E9E"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.model: ${androidDeviceInfo.model}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.manufacturer: ${androidDeviceInfo.manufacturer}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.product: ${androidDeviceInfo.product}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.device: ${androidDeviceInfo.device}'); // e.g. "iPhone"
|
||||
debugPrint('DeviceInfoPLugin => androidDeviceInfo.id: ${androidDeviceInfo.id}'); // e.g. "iPhone"
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class _ImageCropperState extends State<ImageCropper> {
|
|||
final path = _getStoragePath(_firebasePathPrefix(),
|
||||
widget.imageFile!.name!, false, 0);
|
||||
uploadData(path, image).then((value) {
|
||||
print('image cropped');
|
||||
log('image cropped');
|
||||
widget.callBackAction!.call(value!);
|
||||
loading = false;
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ class _ImageCropperState extends State<ImageCropper> {
|
|||
setState(() {
|
||||
loading = true;
|
||||
});
|
||||
print('Button pressed ...');
|
||||
log('Button pressed ...');
|
||||
_crop_controller.crop();
|
||||
|
||||
//widget.loading = true;
|
||||
|
|
|
@ -113,7 +113,7 @@ Stream<double> getProgressValue() {
|
|||
return Stream.periodic(duration, (int count) {
|
||||
final currentTime = DateTime.now().millisecondsSinceEpoch;
|
||||
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;
|
||||
});
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
@ -83,7 +84,7 @@ String? serializeParam(
|
|||
}
|
||||
return data;
|
||||
} catch (e) {
|
||||
print('Error serializing parameter: $e');
|
||||
log('Error serializing parameter: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +225,7 @@ dynamic deserializeParam<T>(
|
|||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
print('Error deserializing parameter: $e');
|
||||
log('Error deserializing parameter: $e');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
@ -51,7 +53,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
_AcessHistoryPageWidgetState(Map<String, String> opt)
|
||||
: selectedTypeSubject = BehaviorSubject.seeded(opt) {
|
||||
selectedTypeSubject.listen((value) {
|
||||
print("selectedTypeSubject changed: $value");
|
||||
log("selectedTypeSubject changed: $value");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -59,7 +61,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
_model = createModel(context, () => AcessHistoryPageModel());
|
||||
debugPrint("initState called in _AcessHistoryPageWidgetState");
|
||||
log("initState called in _AcessHistoryPageWidgetState");
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -126,7 +128,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
}
|
||||
|
||||
Widget _appBarFilterButtonAtomWidget(BuildContext context) {
|
||||
debugPrint('selectedTypeSubject: ${selectedTypeSubject.value}');
|
||||
log('selectedTypeSubject: ${selectedTypeSubject.value}');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
|
@ -148,7 +150,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
);
|
||||
|
||||
if (selectedFilter != null) {
|
||||
debugPrint('Selected Filter: $selectedFilter');
|
||||
log('Selected Filter: $selectedFilter');
|
||||
_updateAccessHistoryAction(selectedFilter);
|
||||
}
|
||||
},
|
||||
|
@ -170,14 +172,14 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
});
|
||||
if (needsUpdate) {
|
||||
selectedTypeSubject.add(updatedType);
|
||||
print("updateAccessHistory called with newType: $newType");
|
||||
log("updateAccessHistory called with newType: $newType");
|
||||
safeSetState(() {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Stream<ApiCallResponse> fetchAccessHistoryService(String selectedType) {
|
||||
debugPrint('Calling API with type: $selectedType');
|
||||
log('Calling API with type: $selectedType');
|
||||
switch (selectedType) {
|
||||
case 'E':
|
||||
return _model.accessHistory(
|
||||
|
@ -239,13 +241,13 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
|
||||
Future<List<dynamic>> fetchCardListViewService(
|
||||
Map<String, String> select) async {
|
||||
debugPrint('Fetching access history');
|
||||
log('Fetching access history');
|
||||
final response =
|
||||
await fetchAccessHistoryService(select['personType']!).first;
|
||||
debugPrint('Response: ${response.jsonBody}');
|
||||
log('Response: ${response.jsonBody}');
|
||||
final List<dynamic> accessHistory = response.jsonBody['acessos'] ?? [];
|
||||
debugPrint('Access History Before Filtering: $accessHistory');
|
||||
debugPrint(
|
||||
log('Access History Before Filtering: $accessHistory');
|
||||
log(
|
||||
'Filtering for: Person Type - ${select['personType']}, Access Type - ${select['accessType']}, Search - ${select['search']}');
|
||||
|
||||
return accessHistory.where((item) {
|
||||
|
@ -258,20 +260,20 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
.toString()
|
||||
.toLowerCase()
|
||||
.contains(select['search']!.toLowerCase());
|
||||
debugPrint('NOMES: ${item["PES_NOME"].toString().toLowerCase()}');
|
||||
log('NOMES: ${item["PES_NOME"].toString().toLowerCase()}');
|
||||
return personTypeMatches && accessTypeMatches && searchMatches;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
Widget _cardListViewOrganismWidget(Map<String, String> selected) {
|
||||
debugPrint(
|
||||
log(
|
||||
'Selected types in Card: ${selected['personType']}, ${selected['accessType']}');
|
||||
debugPrint('_buildAccessHistoryList called');
|
||||
log('_buildAccessHistoryList called');
|
||||
return FutureBuilder<List<dynamic>>(
|
||||
future: fetchCardListViewService(selected),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
debugPrint('Waiting for data');
|
||||
log('Waiting for data');
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 50.0,
|
||||
|
@ -286,14 +288,14 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
return Text('Error: ${snapshot.error}');
|
||||
} else {
|
||||
final accessHistory = snapshot.data!;
|
||||
debugPrint('Access History: $accessHistory');
|
||||
log('Access History: $accessHistory');
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: accessHistory.length,
|
||||
itemBuilder: (context, index) {
|
||||
final accessHistoryItem = accessHistory[index];
|
||||
debugPrint(
|
||||
log(
|
||||
'Access History Item: ${accessHistoryItem['PES_TIPO']}');
|
||||
return _accessHistoryCardMoleculeWidget(
|
||||
context, accessHistoryItem);
|
||||
|
@ -306,7 +308,7 @@ class _AcessHistoryPageWidgetState extends State<AcessHistoryPageWidget> {
|
|||
|
||||
Widget _accessHistoryCardMoleculeWidget(
|
||||
BuildContext context, dynamic accessHistoryItem) {
|
||||
debugPrint('Access History Item: $accessHistoryItem');
|
||||
log('Access History Item: $accessHistoryItem');
|
||||
return CardItemTemplateComponentWidget(
|
||||
imageHashMap: Map<String, String>.from({
|
||||
'key': accessHistoryItem['PES_ID'] ?? '',
|
||||
|
@ -389,7 +391,7 @@ Widget _cardHeaderAtomWidget(BuildContext context, String urlImagem,
|
|||
.replaceAll('"', ''); // Remove aspas
|
||||
|
||||
// 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
|
||||
return pesTipo == 'E'
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:f_r_e_hub/app_state.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,7 @@
|
|||
// import 'dart:js_interop';
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
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/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||
|
@ -357,7 +359,7 @@ Widget liberationHistoryItemCard(
|
|||
|
||||
_pushNotificationService.onMessageReceived.listen((received) {
|
||||
if (received.data['click_action'] == 'cancel_request') {
|
||||
debugPrint('Aprovado');
|
||||
log('Aprovado');
|
||||
_pushNotificationService.dispose();
|
||||
snackbar(context, opt: true);
|
||||
context.pushReplacementNamed(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// import 'dart:js_interop';
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
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/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
|
||||
|
@ -267,7 +269,7 @@ Widget liberationHistoryItemCard(
|
|||
|
||||
_pushNotificationService.onMessageReceived.listen((received) {
|
||||
if (received.data['click_action'] == 'cancel_request') {
|
||||
debugPrint('Aprovado');
|
||||
log('Aprovado');
|
||||
_pushNotificationService.dispose();
|
||||
snackbar(context, opt: true);
|
||||
context.pushReplacementNamed(
|
||||
|
|
|
@ -321,6 +321,8 @@ void dispose() {
|
|||
final progress = snapshot.data!;
|
||||
return CircularPercentIndicator(
|
||||
percent: progress,
|
||||
restartAnimation: true,
|
||||
reverse: false,
|
||||
radius: 30.0,
|
||||
lineWidth: 7.0,
|
||||
animation: true,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import '/backend/api_requests/api_calls.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';
|
||||
|
@ -1953,7 +1955,7 @@ Widget visitHistory(
|
|||
size: 24.0,
|
||||
),
|
||||
onPressed: () {
|
||||
print('IconButton pressed ...');
|
||||
log('IconButton pressed ...');
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -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/flutter_flow/flutter_flow_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -51,7 +53,7 @@ class TestPage extends StatelessWidget {
|
|||
imageHashMap: imageKeyValue,
|
||||
onTapCardItemAction: () async {
|
||||
// Ação ao tocar no card
|
||||
print('Card tapped');
|
||||
log('Card tapped');
|
||||
},
|
||||
);
|
||||
}),
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:developer';
|
||||
|
||||
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:flutter/material.dart';
|
||||
|
@ -223,7 +225,7 @@ Widget visitHistory(
|
|||
size: 24.0,
|
||||
),
|
||||
onPressed: () {
|
||||
print('IconButton pressed ...');
|
||||
log('IconButton pressed ...');
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue