diff --git a/lib/actions/actions.dart b/lib/actions/actions.dart index 6a41696d..d25a5939 100644 --- a/lib/actions/actions.dart +++ b/lib/actions/actions.dart @@ -77,7 +77,7 @@ Future 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 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 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 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: diff --git a/lib/backend/api_requests/api_calls.dart b/lib/backend/api_requests/api_calls.dart index c06a891a..0f820e03 100644 --- a/lib/backend/api_requests/api_calls.dart +++ b/lib/backend/api_requests/api_calls.dart @@ -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 ? '[]' : '{}'; } diff --git a/lib/backend/push_notification/pushNotificationService.dart b/lib/backend/push_notification/pushNotificationService.dart index 2b1c4886..79e6768f 100644 --- a/lib/backend/push_notification/pushNotificationService.dart +++ b/lib/backend/push_notification/pushNotificationService.dart @@ -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 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 _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 _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 _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 _firebaseMessagingBackgroundHandler( RemoteMessage message) async { - debugPrint('Handling a background message: ${message.messageId}'); + log('Handling a background message: ${message.messageId}'); } } class NotificationHandler { void handleMessage(Map message, BuildContext context, {Map 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 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 message, BuildContext context, Map 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 message, BuildContext context) { - debugPrint('Showing visit request notification dialog'); + log('Showing visit request notification dialog'); showDialog( context: context, builder: (BuildContext context) { diff --git a/lib/backend/push_notification/tapNotifcationActivity.dart b/lib/backend/push_notification/tapNotifcationActivity.dart index fbff80c0..1ee22050 100644 --- a/lib/backend/push_notification/tapNotifcationActivity.dart +++ b/lib/backend/push_notification/tapNotifcationActivity.dart @@ -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'); // } // } diff --git a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart index 4c36ecc3..825a6056 100644 --- a/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart +++ b/lib/components/organism_components/bottom_arrow_linked_locals_component/bottom_arrow_linked_locals_component_widget.dart @@ -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'; @@ -129,36 +131,27 @@ class _BottomArrowLinkedLocalsComponentWidgetState highlightColor: Colors.transparent, onTap: () async { - if (linkedLocals.any((local) => - local['CLI_ID'] == FFAppState().cliUUID && - local['CLU_STATUS'] == "A")) { - FFAppState().cliUUID = getJsonField( - localItem, - r'''$.CLI_ID''', - ).toString(); + if ( + linkedLocals.any((local) => local['CLU_STATUS'] == "A") + ) { + FFAppState().cliUUID = localItem['CLI_ID']; setState(() {}); - FFAppState().local = getJsonField( - localItem, - r'''$.CLI_NOME''', - ).toString(); + FFAppState().local = localItem['CLI_NOME']; setState(() {}); - FFAppState().ownerUUID = getJsonField( - localItem, - r'''$.CLU_OWNER_ID''', - ).toString(); + 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'); - // 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( diff --git a/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart b/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart index 80e43f30..d8b1aff4 100644 --- a/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart +++ b/lib/components/organism_components/local_profile_component/local_profile_component_widget.dart @@ -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 createState() => @@ -44,104 +49,99 @@ class _LocalProfileComponentWidgetState Widget build(BuildContext context) { context.watch(); - 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( - '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( - 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( + 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)), ), ), ), diff --git a/lib/components/organism_components/message_well_component/message_well_component_widget.dart b/lib/components/organism_components/message_well_component/message_well_component_widget.dart index c28173b5..67dcf5a9 100644 --- a/lib/components/organism_components/message_well_component/message_well_component_widget.dart +++ b/lib/components/organism_components/message_well_component/message_well_component_widget.dart @@ -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 createState() => _MessageWellComponentWidgetState(); } -class _MessageWellComponentWidgetState extends State { +class _MessageWellComponentWidgetState + extends State { late ScrollController _listViewController; - bool _allowScrollInSingleChildScrollView = true; - - VoidCallback get _scrollListener => MessageWellNotifier()._scrollListener; - final dropdownValueNotifier = ValueNotifier('All'); // Using ValueNotifier for state management - + late VoidCallback _scrollListener; + final dropdownValueNotifier = ValueNotifier('All'); @override void initState() { super.initState(); _listViewController = ScrollController(); - _listViewController.addListener(_scrollListener); // Adicione esta linha - // WidgetsBinding.instance?.addPostFrameCallback((_) { - // context.read().fetchMessages(); - // }); + _scrollListener = MessageWellNotifier()._scrollListener; + _listViewController.addListener(_scrollListener); } @override @@ -77,84 +74,80 @@ class _MessageWellComponentWidgetState extends State ); } - -bool _buildScrollMessageListManager(ScrollNotification notification) { - final notifier = context.read(); - 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(); + 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 dropdownValueNotifier) { + Widget _buildMenuMessageWell(BuildContext context, FlutterFlowTheme theme, + ValueNotifier 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( - valueListenable: dropdownValueNotifier, - builder: (context, value, child) { - return DropdownButtonFormField( - 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( + valueListenable: dropdownValueNotifier, + builder: (context, value, child) { + return DropdownButtonFormField( + 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(value: all, child: Text(all)), - DropdownMenuItem(value: personal, child: Text(personal)), - DropdownMenuItem(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(value: all, child: Text(all)), + DropdownMenuItem(value: personal, child: Text(personal)), + DropdownMenuItem(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 { 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 { ); 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 { 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 { 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((ref) { +final messageWellProvider = + StateNotifierProvider((ref) { return MessageWellNotifier(); }); diff --git a/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart b/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart index 3412babe..41c28eee 100644 --- a/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart +++ b/lib/components/templates_components/card_item_template_component/card_item_template_component_widget.dart @@ -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(); - debugPrint('imageHashMap: ${widget.imageHashMap}'); + log('imageHashMap: ${widget.imageHashMap}'); return InkWell( splashColor: Colors.transparent, diff --git a/lib/components/view_visit_detail/view_visit_detail_widget.dart b/lib/components/view_visit_detail/view_visit_detail_widget.dart index e457c963..0394cbcf 100644 --- a/lib/components/view_visit_detail/view_visit_detail_widget.dart +++ b/lib/components/view_visit_detail/view_visit_detail_widget.dart @@ -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? findVisitorById(List? 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 { size: 24.0, ), onPressed: () { - print('IconButton pressed ...'); + log('IconButton pressed ...'); }, ), ], diff --git a/lib/custom_code/actions/get_dev_u_u_i_d.dart b/lib/custom_code/actions/get_dev_u_u_i_d.dart index 356c7ec5..5424e4b3 100644 --- a/lib/custom_code/actions/get_dev_u_u_i_d.dart +++ b/lib/custom_code/actions/get_dev_u_u_i_d.dart @@ -19,22 +19,22 @@ Future 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(AndroidDeviceInfo); + // 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 +44,22 @@ Future 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(AndroidDeviceInfo); + // 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 } } diff --git a/lib/custom_code/widgets/image_cropper.dart b/lib/custom_code/widgets/image_cropper.dart index 459c718b..da1dbe23 100644 --- a/lib/custom_code/widgets/image_cropper.dart +++ b/lib/custom_code/widgets/image_cropper.dart @@ -58,7 +58,7 @@ class _ImageCropperState extends State { 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 { setState(() { loading = true; }); - print('Button pressed ...'); + log('Button pressed ...'); _crop_controller.crop(); //widget.loading = true; diff --git a/lib/flutter_flow/custom_functions.dart b/lib/flutter_flow/custom_functions.dart index e14fb884..066402f2 100644 --- a/lib/flutter_flow/custom_functions.dart +++ b/lib/flutter_flow/custom_functions.dart @@ -113,7 +113,7 @@ Stream 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; }); } \ No newline at end of file diff --git a/lib/flutter_flow/nav/serialization_util.dart b/lib/flutter_flow/nav/serialization_util.dart index 98fd266a..f9665c41 100644 --- a/lib/flutter_flow/nav/serialization_util.dart +++ b/lib/flutter_flow/nav/serialization_util.dart @@ -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( return null; } } catch (e) { - print('Error deserializing parameter: $e'); + log('Error deserializing parameter: $e'); return null; } } diff --git a/lib/pages/acess_history_page/acess_history_page_widget.dart b/lib/pages/acess_history_page/acess_history_page_widget.dart index e14cc3dd..ecbbdb94 100644 --- a/lib/pages/acess_history_page/acess_history_page_widget.dart +++ b/lib/pages/acess_history_page/acess_history_page_widget.dart @@ -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 { _AcessHistoryPageWidgetState(Map opt) : selectedTypeSubject = BehaviorSubject.seeded(opt) { selectedTypeSubject.listen((value) { - print("selectedTypeSubject changed: $value"); + log("selectedTypeSubject changed: $value"); }); } @@ -59,7 +61,7 @@ class _AcessHistoryPageWidgetState extends State { 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 { } 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 { ); if (selectedFilter != null) { - debugPrint('Selected Filter: $selectedFilter'); + log('Selected Filter: $selectedFilter'); _updateAccessHistoryAction(selectedFilter); } }, @@ -170,14 +172,14 @@ class _AcessHistoryPageWidgetState extends State { }); if (needsUpdate) { selectedTypeSubject.add(updatedType); - print("updateAccessHistory called with newType: $newType"); + log("updateAccessHistory called with newType: $newType"); safeSetState(() {}); } } } Stream 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 { Future> fetchCardListViewService( Map 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 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 { .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 selected) { - debugPrint( + log( 'Selected types in Card: ${selected['personType']}, ${selected['accessType']}'); - debugPrint('_buildAccessHistoryList called'); + log('_buildAccessHistoryList called'); return FutureBuilder>( 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 { 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 { Widget _accessHistoryCardMoleculeWidget( BuildContext context, dynamic accessHistoryItem) { - debugPrint('Access History Item: $accessHistoryItem'); + log('Access History Item: $accessHistoryItem'); return CardItemTemplateComponentWidget( imageHashMap: Map.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' diff --git a/lib/pages/fast_pass_page/fast_pass_page_widget.dart b/lib/pages/fast_pass_page/fast_pass_page_widget.dart index 7cef90c8..576fe8f1 100644 --- a/lib/pages/fast_pass_page/fast_pass_page_widget.dart +++ b/lib/pages/fast_pass_page/fast_pass_page_widget.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:f_r_e_hub/app_state.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher_string.dart'; @@ -53,13 +55,13 @@ class _FastPassPageWidgetState extends State { ..setJavaScriptMode(JavaScriptMode.unrestricted) ..setBackgroundColor(const Color(0x00000000)) ..setOnConsoleMessage((message) { - debugPrint('Console: ${message.message}'); + log('Console: ${message.message}'); }) ..setNavigationDelegate( NavigationDelegate( onProgress: (int progress) {}, onPageStarted: (String url) { - debugPrint('Page started: $url'); + log('Page started: $url'); final String token = "localStorage.setItem('fre-token', '\"${widget.freToken}\"');"; @@ -78,13 +80,13 @@ class _FastPassPageWidgetState extends State { _controller.runJavaScript(command); }, onPageFinished: (String url) { - debugPrint('Page finished: $url'); + log('Page finished: $url'); }, onWebResourceError: (WebResourceError error) { - debugPrint('Error: ${error.description}'); + log('Error: ${error.description}'); }, onNavigationRequest: (NavigationRequest request) { - debugPrint('Request: ${request.url}'); + log('Request: ${request.url}'); if (request.url.startsWith('http') || request.url.startsWith('https://api.whatsapp.com/send') || request.url.startsWith('https://wa.me')) { diff --git a/lib/pages/home_page/home_page_widget.dart b/lib/pages/home_page/home_page_widget.dart index c5ae5a0b..00cdc98e 100644 --- a/lib/pages/home_page/home_page_widget.dart +++ b/lib/pages/home_page/home_page_widget.dart @@ -1,4 +1,6 @@ // import 'package:f_r_e_hub/backend/push_notification/pushNotification.dart'; +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:flutter/material.dart'; @@ -28,26 +30,35 @@ class HomePageWidget extends StatefulWidget { class _HomePageWidgetState extends State { late HomePageModel _model; - + bool localStatus = false; final scaffoldKey = GlobalKey(); + + Future checkLocalStatus() async { + localStatus = await checkLocals( + context: context, + model: _model, + safeSetState: safeSetState, + ); + } + @override void initState() { super.initState(); _model = createModel(context, () => HomePageModel()); - - - SchedulerBinding.instance.addPostFrameCallback((_) async { - - await PushNotificationService().initialize(context); + - await checkLocals( - context: context, - model: _model, - safeSetState: safeSetState, - ); + + + @override + void initState() { + super.initState(); + checkLocalStatus(); + } + + // Rest of your code... if (FFAppState().cliUUID == null || FFAppState().cliUUID.isEmpty) { showModalBottomSheet( isScrollControlled: false, @@ -86,7 +97,6 @@ class _HomePageWidgetState extends State { @override Widget build(BuildContext context) { context.watch(); - return GestureDetector( onTap: () => _model.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode) @@ -94,855 +104,45 @@ class _HomePageWidgetState extends State { child: Scaffold( key: scaffoldKey, backgroundColor: FlutterFlowTheme.of(context).secondaryBackground, - drawer: SizedBox( - width: 750.0, - child: Drawer( - elevation: 16.0, - child: Container( - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - shape: BoxShape.rectangle, - ), - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: double.infinity, - decoration: const BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(5.0), - bottomRight: Radius.circular(5.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), - ), - shape: BoxShape.rectangle, - ), - child: Column( - mainAxisSize: MainAxisSize.max, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(30, 30, 10, 0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Flexible( - child: Container( - width: double.infinity, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: 50.0, - height: 50.0, - clipBehavior: Clip.antiAlias, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Image.network( - valueOrDefault( - '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', - ), - fit: BoxFit.cover, - ), - ), - Container( - width: 150.0, - child: Text( - valueOrDefault( - functions.convertToUppercase( - FFAppState().local), - 'NOME DO LOCAL', - ), - style: FlutterFlowTheme.of(context) - .bodyLarge - .override( - fontFamily: 'Nunito Sans', - color: - FlutterFlowTheme.of(context) - .primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.normal, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito Sans'), - ), - ), - ), - ].divide(const SizedBox(width: 20.0)), - ), - ), - ), - Container( - width: 50.0, - child: Container( - height: 30.0, - decoration: const BoxDecoration(), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Flexible( - child: FlutterFlowIconButton( - borderRadius: 100.0, - borderWidth: 1.0, - buttonSize: 40.0, - icon: Icon( - Icons.close_sharp, - color: FlutterFlowTheme.of(context) - .primary, - size: 20.0, - ), - onPressed: () async { - if (scaffoldKey.currentState! - .isDrawerOpen || - scaffoldKey.currentState! - .isEndDrawerOpen) { - Navigator.pop(context); - } - }, - ), - ), - ], - ), - ), - ), - ] - .divide(const SizedBox(width: 0.0)) - .around(const SizedBox(width: 0.0)), - ), - ), - ].addToStart(const SizedBox(height: 30.0)), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 10.0, 0.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Flexible( - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), - child: TextFormField( - controller: _model.textController, - focusNode: _model.textFieldFocusNode, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - isDense: true, - labelStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: FlutterFlowTheme.of(context) - .primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - alignLabelWithHint: false, - hintStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .customColor1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - errorBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - focusedErrorBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(2.0), - ), - prefixIcon: const Icon( - Icons.search_sharp, - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - validator: _model.textControllerValidator - .asValidator(context), - ), - ), - ), - ] - .addToStart(const SizedBox(width: 30.0)) - .addToEnd(const SizedBox(width: 30.0)), - ), - ), - Flexible( - child: Container( - width: double.infinity, - height: double.infinity, - decoration: const BoxDecoration(), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 10.0, 20.0, 10.0, 0.0), - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - mainAxisSize: MainAxisSize.max, - children: [ - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24.0), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40.0, - height: 40.0, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Icon( - FFIcons.kfast, - color: - FlutterFlowTheme.of(context) - .primary, - size: 20.0, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - 'dlaeicxd' /* Auto-Visita */, - ), - style: FlutterFlowTheme.of( - context) - .titleLarge - .override( - fontFamily: 'Nunito', - color: - FlutterFlowTheme.of( - context) - .primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito'), - ), - ), - ), - ), - Icon( - Icons.chevron_right_rounded, - color: FlutterFlowTheme.of(context) - .customColor1, - size: 24.0, - ), - ], - ), - ), - ), - ), - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24.0), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40.0, - height: 40.0, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Icon( - FFIcons.khome, - color: - FlutterFlowTheme.of(context) - .primary, - size: 24.0, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - '53jd930v' /* Condominio */, - ), - style: FlutterFlowTheme.of( - context) - .titleLarge - .override( - fontFamily: 'Nunito', - color: - FlutterFlowTheme.of( - context) - .primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito'), - ), - ), - ), - ), - Icon( - Icons.chevron_right_rounded, - color: FlutterFlowTheme.of(context) - .customColor1, - size: 24.0, - ), - ], - ), - ), - ), - ), - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24.0), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40.0, - height: 40.0, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Icon( - FFIcons.kpets, - color: - FlutterFlowTheme.of(context) - .primary, - size: 20.0, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - 'ptsx0rln' /* Cadastrar Pet */, - ), - style: FlutterFlowTheme.of( - context) - .titleLarge - .override( - fontFamily: 'Nunito', - color: - FlutterFlowTheme.of( - context) - .primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito'), - ), - ), - ), - ), - Icon( - Icons.chevron_right_rounded, - color: FlutterFlowTheme.of(context) - .customColor1, - size: 24.0, - ), - ], - ), - ), - ), - ), - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24.0), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40.0, - height: 40.0, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Icon( - FFIcons.kvector1, - color: - FlutterFlowTheme.of(context) - .primary, - size: 22.0, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - 'rgxgw626' /* Cadastrar Visitante */, - ), - style: FlutterFlowTheme.of( - context) - .titleLarge - .override( - fontFamily: 'Nunito', - color: - FlutterFlowTheme.of( - context) - .primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito'), - ), - ), - ), - ), - Icon( - Icons.chevron_right_rounded, - color: FlutterFlowTheme.of(context) - .customColor1, - size: 24.0, - ), - ], - ), - ), - ), - ), - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24.0), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40.0, - height: 40.0, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Icon( - FFIcons.kvector2, - color: - FlutterFlowTheme.of(context) - .primary, - size: 20.0, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - 'j2tn9lpw' /* QR Code de Acesso */, - ), - style: FlutterFlowTheme.of( - context) - .titleLarge - .override( - fontFamily: 'Nunito', - color: - FlutterFlowTheme.of( - context) - .primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito'), - ), - ), - ), - ), - Icon( - Icons.chevron_right_rounded, - color: FlutterFlowTheme.of(context) - .customColor1, - size: 24.0, - ), - ], - ), - ), - ), - ), - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24.0), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40.0, - height: 40.0, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Icon( - FFIcons.kvector3, - color: - FlutterFlowTheme.of(context) - .primary, - size: 20.0, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - '9weuwgs1' /* Histórico de Acesso */, - ), - style: FlutterFlowTheme.of( - context) - .titleLarge - .override( - fontFamily: 'Nunito', - color: - FlutterFlowTheme.of( - context) - .primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito'), - ), - ), - ), - ), - Icon( - Icons.chevron_right_rounded, - color: FlutterFlowTheme.of(context) - .customColor1, - size: 24.0, - ), - ], - ), - ), - ), - ), - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(24.0), - ), - child: Padding( - padding: const EdgeInsets.all(4.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 40.0, - height: 40.0, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Icon( - FFIcons.kvector1, - color: - FlutterFlowTheme.of(context) - .primary, - size: 20.0, - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - 'vuk5bjau' /* Agendar Visita */, - ), - style: FlutterFlowTheme.of( - context) - .titleLarge - .override( - fontFamily: 'Nunito', - color: - FlutterFlowTheme.of( - context) - .primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w500, - useGoogleFonts: - GoogleFonts.asMap() - .containsKey( - 'Nunito'), - ), - ), - ), - ), - Icon( - Icons.chevron_right_rounded, - color: FlutterFlowTheme.of(context) - .customColor1, - size: 24.0, - ), - ], - ), - ), - ), - ), - Divider( - thickness: 0.1, - color: - FlutterFlowTheme.of(context).customColor1, - ), - ], - ), - ], - ), - ), - ), - ), - FFButtonWidget( - onPressed: () async { - FFAppState().isLogged = false; - setState(() {}); + drawer: buildDrawer(context), + body: buildPage(context, localStatus), + ), + ); + } - context.goNamed( - 'welcomePage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); - }, - text: FFLocalizations.of(context).getText( - 'xx0db4wi' /* Sair */, - ), - options: FFButtonOptions( - height: 40.0, - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 0.0), - iconPadding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 0.0), - color: const Color(0x00D70000), - textStyle: - FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), - elevation: 0.0, - borderSide: const BorderSide( - width: 0.0, - ), - borderRadius: BorderRadius.circular(50.0), - ), - ), - ].addToEnd(const SizedBox(height: 64.0)), + Container buildPage(BuildContext context, bool localStatus) { + return Container( + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + ), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Wrap( + spacing: 0.0, + runSpacing: 0.0, + alignment: WrapAlignment.start, + crossAxisAlignment: WrapCrossAlignment.start, + direction: Axis.horizontal, + runAlignment: WrapAlignment.start, + verticalDirection: VerticalDirection.down, + clipBehavior: Clip.none, + children: [ + createHeader(context), + createLocal(localStatus), + createBody(), + ], ), - ), + ], ), ), - body: Container( - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - ), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Wrap( + ); + } + + Wrap createBody() { + return Wrap( spacing: 0.0, runSpacing: 0.0, alignment: WrapAlignment.start, @@ -952,201 +152,1032 @@ class _HomePageWidgetState extends State { verticalDirection: VerticalDirection.down, clipBehavior: Clip.none, children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Container( - width: 100.0, - height: 100.0, - decoration: const BoxDecoration( - color: Color(0xFF1AAB5F), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Align( + wrapWithModel( + model: _model.menuComponentModel, + updateCallback: () => setState(() {}), + child: const MenuComponentWidget(), + ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Provider( + create: (_) => MessageWellNotifier(), + child: wrapWithModel( + model: _model.messageWellComponentModel, + updateCallback: () => setState(() {}), + child: const MessageWellComponentWidget(), + ), + ), + ), + //footer + const SizedBox( + height: 100, + width: double.infinity, + ) + ], + ); + } + + Widget createLocal(bool localStatus) { + return wrapWithModel( + model: _model.localComponentModel, + updateCallback: () => setState(() {}), + child: LocalProfileComponentWidget( + localStatus: localStatus, + ), + ); + } + + Row createHeader(BuildContext context) { + return Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Container( + width: 100.0, + height: 100.0, + decoration: const BoxDecoration( + color: Color(0xFF1AAB5F), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Align( + alignment: + const AlignmentDirectional(0.0, 1.0), + child: Container( + height: 50.0, + decoration: const BoxDecoration(), + child: Align( alignment: - const AlignmentDirectional(0.0, 1.0), - child: Container( - height: 50.0, - decoration: const BoxDecoration(), - child: Align( - alignment: - const AlignmentDirectional(0.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: - const AlignmentDirectional( - -1.0, 0.0), - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, 0.0, 0.0, 0.0), - child: FlutterFlowIconButton( - borderRadius: 20.0, - borderWidth: 1.0, - buttonSize: 40.0, - fillColor: - FlutterFlowTheme.of(context) - .primary, - icon: const Icon( - Icons.menu_rounded, - color: Colors.white, - size: 28.0, - ), - onPressed: () async { - scaffoldKey.currentState! - .openDrawer(); - }, - ), + const AlignmentDirectional(0.0, 0.0), + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: + const AlignmentDirectional( + -1.0, 0.0), + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: FlutterFlowIconButton( + borderRadius: 20.0, + borderWidth: 1.0, + buttonSize: 40.0, + fillColor: + FlutterFlowTheme.of(context) + .primary, + icon: const Icon( + Icons.menu_rounded, + color: Colors.white, + size: 28.0, + ), + onPressed: () async { + scaffoldKey.currentState! + .openDrawer(); + }, + ), + ), + ), + Align( + alignment: + const AlignmentDirectional( + -1.0, 0.0), + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 60.0, 15.0, 0.0, 0.0), + child: ClipRRect( + borderRadius: + BorderRadius.circular(8.0), + child: Image.network( + 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/8r2vsbd9i03k/logo.png', + width: 50.0, + height: 200.0, + fit: BoxFit.none, ), ), - Align( - alignment: - const AlignmentDirectional( - -1.0, 0.0), - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 60.0, 15.0, 0.0, 0.0), - child: ClipRRect( - borderRadius: - BorderRadius.circular(8.0), - child: Image.network( - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/8r2vsbd9i03k/logo.png', - width: 50.0, - height: 200.0, - fit: BoxFit.none, - ), - ), + ), + ), + Align( + alignment: + const AlignmentDirectional( + 0.0, 0.0), + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 0.0, 15.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + 'rg9pzkpz' /* FRE ACCESS */, ), - ), - Align( - alignment: - const AlignmentDirectional( - 0.0, 0.0), - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 0.0, 15.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context) - .getText( - 'rg9pzkpz' /* FRE ACCESS */, - ), - style: - FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: + style: + FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + color: FlutterFlowTheme + .of(context) + .info, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( FlutterFlowTheme.of( context) - .bodyMediumFamily, - color: FlutterFlowTheme - .of(context) - .info, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - ), + .bodyMediumFamily), + ), ), - ], + ), ), - ), + ], ), ), - Align( + ), + ), + Align( + alignment: + const AlignmentDirectional(0.0, 1.0), + child: Container( + width: 100.0, + height: 50.0, + decoration: const BoxDecoration(), + child: Align( alignment: - const AlignmentDirectional(0.0, 1.0), - child: Container( - width: 100.0, - height: 50.0, - decoration: const BoxDecoration(), - child: Align( - alignment: - const AlignmentDirectional(1.0, 1.0), + const AlignmentDirectional(1.0, 1.0), + child: FlutterFlowIconButton( + borderRadius: 20.0, + borderWidth: 1.0, + buttonSize: 40.0, + icon: Icon( + Icons.notifications_sharp, + color: + FlutterFlowTheme.of(context).info, + size: 24.0, + ), + onPressed: () { + log('IconButton pressed ...'); + }, + ), + ), + ), + ), + ], + ), + ), + ), + ], + ); + } + + SizedBox buildDrawer(BuildContext context) { + return SizedBox( + width: 750.0, + child: Drawer( + elevation: 16.0, + child: Container( + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + shape: BoxShape.rectangle, + ), + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: double.infinity, + decoration: const BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(5.0), + bottomRight: Radius.circular(5.0), + topLeft: Radius.circular(0.0), + topRight: Radius.circular(0.0), + ), + shape: BoxShape.rectangle, + ), + child: Column( + mainAxisSize: MainAxisSize.max, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(30, 30, 10, 0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Flexible( + child: Container( + width: double.infinity, + decoration: const BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: 50.0, + height: 50.0, + clipBehavior: Clip.antiAlias, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Image.network( + valueOrDefault( + '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', + ), + fit: BoxFit.cover, + ), + ), + Container( + width: 150.0, + child: Text( + valueOrDefault( + functions.convertToUppercase( + FFAppState().local), + 'NOME DO LOCAL', + ), + style: FlutterFlowTheme.of(context) + .bodyLarge + .override( + fontFamily: 'Nunito Sans', + color: + FlutterFlowTheme.of(context) + .primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.normal, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito Sans'), + ), + ), + ), + ].divide(const SizedBox(width: 20.0)), + ), + ), + ), + Container( + width: 50.0, + child: Container( + height: 30.0, + decoration: const BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Flexible( child: FlutterFlowIconButton( - borderRadius: 20.0, + borderRadius: 100.0, borderWidth: 1.0, buttonSize: 40.0, icon: Icon( - Icons.notifications_sharp, - color: - FlutterFlowTheme.of(context).info, - size: 24.0, + Icons.close_sharp, + color: FlutterFlowTheme.of(context) + .primary, + size: 20.0, ), - onPressed: () { - print('IconButton pressed ...'); + onPressed: () async { + if (scaffoldKey.currentState! + .isDrawerOpen || + scaffoldKey.currentState! + .isEndDrawerOpen) { + Navigator.pop(context); + } }, ), ), + ], + ), + ), + ), + ] + .divide(const SizedBox(width: 0.0)) + .around(const SizedBox(width: 0.0)), + ), + ), + ].addToStart(const SizedBox(height: 30.0)), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 10.0, 0.0, 0.0), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Flexible( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), + child: TextFormField( + controller: _model.textController, + focusNode: _model.textFieldFocusNode, + autofocus: false, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + alignLabelWithHint: false, + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .customColor1, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + errorBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + focusedErrorBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(2.0), + ), + prefixIcon: const Icon( + Icons.search_sharp, + ), + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + validator: _model.textControllerValidator + .asValidator(context), + ), + ), + ), + ] + .addToStart(const SizedBox(width: 30.0)) + .addToEnd(const SizedBox(width: 30.0)), + ), + ), + Flexible( + child: Container( + width: double.infinity, + height: double.infinity, + decoration: const BoxDecoration(), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 10.0, 20.0, 10.0, 0.0), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + mainAxisSize: MainAxisSize.max, + children: [ + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24.0), + ), + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 40.0, + height: 40.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Icon( + FFIcons.kfast, + color: + FlutterFlowTheme.of(context) + .primary, + size: 20.0, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + 'dlaeicxd' /* Auto-Visita */, + ), + style: FlutterFlowTheme.of( + context) + .titleLarge + .override( + fontFamily: 'Nunito', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito'), + ), + ), + ), + ), + Icon( + Icons.chevron_right_rounded, + color: FlutterFlowTheme.of(context) + .customColor1, + size: 24.0, + ), + ], + ), ), ), - ], - ), + ), + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24.0), + ), + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 40.0, + height: 40.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Icon( + FFIcons.khome, + color: + FlutterFlowTheme.of(context) + .primary, + size: 24.0, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + '53jd930v' /* Condominio */, + ), + style: FlutterFlowTheme.of( + context) + .titleLarge + .override( + fontFamily: 'Nunito', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito'), + ), + ), + ), + ), + Icon( + Icons.chevron_right_rounded, + color: FlutterFlowTheme.of(context) + .customColor1, + size: 24.0, + ), + ], + ), + ), + ), + ), + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24.0), + ), + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 40.0, + height: 40.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Icon( + FFIcons.kpets, + color: + FlutterFlowTheme.of(context) + .primary, + size: 20.0, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + 'ptsx0rln' /* Cadastrar Pet */, + ), + style: FlutterFlowTheme.of( + context) + .titleLarge + .override( + fontFamily: 'Nunito', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito'), + ), + ), + ), + ), + Icon( + Icons.chevron_right_rounded, + color: FlutterFlowTheme.of(context) + .customColor1, + size: 24.0, + ), + ], + ), + ), + ), + ), + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24.0), + ), + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 40.0, + height: 40.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Icon( + FFIcons.kvector1, + color: + FlutterFlowTheme.of(context) + .primary, + size: 22.0, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + 'rgxgw626' /* Cadastrar Visitante */, + ), + style: FlutterFlowTheme.of( + context) + .titleLarge + .override( + fontFamily: 'Nunito', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito'), + ), + ), + ), + ), + Icon( + Icons.chevron_right_rounded, + color: FlutterFlowTheme.of(context) + .customColor1, + size: 24.0, + ), + ], + ), + ), + ), + ), + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24.0), + ), + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 40.0, + height: 40.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Icon( + FFIcons.kvector2, + color: + FlutterFlowTheme.of(context) + .primary, + size: 20.0, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + 'j2tn9lpw' /* QR Code de Acesso */, + ), + style: FlutterFlowTheme.of( + context) + .titleLarge + .override( + fontFamily: 'Nunito', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito'), + ), + ), + ), + ), + Icon( + Icons.chevron_right_rounded, + color: FlutterFlowTheme.of(context) + .customColor1, + size: 24.0, + ), + ], + ), + ), + ), + ), + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24.0), + ), + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 40.0, + height: 40.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Icon( + FFIcons.kvector3, + color: + FlutterFlowTheme.of(context) + .primary, + size: 20.0, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + '9weuwgs1' /* Histórico de Acesso */, + ), + style: FlutterFlowTheme.of( + context) + .titleLarge + .override( + fontFamily: 'Nunito', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito'), + ), + ), + ), + ), + Icon( + Icons.chevron_right_rounded, + color: FlutterFlowTheme.of(context) + .customColor1, + size: 24.0, + ), + ], + ), + ), + ), + ), + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(24.0), + ), + child: Padding( + padding: const EdgeInsets.all(4.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 40.0, + height: 40.0, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Icon( + FFIcons.kvector1, + color: + FlutterFlowTheme.of(context) + .primary, + size: 20.0, + ), + ), + Expanded( + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context) + .getText( + 'vuk5bjau' /* Agendar Visita */, + ), + style: FlutterFlowTheme.of( + context) + .titleLarge + .override( + fontFamily: 'Nunito', + color: + FlutterFlowTheme.of( + context) + .primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + fontWeight: + FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap() + .containsKey( + 'Nunito'), + ), + ), + ), + ), + Icon( + Icons.chevron_right_rounded, + color: FlutterFlowTheme.of(context) + .customColor1, + size: 24.0, + ), + ], + ), + ), + ), + ), + Divider( + thickness: 0.1, + color: + FlutterFlowTheme.of(context).customColor1, + ), + ], ), - ), - ], + ], + ), ), - wrapWithModel( - model: _model.localComponentModel, - updateCallback: () => setState(() {}), - child: const LocalProfileComponentWidget(), - ), - Wrap( - spacing: 0.0, - runSpacing: 0.0, - - alignment: WrapAlignment.start, - crossAxisAlignment: WrapCrossAlignment.start, - direction: Axis.horizontal, - runAlignment: WrapAlignment.start, - verticalDirection: VerticalDirection.down, - clipBehavior: Clip.none, - children: [ - wrapWithModel( - model: _model.menuComponentModel, - updateCallback: () => setState(() {}), - child: const MenuComponentWidget(), - ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Provider( - create: (_) => MessageWellNotifier(), - child: wrapWithModel( - model: _model.messageWellComponentModel, - updateCallback: () => setState(() {}), - child: const MessageWellComponentWidget(), - ), - ), - ), - //footer - const SizedBox( - height: 100, - width: double.infinity, - ) - ], - ), - ], + ), ), - ], + FFButtonWidget( + onPressed: () async { + FFAppState().isLogged = false; + setState(() {}); + + context.goNamed( + 'welcomePage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); + }, + text: FFLocalizations.of(context).getText( + 'xx0db4wi' /* Sair */, + ), + options: FFButtonOptions( + height: 40.0, + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 0.0), + iconPadding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 0.0), + color: const Color(0x00D70000), + textStyle: + FlutterFlowTheme.of(context).labelMedium.override( + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), + elevation: 0.0, + borderSide: const BorderSide( + width: 0.0, + ), + borderRadius: BorderRadius.circular(50.0), + ), + ), + ].addToEnd(const SizedBox(height: 64.0)), ), ), ), - ), - ); + ); } } diff --git a/lib/pages/liberation_history/liberation_history_widget.dart b/lib/pages/liberation_history/liberation_history_widget.dart index 4774b461..2799de6b 100644 --- a/lib/pages/liberation_history/liberation_history_widget.dart +++ b/lib/pages/liberation_history/liberation_history_widget.dart @@ -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( diff --git a/lib/pages/message_history_page/message_history_page_widget.dart b/lib/pages/message_history_page/message_history_page_widget.dart index 4bf6991f..00a96f6f 100644 --- a/lib/pages/message_history_page/message_history_page_widget.dart +++ b/lib/pages/message_history_page/message_history_page_widget.dart @@ -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( diff --git a/lib/pages/qr_code_page/qr_code_page_widget.dart b/lib/pages/qr_code_page/qr_code_page_widget.dart index 85910829..64e110ba 100644 --- a/lib/pages/qr_code_page/qr_code_page_widget.dart +++ b/lib/pages/qr_code_page/qr_code_page_widget.dart @@ -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, diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart index c5e5385d..d1a87520 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart @@ -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 ...'); }, ), ], diff --git a/lib/pages/test_page/test_page.dart b/lib/pages/test_page/test_page.dart index 12d5b661..522b0d2d 100644 --- a/lib/pages/test_page/test_page.dart +++ b/lib/pages/test_page/test_page.dart @@ -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'); }, ); }), diff --git a/lib/pages/visit_history_page/visit_history_page_widget.dart b/lib/pages/visit_history_page/visit_history_page_widget.dart index c80e917a..ad681eb1 100644 --- a/lib/pages/visit_history_page/visit_history_page_widget.dart +++ b/lib/pages/visit_history_page/visit_history_page_widget.dart @@ -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 ...'); }, ), ],