From 7cd3431557e0f15b0859fa86b3ad0bf2bcafee4a Mon Sep 17 00:00:00 2001 From: FlutterFlow <140657486+FlutterFlowEng@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:12:16 +0000 Subject: [PATCH] Updating to latest --- ios/Runner.xcodeproj/project.pbxproj | 8 +- lib/actions/actions.dart | 3 + lib/backend/api_requests/api_calls.dart | 56 + lib/backend/api_requests/api_manager.dart | 48 +- .../api_requests/get_streamed_response.dart | 4 + lib/backend/schema/util/schema_util.dart | 8 - .../throw_exception_widget.dart | 123 +- .../schedule_visit_detail_widget.dart | 1 + .../view_visit_detail_widget.dart | 1 + ...ot_password_template_component_widget.dart | 1 + ...iter_vistor_template_component_widget.dart | 1 + ...sit_request_template_component_widget.dart | 163 +- ...earch_modal_template_component_widget.dart | 1 + lib/flutter_flow/flutter_flow_util.dart | 8 + lib/flutter_flow/flutter_flow_widgets.dart | 3 + lib/flutter_flow/form_field_controller.dart | 13 + lib/flutter_flow/internationalization.dart | 8 +- .../register_visitor_page_model.dart | 6 +- .../register_visitor_page_widget.dart | 1388 ++++++++--------- ...chedule_provisional_visit_page_widget.dart | 1 + 20 files changed, 964 insertions(+), 881 deletions(-) create mode 100644 lib/backend/api_requests/get_streamed_response.dart diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 9e279d76..cc6f4f2e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -44,8 +44,8 @@ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 6436409E27A31CD500820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; - 6436409A27A31CD000820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6436409227A31CD500820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; + 6436409227A31CD300820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ @@ -225,8 +225,8 @@ 6436409C27A31CD800820AF7 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 6436409E27A31CD500820AF7 /* pt */, - 6436409A27A31CD000820AF7 /* en */, + 6436409227A31CD500820AF7 /* pt */, + 6436409227A31CD300820AF7 /* en */, ); name = InfoPlist.strings; sourceTree = ""; diff --git a/lib/actions/actions.dart b/lib/actions/actions.dart index b123e885..eae7019a 100644 --- a/lib/actions/actions.dart +++ b/lib/actions/actions.dart @@ -112,6 +112,7 @@ Future singInActionApp( false, ), ); + if (PhpGroup.loginCall.error( (loginCall.jsonBody ?? ''), ) == @@ -215,6 +216,7 @@ Future signUpActionApp( false, ), ); + if (PhpGroup.registerCall.error( (registerCall.jsonBody ?? ''), ) == @@ -267,6 +269,7 @@ Future forgotPasswdAction( forgotPasswd = await PhpGroup.forgotPasswordCall.call( email: email, ); + if (PhpGroup.forgotPasswordCall.error( (forgotPasswd.jsonBody ?? ''), ) == diff --git a/lib/backend/api_requests/api_calls.dart b/lib/backend/api_requests/api_calls.dart index 2e3593d1..205c0de3 100644 --- a/lib/backend/api_requests/api_calls.dart +++ b/lib/backend/api_requests/api_calls.dart @@ -31,6 +31,8 @@ class PhpGroup { static GetVisitsCall getVisitsCall = GetVisitsCall(); static DeleteVisitCall deleteVisitCall = DeleteVisitCall(); static GetPessoasLocalCall getPessoasLocalCall = GetPessoasLocalCall(); + static RespondeSolicitacaoCall respondeSolicitacaoCall = + RespondeSolicitacaoCall(); } class LoginCall { @@ -62,6 +64,7 @@ class LoginCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -146,6 +149,7 @@ class RegisterCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -201,6 +205,7 @@ class ForgotPasswordCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -238,6 +243,7 @@ class GetLocalsCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -324,6 +330,7 @@ class PostScheduleVisitorCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -381,6 +388,7 @@ class PostScheduleVisitCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -438,6 +446,7 @@ class DebugCallCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -485,6 +494,7 @@ class GetScheduleVisitCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -755,6 +765,7 @@ class GetDadosCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -997,6 +1008,7 @@ class GetVisitorByDocCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -1066,6 +1078,7 @@ class GetFotoVisitanteCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -1106,6 +1119,7 @@ class PostProvVisitSchedulingCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -1147,6 +1161,7 @@ class GetVisitsCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -1407,6 +1422,7 @@ class DeleteVisitCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -1448,6 +1464,7 @@ class GetPessoasLocalCall { encodeBodyUtf8: false, decodeUtf8: false, cache: false, + isStreamingApi: false, alwaysAllowBody: false, ); } @@ -1481,6 +1498,45 @@ class GetPessoasLocalCall { .toList(); } +class RespondeSolicitacaoCall { + Future call({ + String? userUUID = '', + String? devUUID = '', + String? atividade = '', + String? referencia = '', + String? tarefa = '', + String? idDestino = '', + String? idVisitante = '', + }) async { + final baseUrl = PhpGroup.getBaseUrl(); + + return ApiManager.instance.makeApiCall( + callName: 'respondeSolicitacao', + apiUrl: '$baseUrl/processRequest.php', + callType: ApiCallType.POST, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + params: { + 'userUUID': userUUID, + 'devUUID': devUUID, + 'atividade': atividade, + 'referencia': referencia, + 'tarefa': tarefa, + 'idDestino': idDestino, + 'idVisitante': idVisitante, + }, + bodyType: BodyType.X_WWW_FORM_URL_ENCODED, + returnBody: true, + encodeBodyUtf8: false, + decodeUtf8: false, + cache: false, + isStreamingApi: false, + alwaysAllowBody: false, + ); + } +} + /// End PHP Group Code class ApiPagingParams { diff --git a/lib/backend/api_requests/api_manager.dart b/lib/backend/api_requests/api_manager.dart index 6c3a6d7c..1bb57424 100644 --- a/lib/backend/api_requests/api_manager.dart +++ b/lib/backend/api_requests/api_manager.dart @@ -13,6 +13,8 @@ import 'package:mime_type/mime_type.dart'; import '/flutter_flow/uploaded_file.dart'; +import 'get_streamed_response.dart'; + enum ApiCallType { GET, POST, @@ -43,6 +45,7 @@ class ApiCallOptions extends Equatable { this.decodeUtf8 = false, this.alwaysAllowBody = false, this.cache = false, + this.isStreamingApi = false, }); final String callName; @@ -57,6 +60,7 @@ class ApiCallOptions extends Equatable { final bool decodeUtf8; final bool alwaysAllowBody; final bool cache; + final bool isStreamingApi; ApiCallOptions clone() => ApiCallOptions( callName: callName, @@ -71,6 +75,7 @@ class ApiCallOptions extends Equatable { decodeUtf8: decodeUtf8, alwaysAllowBody: alwaysAllowBody, cache: cache, + isStreamingApi: isStreamingApi, ); @override @@ -87,6 +92,7 @@ class ApiCallOptions extends Equatable { decodeUtf8, alwaysAllowBody, cache, + isStreamingApi, ]; static Map _cloneMap(Map map) { @@ -104,12 +110,14 @@ class ApiCallResponse { this.headers, this.statusCode, { this.response, + this.streamedResponse, this.exception, }); final dynamic jsonBody; final Map headers; final int statusCode; final http.Response? response; + final http.StreamedResponse? streamedResponse; final Object? exception; // Whether we received a 2xx status (which generally marks success). bool get succeeded => statusCode >= 200 && statusCode < 300; @@ -183,7 +191,8 @@ class ApiManager { Map headers, Map params, bool returnBody, - bool decodeUtf8, { + bool decodeUtf8, + bool isStreamingApi, { http.Client? client, }) async { if (params.isNotEmpty) { @@ -191,6 +200,19 @@ class ApiManager { Uri.parse(apiUrl).queryParameters.isNotEmpty ? '&' : '?'; apiUrl = '$apiUrl$specifier${asQueryParams(params)}'; } + if (isStreamingApi) { + client ??= http.Client(); + final request = + http.Request(callType.toString().split('.').last, Uri.parse(apiUrl)) + ..headers.addAll(toStringMap(headers)); + final streamedResponse = await getStreamedResponse(request); + return ApiCallResponse( + null, + streamedResponse.headers, + streamedResponse.statusCode, + streamedResponse: streamedResponse, + ); + } final makeRequest = callType == ApiCallType.GET ? (client != null ? client.get : http.get) : (client != null ? client.delete : http.delete); @@ -209,7 +231,8 @@ class ApiManager { bool returnBody, bool encodeBodyUtf8, bool decodeUtf8, - bool alwaysAllowBody, { + bool alwaysAllowBody, + bool isStreamingApi, { http.Client? client, }) async { assert( @@ -219,6 +242,20 @@ class ApiManager { ); final postBody = createBody(headers, params, body, bodyType, encodeBodyUtf8); + if (isStreamingApi) { + client ??= http.Client(); + final request = + http.Request(type.toString().split('.').last, Uri.parse(apiUrl)) + ..headers.addAll(toStringMap(headers)); + request.body = postBody; + final streamedResponse = await getStreamedResponse(request); + return ApiCallResponse( + null, + streamedResponse.headers, + streamedResponse.statusCode, + streamedResponse: streamedResponse, + ); + } if (bodyType == BodyType.MULTIPART) { return multipartRequest(type, apiUrl, headers, params, returnBody, @@ -352,6 +389,7 @@ class ApiManager { decodeUtf8: options.decodeUtf8, alwaysAllowBody: options.alwaysAllowBody, cache: options.cache, + isStreamingApi: options.isStreamingApi, options: options, ); @@ -368,6 +406,7 @@ class ApiManager { bool decodeUtf8 = false, bool alwaysAllowBody = false, bool cache = false, + bool isStreamingApi = false, ApiCallOptions? options, http.Client? client, }) async { @@ -385,6 +424,7 @@ class ApiManager { decodeUtf8: decodeUtf8, alwaysAllowBody: alwaysAllowBody, cache: cache, + isStreamingApi: isStreamingApi, ); // Modify for your specific needs if this differs from your API. if (_accessToken != null) { @@ -411,6 +451,7 @@ class ApiManager { params, returnBody, decodeUtf8, + isStreamingApi, client: client, ); break; @@ -427,6 +468,7 @@ class ApiManager { encodeBodyUtf8, decodeUtf8, alwaysAllowBody, + isStreamingApi, client: client, ) : await urlRequest( @@ -436,6 +478,7 @@ class ApiManager { params, returnBody, decodeUtf8, + isStreamingApi, client: client, ); break; @@ -453,6 +496,7 @@ class ApiManager { encodeBodyUtf8, decodeUtf8, alwaysAllowBody, + isStreamingApi, client: client, ); break; diff --git a/lib/backend/api_requests/get_streamed_response.dart b/lib/backend/api_requests/get_streamed_response.dart new file mode 100644 index 00000000..1a53aab0 --- /dev/null +++ b/lib/backend/api_requests/get_streamed_response.dart @@ -0,0 +1,4 @@ +import 'package:http/http.dart'; + +Future getStreamedResponse(Request request) => + Client().send(request); diff --git a/lib/backend/schema/util/schema_util.dart b/lib/backend/schema/util/schema_util.dart index a074ea89..b2cd6af6 100644 --- a/lib/backend/schema/util/schema_util.dart +++ b/lib/backend/schema/util/schema_util.dart @@ -77,11 +77,3 @@ List? getColorsList(dynamic value) => List? getDataList(dynamic value) => value is! List ? null : value.map((e) => castToType(e)!).toList(); - -extension MapDataExtensions on Map { - Map get withoutNulls => Map.fromEntries( - entries - .where((e) => e.value != null) - .map((e) => MapEntry(e.key, e.value!)), - ); -} diff --git a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart index 684115dd..88b29e23 100644 --- a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart +++ b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart @@ -65,59 +65,84 @@ class _ThrowExceptionWidgetState extends State mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center, children: [ - Stack( - children: [ - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - Icons.circle_outlined, - color: FlutterFlowTheme.of(context).error, - size: 200.0, + Padding( + padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0), + child: Container( + height: 400.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(10.0), + bottomRight: Radius.circular(10.0), + topLeft: Radius.circular(10.0), + topRight: Radius.circular(10.0), ), ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - Icons.close_outlined, - color: FlutterFlowTheme.of(context).error, - size: 200.0, - ), - ), - ], - ).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!), - Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - FFLocalizations.of(context).getText( - 'e58xxxiq' /* ERRO */, - ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - fontSize: 20.0, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), - child: Text( - valueOrDefault( - widget.msg, - 'Message Not Found', - ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Stack( + children: [ + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Icon( + Icons.circle_outlined, + color: FlutterFlowTheme.of(context).error, + size: 200.0, + ), ), - ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Icon( + Icons.close_outlined, + color: FlutterFlowTheme.of(context).error, + size: 200.0, + ), + ), + ], + ).animateOnPageLoad(animationsMap['stackOnPageLoadAnimation']!), + Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + FFLocalizations.of(context).getText( + 'e58xxxiq' /* ERRO */, + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + fontSize: 20.0, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), + ), + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), + child: Text( + valueOrDefault( + widget.msg, + 'Message Not Found', + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ].addToStart(const SizedBox(height: 50.0)), + ), + ], ), - ].addToStart(const SizedBox(height: 50.0)), + ), ), ], ); diff --git a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart index dfbe87b8..7517473f 100644 --- a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart +++ b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart @@ -933,6 +933,7 @@ class _ScheduleVisitDetailWidgetState extends State { obs: widget.visitObsStr, cliID: FFAppState().cliUUID, ); + if (PhpGroup.postScheduleVisitCall.error( (_model.postScheduleVisit?.jsonBody ?? ''), ) == diff --git a/lib/components/organism_components/view_visit_detail/view_visit_detail_widget.dart b/lib/components/organism_components/view_visit_detail/view_visit_detail_widget.dart index a77958db..e7adf22f 100644 --- a/lib/components/organism_components/view_visit_detail/view_visit_detail_widget.dart +++ b/lib/components/organism_components/view_visit_detail/view_visit_detail_widget.dart @@ -793,6 +793,7 @@ class _ViewVisitDetailWidgetState extends State { atividade: 'cancelaVisita', idVisita: widget.visitIdStr, ); + if (PhpGroup.deleteVisitCall.error( (_model.deleteVisit?.jsonBody ?? ''), ) == diff --git a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart index f63bb7a2..246668f3 100644 --- a/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart +++ b/lib/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart @@ -242,6 +242,7 @@ class _ForgotPasswordTemplateComponentWidgetState _model.req = await PhpGroup.forgotPasswordCall.call( email: _model.emailAddressTextController.text, ); + shouldSetState = true; if (PhpGroup.forgotPasswordCall.error( (_model.req?.jsonBody ?? ''), diff --git a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart index 657e8187..4a00c919 100644 --- a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart +++ b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart @@ -722,6 +722,7 @@ class _RegisiterVistorTemplateComponentWidgetState : 'P', foto: 'base64;jpeg,klajsalkjslkajslkajl', ); + if (PhpGroup.postScheduleVisitorCall.error( (_model.registerVisitor?.jsonBody ?? ''), ) == diff --git a/lib/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart b/lib/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart index 88ab9f85..8da0e17a 100644 --- a/lib/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart +++ b/lib/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart @@ -11,16 +11,30 @@ export 'visit_request_template_component_model.dart'; class VisitRequestTemplateComponentWidget extends StatefulWidget { const VisitRequestTemplateComponentWidget({ super.key, - required this.name, - required this.reason, - required this.message, - required this.document, + required this.vteName, + required this.vteReason, + required this.vteMsg, + required this.vteDocument, + required this.cliUUID, + required this.vteUUID, + required this.vawName, + required this.msgUUID, + required this.vawRef, + required this.vawUUID, + required this.vawDestino, }); - final String? name; - final String? reason; - final String? message; - final String? document; + final String? vteName; + final String? vteReason; + final String? vteMsg; + final String? vteDocument; + final String? cliUUID; + final String? vteUUID; + final String? vawName; + final String? msgUUID; + final String? vawRef; + final String? vawUUID; + final String? vawDestino; @override State createState() => @@ -42,13 +56,13 @@ class _VisitRequestTemplateComponentWidgetState super.initState(); _model = createModel(context, () => VisitRequestTemplateComponentModel()); - _model.textController1 ??= TextEditingController(text: widget.name); + _model.textController1 ??= TextEditingController(text: widget.vteName); _model.textFieldFocusNode1 ??= FocusNode(); - _model.textController2 ??= TextEditingController(text: widget.reason); + _model.textController2 ??= TextEditingController(text: widget.vteReason); _model.textFieldFocusNode2 ??= FocusNode(); - _model.textController3 ??= TextEditingController(text: widget.message); + _model.textController3 ??= TextEditingController(text: widget.vteMsg); _model.textFieldFocusNode3 ??= FocusNode(); _model.textController4 ??= TextEditingController(); @@ -71,6 +85,7 @@ class _VisitRequestTemplateComponentWidgetState child: Padding( padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0), child: Container( + width: MediaQuery.sizeOf(context).width * 0.9, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).primaryBackground, borderRadius: const BorderRadius.only( @@ -90,17 +105,17 @@ class _VisitRequestTemplateComponentWidgetState mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - width: 200.0, - height: 200.0, + width: 150.0, + height: 150.0, clipBehavior: Clip.antiAlias, decoration: const BoxDecoration( shape: BoxShape.circle, ), child: CachedNetworkImage( - fadeInDuration: const Duration(milliseconds: 500), - fadeOutDuration: const Duration(milliseconds: 500), + fadeInDuration: const Duration(milliseconds: 100), + fadeOutDuration: const Duration(milliseconds: 100), imageUrl: valueOrDefault( - 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.document}&tipo=E', + 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.vteDocument}&tipo=E', 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', ), fit: BoxFit.cover, @@ -120,6 +135,7 @@ class _VisitRequestTemplateComponentWidgetState readOnly: true, obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( 'ivfw4j04' /* Nome */, ), @@ -143,34 +159,10 @@ class _VisitRequestTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).labelMediumFamily), ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + errorBorder: InputBorder.none, + focusedErrorBorder: InputBorder.none, suffixIcon: Icon( Icons.person, color: FlutterFlowTheme.of(context).accent1, @@ -184,6 +176,7 @@ class _VisitRequestTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).bodyMediumFamily), ), + textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, validator: @@ -200,6 +193,7 @@ class _VisitRequestTemplateComponentWidgetState readOnly: true, obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( 'ndzkqehm' /* Motivo */, ), @@ -223,34 +217,10 @@ class _VisitRequestTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).labelMediumFamily), ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + errorBorder: InputBorder.none, + focusedErrorBorder: InputBorder.none, suffixIcon: Icon( Icons.history_edu, color: FlutterFlowTheme.of(context).accent1, @@ -264,6 +234,7 @@ class _VisitRequestTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).bodyMediumFamily), ), + textAlign: TextAlign.start, maxLines: null, keyboardType: TextInputType.name, validator: @@ -281,6 +252,7 @@ class _VisitRequestTemplateComponentWidgetState readOnly: true, obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( 'kt87omsz' /* Mensagem */, ), @@ -303,34 +275,10 @@ class _VisitRequestTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).labelMediumFamily), ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + errorBorder: InputBorder.none, + focusedErrorBorder: InputBorder.none, suffixIcon: Icon( Icons.message, color: FlutterFlowTheme.of(context).accent1, @@ -344,12 +292,14 @@ class _VisitRequestTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).bodyMediumFamily), ), + textAlign: TextAlign.start, validator: _model.textController3Validator.asValidator(context), ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 20.0, 24.0, 20.0), child: TextFormField( controller: _model.textController4, focusNode: _model.textFieldFocusNode4, @@ -357,6 +307,7 @@ class _VisitRequestTemplateComponentWidgetState textInputAction: TextInputAction.next, obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( 'ssz899es' /* Pergunta */, ), @@ -433,9 +384,9 @@ class _VisitRequestTemplateComponentWidgetState borderRadius: 20.0, borderWidth: 1.0, buttonSize: 40.0, - fillColor: FlutterFlowTheme.of(context).success, + fillColor: FlutterFlowTheme.of(context).error, icon: Icon( - Icons.done, + Icons.close, color: FlutterFlowTheme.of(context).primaryBackground, size: 24.0, ), @@ -447,9 +398,9 @@ class _VisitRequestTemplateComponentWidgetState borderRadius: 20.0, borderWidth: 1.0, buttonSize: 40.0, - fillColor: FlutterFlowTheme.of(context).error, + fillColor: FlutterFlowTheme.of(context).success, icon: Icon( - Icons.close, + Icons.done, color: FlutterFlowTheme.of(context).primaryBackground, size: 24.0, ), @@ -460,7 +411,7 @@ class _VisitRequestTemplateComponentWidgetState ].divide(const SizedBox(width: 20.0)), ), ] - .divide(const SizedBox(height: 20.0)) + .divide(const SizedBox(height: 10.0)) .addToStart(const SizedBox(height: 20.0)) .addToEnd(const SizedBox(height: 20.0)), ), diff --git a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart index 635571cd..bbb89161 100644 --- a/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart +++ b/lib/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart @@ -107,6 +107,7 @@ class _VisitorSearchModalTemplateComponentWidgetState atividade: 'getVisitante', documento: _model.textController.text, ); + if (PhpGroup.getVisitorByDocCall.vistanteId( (_model.getVisitorByDoc?.jsonBody ?? ''), ) != diff --git a/lib/flutter_flow/flutter_flow_util.dart b/lib/flutter_flow/flutter_flow_util.dart index 20a3e9bf..443261e2 100644 --- a/lib/flutter_flow/flutter_flow_util.dart +++ b/lib/flutter_flow/flutter_flow_util.dart @@ -453,6 +453,14 @@ extension ListFilterExt on Iterable { List get withoutNulls => where((s) => s != null).map((e) => e!).toList(); } +extension MapFilterExtensions on Map { + Map get withoutNulls => Map.fromEntries( + entries + .where((e) => e.value != null) + .map((e) => MapEntry(e.key, e.value as T)), + ); +} + extension MapListContainsExt on List { bool containsMap(dynamic map) => map is Map ? any((e) => e is Map && const DeepCollectionEquality().equals(e, map)) diff --git a/lib/flutter_flow/flutter_flow_widgets.dart b/lib/flutter_flow/flutter_flow_widgets.dart index 6cfe3d67..64401b5f 100644 --- a/lib/flutter_flow/flutter_flow_widgets.dart +++ b/lib/flutter_flow/flutter_flow_widgets.dart @@ -4,6 +4,7 @@ import 'package:auto_size_text/auto_size_text.dart'; class FFButtonOptions { const FFButtonOptions({ + this.textAlign, this.textStyle, this.elevation, this.height, @@ -25,6 +26,7 @@ class FFButtonOptions { this.maxLines, }); + final TextAlign? textAlign; final TextStyle? textStyle; final double? elevation; final double? height; @@ -98,6 +100,7 @@ class _FFButtonWidgetState extends State { text ?? '', style: text == null ? null : widget.options.textStyle?.withoutColor(), + textAlign: widget.options.textAlign, maxLines: maxLines, overflow: TextOverflow.ellipsis, ); diff --git a/lib/flutter_flow/form_field_controller.dart b/lib/flutter_flow/form_field_controller.dart index adcd778e..b8020e3b 100644 --- a/lib/flutter_flow/form_field_controller.dart +++ b/lib/flutter_flow/form_field_controller.dart @@ -8,3 +8,16 @@ class FormFieldController extends ValueNotifier { void reset() => value = initialValue; void update() => notifyListeners(); } + +// If the initial value is a list (which it is for multiselect), +// we need to use this controller to avoid a pass by reference issue +// that can result in the initial value being modified. +class FormListFieldController extends FormFieldController> { + final List? _initialListValue; + + FormListFieldController(super.initialValue) + : _initialListValue = List.from(initialValue ?? []); + + @override + void reset() => value = List.from(_initialListValue ?? []); +} diff --git a/lib/flutter_flow/internationalization.dart b/lib/flutter_flow/internationalization.dart index 55b790ff..aefab2b9 100644 --- a/lib/flutter_flow/internationalization.dart +++ b/lib/flutter_flow/internationalization.dart @@ -174,6 +174,10 @@ final kTranslationsMap = >>[ 'pt': 'Nome', 'en': 'Name', }, + 'rl8tvwnr': { + 'pt': 'Documento', + 'en': 'Document', + }, 'yp23q90m': { 'pt': 'Selecione o tipo:', 'en': 'Select type:', @@ -194,10 +198,6 @@ final kTranslationsMap = >>[ 'pt': 'Search for an item...', 'en': '', }, - 'rl8tvwnr': { - 'pt': 'Documento', - 'en': 'Document', - }, 'bqpucwh0': { 'pt': 'Contatos', 'en': 'Contacts', diff --git a/lib/pages/register_visitor_page/register_visitor_page_model.dart b/lib/pages/register_visitor_page/register_visitor_page_model.dart index 81633e4d..08de852d 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_model.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_model.dart @@ -17,13 +17,13 @@ class RegisterVisitorPageModel FocusNode? textFieldFocusNode1; TextEditingController? textController1; String? Function(BuildContext, String?)? textController1Validator; - // State field(s) for DropDown widget. - String? dropDownValue; - FormFieldController? dropDownValueController; // State field(s) for TextField widget. FocusNode? textFieldFocusNode2; TextEditingController? textController2; String? Function(BuildContext, String?)? textController2Validator; + // State field(s) for DropDown widget. + String? dropDownValue; + FormFieldController? dropDownValueController; // State field(s) for TextField widget. FocusNode? textFieldFocusNode3; TextEditingController? textController3; diff --git a/lib/pages/register_visitor_page/register_visitor_page_widget.dart b/lib/pages/register_visitor_page/register_visitor_page_widget.dart index cc2dc749..d2fba231 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_widget.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_widget.dart @@ -67,6 +67,8 @@ class _RegisterVisitorPageWidgetState extends State { child: Align( alignment: const AlignmentDirectional(0.0, 1.0), child: Container( + width: double.infinity, + height: double.infinity, decoration: BoxDecoration( color: FlutterFlowTheme.of(context).primaryBackground, borderRadius: const BorderRadius.only( @@ -76,360 +78,171 @@ class _RegisterVisitorPageWidgetState extends State { topRight: Radius.circular(25.0), ), ), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 30.0, 0.0, 0.0), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, -1.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 0.0, 0.0, 20.0), - child: Text( - FFLocalizations.of(context).getText( - 'q8cct5lk' /* Cadastrar Visitante */, - ), - style: FlutterFlowTheme.of(context) - .bodyLarge - .override( - fontFamily: 'Nunito', - fontSize: 21.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w800, - useGoogleFonts: - GoogleFonts.asMap().containsKey('Nunito'), - ), - ), - ), - ), - Builder( - builder: (context) { - if ((_model.uploadedLocalFile.bytes?.isNotEmpty ?? - false)) { - return InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - setState(() { - _model.isDataUploading = false; - _model.uploadedLocalFile = FFUploadedFile( - bytes: Uint8List.fromList([])); - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(8.0), - child: Image.memory( - _model.uploadedLocalFile.bytes ?? - Uint8List.fromList([]), - width: 300.0, - height: 100.0, - fit: BoxFit.cover, - ), - ), - ); - } else { - return Stack( - children: [ - Align( - alignment: const AlignmentDirectional(0.01, 0.0), - child: FFButtonWidget( - onPressed: () async { - final selectedMedia = - await selectMediaWithSourceBottomSheet( - context: context, - maxWidth: 300.00, - maxHeight: 300.00, - imageQuality: 0, - allowPhoto: true, - includeDimensions: true, - ); - if (selectedMedia != null && - selectedMedia.every((m) => - validateFileFormat( - m.storagePath, context))) { - setState(() => - _model.isDataUploading = true); - var selectedUploadedFiles = - []; - - try { - showUploadMessage( - context, - 'Uploading file...', - showLoading: true, - ); - selectedUploadedFiles = selectedMedia - .map((m) => FFUploadedFile( - name: m.storagePath - .split('/') - .last, - bytes: m.bytes, - height: - m.dimensions?.height, - width: m.dimensions?.width, - blurHash: m.blurHash, - )) - .toList(); - } finally { - ScaffoldMessenger.of(context) - .hideCurrentSnackBar(); - _model.isDataUploading = false; - } - if (selectedUploadedFiles.length == - selectedMedia.length) { - setState(() { - _model.uploadedLocalFile = - selectedUploadedFiles.first; - }); - showUploadMessage( - context, 'Success!'); - } else { - setState(() {}); - showUploadMessage( - context, 'Failed to upload data'); - return; - } - } - }, - text: '', - icon: Icon( - Icons.photo_camera, - color: - FlutterFlowTheme.of(context).accent1, - size: 30.0, - ), - options: FFButtonOptions( - width: 300.0, - height: 80.0, - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 0.0), - iconPadding: - const EdgeInsetsDirectional.fromSTEB( - 14.0, 0.0, 0.0, 20.0), - color: FlutterFlowTheme.of(context) - .primaryBackground, - textStyle: FlutterFlowTheme.of(context) - .titleSmall - .override( - fontFamily: - FlutterFlowTheme.of(context) - .titleSmallFamily, - color: FlutterFlowTheme.of(context) - .primaryText, - fontSize: 16.0, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .titleSmallFamily), - ), - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(8.0), - ), - ), - ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 50.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - 'p4ftwxcy' /* Clique para adicionar a foto p... */, - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - color: FlutterFlowTheme.of(context) - .primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - ], - ); - } - }, - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 30.0, 0.0, 30.0), - child: Text( - FFLocalizations.of(context).getText( - 'zazj5d8b' /* Preencha o formulário com os d... */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Padding( + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, -1.0), + child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController1, - focusNode: _model.textFieldFocusNode1, - autofocus: false, - textInputAction: TextInputAction.next, - obscureText: false, - decoration: InputDecoration( - labelText: FFLocalizations.of(context).getText( - 'v7g73yik' /* Nome */, - ), - labelStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: - FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - hintStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: - FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.person, - color: FlutterFlowTheme.of(context).accent1, - ), + 20.0, 20.0, 0.0, 20.0), + child: Text( + FFLocalizations.of(context).getText( + 'q8cct5lk' /* Cadastrar Visitante */, ), style: FlutterFlowTheme.of(context) - .bodyMedium + .bodyLarge .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, + fontFamily: 'Nunito', + fontSize: 21.0, letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), + fontWeight: FontWeight.w800, + useGoogleFonts: + GoogleFonts.asMap().containsKey('Nunito'), ), - maxLines: null, - keyboardType: TextInputType.name, - validator: _model.textController1Validator - .asValidator(context), ), ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Container( - decoration: const BoxDecoration(), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 20.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 10.0, 20.0, 10.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - 'yp23q90m' /* Selecione o tipo: */, - ), - style: FlutterFlowTheme.of(context) - .bodyMedium + ), + Builder( + builder: (context) { + if ((_model.uploadedLocalFile.bytes?.isNotEmpty ?? + false)) { + return InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + setState(() { + _model.isDataUploading = false; + _model.uploadedLocalFile = FFUploadedFile( + bytes: Uint8List.fromList([])); + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Image.memory( + _model.uploadedLocalFile.bytes ?? + Uint8List.fromList([]), + width: 300.0, + height: 100.0, + fit: BoxFit.cover, + ), + ), + ); + } else { + return Stack( + children: [ + Align( + alignment: const AlignmentDirectional(0.01, 0.0), + child: FFButtonWidget( + onPressed: () async { + final selectedMedia = + await selectMediaWithSourceBottomSheet( + context: context, + maxWidth: 300.00, + maxHeight: 300.00, + imageQuality: 0, + allowPhoto: true, + includeDimensions: true, + ); + if (selectedMedia != null && + selectedMedia.every((m) => + validateFileFormat( + m.storagePath, context))) { + setState( + () => _model.isDataUploading = true); + var selectedUploadedFiles = + []; + + try { + showUploadMessage( + context, + 'Uploading file...', + showLoading: true, + ); + selectedUploadedFiles = selectedMedia + .map((m) => FFUploadedFile( + name: m.storagePath + .split('/') + .last, + bytes: m.bytes, + height: m.dimensions?.height, + width: m.dimensions?.width, + blurHash: m.blurHash, + )) + .toList(); + } finally { + ScaffoldMessenger.of(context) + .hideCurrentSnackBar(); + _model.isDataUploading = false; + } + if (selectedUploadedFiles.length == + selectedMedia.length) { + setState(() { + _model.uploadedLocalFile = + selectedUploadedFiles.first; + }); + showUploadMessage(context, 'Success!'); + } else { + setState(() {}); + showUploadMessage( + context, 'Failed to upload data'); + return; + } + } + }, + text: '', + icon: Icon( + Icons.photo_camera, + color: FlutterFlowTheme.of(context).accent1, + size: 30.0, + ), + options: FFButtonOptions( + width: 300.0, + height: 80.0, + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 0.0), + iconPadding: const EdgeInsetsDirectional.fromSTEB( + 14.0, 0.0, 0.0, 20.0), + color: FlutterFlowTheme.of(context) + .primaryBackground, + textStyle: FlutterFlowTheme.of(context) + .titleSmall .override( fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, + .titleSmallFamily, + color: FlutterFlowTheme.of(context) + .primaryText, + fontSize: 16.0, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() .containsKey( FlutterFlowTheme.of(context) - .bodyMediumFamily), + .titleSmallFamily), ), + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).accent1, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), ), ), - Padding( + ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 20.0, 0.0, 5.0), - child: FlutterFlowDropDown( - controller: - _model.dropDownValueController ??= - FormFieldController(null), - options: [ - FFLocalizations.of(context).getText( - 'n8vddmcq' /* Visitante */, - ), - FFLocalizations.of(context).getText( - '9luaa09e' /* Prestador de Serviço */, - ) - ], - onChanged: (val) => setState( - () => _model.dropDownValue = val), - width: 200.0, - height: 48.0, - textStyle: FlutterFlowTheme.of(context) + 0.0, 50.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context).getText( + 'p4ftwxcy' /* Clique para adicionar a foto p... */, + ), + style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: @@ -443,383 +256,523 @@ class _RegisterVisitorPageWidgetState extends State { FlutterFlowTheme.of(context) .bodyMediumFamily), ), - hintText: - FFLocalizations.of(context).getText( - 'pmezihb4' /* Selecione... */, - ), - icon: Icon( - Icons.keyboard_arrow_down_rounded, - color: FlutterFlowTheme.of(context) - .primaryText, - size: 24.0, - ), - elevation: 2.0, - borderColor: - FlutterFlowTheme.of(context).accent1, - borderWidth: 0.5, - borderRadius: 8.0, - margin: const EdgeInsetsDirectional.fromSTEB( - 16.0, 4.0, 16.0, 4.0), - hidesUnderline: true, - isOverButton: true, - isSearchable: false, - isMultiSelect: false, ), ), - ], - ), - ), - ), - ), - Padding( + ), + ], + ); + } + }, + ), + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController2, - focusNode: _model.textFieldFocusNode2, - autofocus: false, - textCapitalization: TextCapitalization.none, - textInputAction: TextInputAction.next, - obscureText: false, - decoration: InputDecoration( - labelText: FFLocalizations.of(context).getText( - 'rl8tvwnr' /* Documento */, - ), - labelStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: - FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - hintStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.document_scanner, - color: FlutterFlowTheme.of(context).accent1, - ), + 20.0, 30.0, 0.0, 15.0), + child: Text( + FFLocalizations.of(context).getText( + 'zazj5d8b' /* Preencha o formulário com os d... */, ), + textAlign: TextAlign.start, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: FlutterFlowTheme.of(context) .bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context) .bodyMediumFamily), ), - validator: _model.textController2Validator - .asValidator(context), ), ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 30.0, 0.0, 30.0), - child: Text( - FFLocalizations.of(context).getText( - 'bqpucwh0' /* Contatos */, + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController1, + focusNode: _model.textFieldFocusNode1, + autofocus: false, + textInputAction: TextInputAction.next, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + 'v7g73yik' /* Nome */, + ), + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent1, + width: 0.5, ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.person, + color: FlutterFlowTheme.of(context).accent1, ), ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + maxLines: null, + keyboardType: TextInputType.name, + validator: _model.textController1Validator + .asValidator(context), ), - Padding( + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController2, + focusNode: _model.textFieldFocusNode2, + autofocus: false, + textCapitalization: TextCapitalization.none, + textInputAction: TextInputAction.next, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + 'rl8tvwnr' /* Documento */, + ), + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent1, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.document_scanner, + color: FlutterFlowTheme.of(context).accent1, + ), + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + validator: _model.textController2Validator + .asValidator(context), + ), + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), + child: Container( + width: MediaQuery.sizeOf(context).width * 0.95, + decoration: const BoxDecoration(), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 7.0), + child: Text( + FFLocalizations.of(context).getText( + 'yp23q90m' /* Selecione o tipo: */, + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 5.0), + child: FlutterFlowDropDown( + controller: _model.dropDownValueController ??= + FormFieldController(null), + options: [ + FFLocalizations.of(context).getText( + 'n8vddmcq' /* Visitante */, + ), + FFLocalizations.of(context).getText( + '9luaa09e' /* Prestador de Serviço */, + ) + ], + onChanged: (val) => + setState(() => _model.dropDownValue = val), + width: 200.0, + height: 44.0, + textStyle: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + color: FlutterFlowTheme.of(context) + .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + hintText: FFLocalizations.of(context).getText( + 'pmezihb4' /* Selecione... */, + ), + icon: Icon( + Icons.keyboard_arrow_down_rounded, + color: + FlutterFlowTheme.of(context).primaryText, + size: 24.0, + ), + elevation: 2.0, + borderColor: + FlutterFlowTheme.of(context).accent1, + borderWidth: 0.5, + borderRadius: 8.0, + margin: const EdgeInsetsDirectional.fromSTEB( + 16.0, 0.0, 16.0, 0.0), + hidesUnderline: true, + isOverButton: true, + isSearchable: false, + isMultiSelect: false, + ), + ), + ] + .divide(const SizedBox(width: 19.0)) + .addToStart(const SizedBox(width: 30.0)), + ), + ), + ), + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController3, - focusNode: _model.textFieldFocusNode3, - autofocus: false, - textInputAction: TextInputAction.next, - obscureText: false, - decoration: InputDecoration( - labelText: FFLocalizations.of(context).getText( - 'h84ls2r6' /* Telefone */, - ), - labelStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: - FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - hintStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: - FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.phone, - color: FlutterFlowTheme.of(context).accent1, - ), + 20.0, 0.0, 0.0, 15.0), + child: Text( + FFLocalizations.of(context).getText( + 'bqpucwh0' /* Contatos */, ), + textAlign: TextAlign.start, style: FlutterFlowTheme.of(context) .bodyMedium .override( fontFamily: FlutterFlowTheme.of(context) .bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context) .bodyMediumFamily), ), - validator: _model.textController3Validator - .asValidator(context), ), ), - Padding( - padding: const EdgeInsets.all(24.0), - child: TextFormField( - controller: _model.textController4, - focusNode: _model.textFieldFocusNode4, - autofocus: false, - textInputAction: TextInputAction.done, - obscureText: false, - decoration: InputDecoration( - labelText: FFLocalizations.of(context).getText( - 'fqp7qmka' /* Email */, - ), - labelStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: - FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - hintStyle: FlutterFlowTheme.of(context) - .labelMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .labelMediumFamily, - color: - FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey(FlutterFlowTheme.of(context) - .labelMediumFamily), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.email, - color: FlutterFlowTheme.of(context).accent1, - ), + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController3, + focusNode: _model.textFieldFocusNode3, + autofocus: false, + textInputAction: TextInputAction.next, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + 'h84ls2r6' /* Telefone */, ), - style: FlutterFlowTheme.of(context) - .bodyMedium + labelStyle: FlutterFlowTheme.of(context) + .labelMedium .override( fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, + .labelMediumFamily, color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context) - .bodyMediumFamily), + .labelMediumFamily), ), - keyboardType: TextInputType.emailAddress, - validator: _model.textController4Validator - .asValidator(context), + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent1, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.phone, + color: FlutterFlowTheme.of(context).accent1, + ), ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + validator: _model.textController3Validator + .asValidator(context), ), - Align( - alignment: const AlignmentDirectional(0.0, 1.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 50.0, 0.0, 0.0), - child: FFButtonWidget( - onPressed: () async { - if (((_model.uploadedLocalFile.bytes - ?.isNotEmpty ?? - false)) && - (_model.textController1.text != '') && - (_model.dropDownValue != null && - _model.dropDownValue != '') && - (_model.textController2.text != '')) { - _model.imgBase64 = - await actions.convertImageFileToBase64( - _model.uploadedLocalFile, - ); - _model.scheduleVisitor = - await PhpGroup.postScheduleVisitorCall.call( - devUUID: FFAppState().devUUID, - userUUID: FFAppState().userUUID, - cliID: FFAppState().cliUUID, - atividade: 'putVisitante', - documento: '7654553234232342', - nome: 'Test', - tipo: 'V', - foto: 'base64;jpeg,klajsalkjslkajslkajl', - ); - if (PhpGroup.postScheduleVisitorCall.error( - (_model.scheduleVisitor?.jsonBody ?? ''), - ) == - false) { - setState(() { - _model.textController1?.clear(); - _model.textController2?.clear(); - _model.textController3?.clear(); - _model.textController4?.clear(); - }); - setState(() { - _model.dropDownValueController?.reset(); - }); - } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, - context: context, - builder: (context) { - return GestureDetector( - onTap: () => _model - .unfocusNode.canRequestFocus - ? FocusScope.of(context) - .requestFocus( - _model.unfocusNode) - : FocusScope.of(context).unfocus(), - child: Padding( - padding: - MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget( - msg: - '\\devUUID=${FFAppState().devUUID}\\userUUID=${FFAppState().userUUID}\\cliID=${FFAppState().cliUUID}\\Documento=${_model.textController2.text}\\Nome=${_model.textController1.text}\\dropdown${_model.dropDownValue}\\${PhpGroup.postScheduleVisitorCall.errorMsg( - (_model.scheduleVisitor - ?.jsonBody ?? - ''), - )}', - ), - ), - ); - }, - ).then((value) => safeSetState(() {})); - } + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController4, + focusNode: _model.textFieldFocusNode4, + autofocus: false, + textInputAction: TextInputAction.done, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + 'fqp7qmka' /* Email */, + ), + labelStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + hintStyle: FlutterFlowTheme.of(context) + .labelMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .labelMediumFamily), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent1, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.email, + color: FlutterFlowTheme.of(context).accent1, + ), + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + keyboardType: TextInputType.emailAddress, + validator: _model.textController4Validator + .asValidator(context), + ), + ), + Align( + alignment: const AlignmentDirectional(0.0, 1.0), + child: Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 50.0, 0.0, 0.0), + child: FFButtonWidget( + onPressed: () async { + if (((_model.uploadedLocalFile.bytes + ?.isNotEmpty ?? + false)) && + (_model.textController1.text != '') && + (_model.dropDownValue != null && + _model.dropDownValue != '') && + (_model.textController2.text != '')) { + _model.imgBase64 = + await actions.convertImageFileToBase64( + _model.uploadedLocalFile, + ); + _model.scheduleVisitor = + await PhpGroup.postScheduleVisitorCall.call( + devUUID: FFAppState().devUUID, + userUUID: FFAppState().userUUID, + cliID: FFAppState().cliUUID, + atividade: 'putVisitante', + documento: '7654553234232342', + nome: 'Test', + tipo: 'V', + foto: 'base64;jpeg,klajsalkjslkajslkajl', + ); + + if (PhpGroup.postScheduleVisitorCall.error( + (_model.scheduleVisitor?.jsonBody ?? ''), + ) == + false) { + setState(() { + _model.textController1?.clear(); + _model.textController2?.clear(); + _model.textController3?.clear(); + _model.textController4?.clear(); + }); + setState(() { + _model.dropDownValueController?.reset(); + }); } else { await showModalBottomSheet( isScrollControlled: true, @@ -838,55 +791,80 @@ class _RegisterVisitorPageWidgetState extends State { MediaQuery.viewInsetsOf(context), child: ThrowExceptionWidget( msg: - 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento estão foram preenchidos corretamente.- devUUID=${FFAppState().devUUID}- userUUID=${FFAppState().userUUID}- cliID=${FFAppState().cliUUID}- Documento=${_model.textController2.text}- Nome=${_model.textController1.text}- Tipo=${_model.dropDownValue}', + '\\devUUID=${FFAppState().devUUID}\\userUUID=${FFAppState().userUUID}\\cliID=${FFAppState().cliUUID}\\Documento=${_model.textController2.text}\\Nome=${_model.textController1.text}\\dropdown${_model.dropDownValue}\\${PhpGroup.postScheduleVisitorCall.errorMsg( + (_model.scheduleVisitor?.jsonBody ?? + ''), + )}', ), ), ); }, ).then((value) => safeSetState(() {})); } + } else { + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + enableDrag: false, + context: context, + builder: (context) { + return GestureDetector( + onTap: () => _model + .unfocusNode.canRequestFocus + ? FocusScope.of(context) + .requestFocus(_model.unfocusNode) + : FocusScope.of(context).unfocus(), + child: Padding( + padding: MediaQuery.viewInsetsOf(context), + child: ThrowExceptionWidget( + msg: + 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento estão foram preenchidos corretamente.- devUUID=${FFAppState().devUUID}- userUUID=${FFAppState().userUUID}- cliID=${FFAppState().cliUUID}- Documento=${_model.textController2.text}- Nome=${_model.textController1.text}- Tipo=${_model.dropDownValue}', + ), + ), + ); + }, + ).then((value) => safeSetState(() {})); + } - setState(() {}); - }, - text: FFLocalizations.of(context).getText( - 'okbw0aiu' /* Cadastrar */, + setState(() {}); + }, + text: FFLocalizations.of(context).getText( + 'okbw0aiu' /* Cadastrar */, + ), + options: FFButtonOptions( + width: 250.0, + height: 36.0, + padding: const EdgeInsetsDirectional.fromSTEB( + 80.0, 0.0, 80.0, 0.0), + iconPadding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 0.0), + color: FlutterFlowTheme.of(context).primary, + textStyle: FlutterFlowTheme.of(context) + .titleSmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .titleSmallFamily, + color: FlutterFlowTheme.of(context).info, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context) + .titleSmallFamily), + ), + borderSide: const BorderSide( + color: Colors.transparent, + width: 30.0, ), - options: FFButtonOptions( - width: double.infinity, - height: 36.0, - padding: const EdgeInsetsDirectional.fromSTEB( - 80.0, 0.0, 80.0, 0.0), - iconPadding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 0.0), - color: FlutterFlowTheme.of(context).primary, - textStyle: FlutterFlowTheme.of(context) - .titleSmall - .override( - fontFamily: FlutterFlowTheme.of(context) - .titleSmallFamily, - color: FlutterFlowTheme.of(context).info, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .titleSmallFamily), - ), - borderSide: const BorderSide( - color: Colors.transparent, - width: 30.0, - ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15.0), + bottomRight: Radius.circular(15.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), ), ), ), ), - ], - ), + ), + ].divide(const SizedBox(height: 10.0)), ), ), ), diff --git a/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart b/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart index a9a373ef..e072f5d5 100644 --- a/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart +++ b/lib/pages/schedule_provisional_visit_page/schedule_provisional_visit_page_widget.dart @@ -857,6 +857,7 @@ class _ScheduleProvisionalVisitPageWidgetState nome: _model.textController2.text, proID: FFAppState().ownerUUID, ); + if (PhpGroup.postProvVisitSchedulingCall.error( (_model.provisionalVisitScheduling?.jsonBody ?? ''), ) ==