From 8eeda2d54b35fccf2b6db1bc97c2bff65372a4ca Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Mon, 29 Jul 2024 09:36:46 -0300 Subject: [PATCH 01/10] fix: add form validador --- lib/flutter_flow/upload_data.dart | 16 +- .../register_visitor_page_model.dart | 59 +- .../register_visitor_page_widget.dart | 1501 +++++++++-------- 3 files changed, 837 insertions(+), 739 deletions(-) diff --git a/lib/flutter_flow/upload_data.dart b/lib/flutter_flow/upload_data.dart index 6b6baf2b..917034cd 100644 --- a/lib/flutter_flow/upload_data.dart +++ b/lib/flutter_flow/upload_data.dart @@ -52,8 +52,8 @@ Future?> selectMediaWithSourceBottomSheet({ required bool allowPhoto, bool allowVideo = false, String pickerFontFamily = 'Roboto', - Color textColor = const Color(0xFF111417), - Color backgroundColor = const Color(0xFFF5F5F5), + // Color textColor = const Color(0xFF111417), + // Color backgroundColor = const Color(0xFFF5F5F5), bool includeDimensions = false, bool includeBlurHash = false, }) async { @@ -63,12 +63,12 @@ Future?> selectMediaWithSourceBottomSheet({ textAlign: TextAlign.center, style: GoogleFonts.getFont( pickerFontFamily, - color: textColor, + color: FlutterFlowTheme.of(context).primaryText, fontWeight: FontWeight.w600, fontSize: 20, ), ), - tileColor: backgroundColor, + tileColor: FlutterFlowTheme.of(context).primaryBackground, dense: false, onTap: () => Navigator.pop( context, @@ -77,7 +77,7 @@ Future?> selectMediaWithSourceBottomSheet({ ); final mediaSource = await showModalBottomSheet( context: context, - backgroundColor: backgroundColor, + backgroundColor: FlutterFlowTheme.of(context).primaryBackground, builder: (context) { return Column( mainAxisSize: MainAxisSize.min, @@ -91,13 +91,13 @@ Future?> selectMediaWithSourceBottomSheet({ textAlign: TextAlign.center, style: GoogleFonts.getFont( pickerFontFamily, - color: textColor.withOpacity(0.65), + color: FlutterFlowTheme.of(context).primaryText.withOpacity(0.65), fontWeight: FontWeight.w500, fontSize: 20, ), ), - tileColor: backgroundColor, - dense: false, + tileColor: FlutterFlowTheme.of(context).primaryBackground, + dense: true, ), ), const Divider(), 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 96b3252e..7c216c8d 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_model.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_model.dart @@ -17,10 +17,28 @@ class RegisterVisitorPageModel FocusNode? textFieldFocusNode1; TextEditingController? textController1; String? Function(BuildContext, String?)? textController1Validator; + String? _textController1Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + return null; + } // State field(s) for TextField widget. FocusNode? textFieldFocusNode2; TextEditingController? textController2; String? Function(BuildContext, String?)? textController2Validator; + String? _textController2Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + return null; + } // State field(s) for DropDown widget. String? dropDownValue; FormFieldController? dropDownValueController; @@ -28,17 +46,56 @@ class RegisterVisitorPageModel FocusNode? textFieldFocusNode3; TextEditingController? textController3; String? Function(BuildContext, String?)? textController3Validator; + String? _textController3Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + return null; + } // State field(s) for TextField widget. FocusNode? textFieldFocusNode4; TextEditingController? textController4; String? Function(BuildContext, String?)? textController4Validator; + String? _textController4Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + return null; + } // Stores action output result for [Custom Action - convertImageFileToBase64] action in Button widget. String? imgBase64; // Stores action output result for [Backend Call - API (postScheduleVisitor)] action in Button widget. ApiCallResponse? scheduleVisitor; @override - void initState(BuildContext context) {} + void initState(BuildContext context) { + + textFieldFocusNode1 = FocusNode(); + textController1 = TextEditingController(); + textController1Validator = _textController1Validator; + + textFieldFocusNode2 = FocusNode(); + textController2 = TextEditingController(); + textController2Validator = _textController2Validator; + + + dropDownValue = ''; + // dropDownValueController = FormFieldController(initialValue: dropDownValue); + + textFieldFocusNode3 = FocusNode(); + textController3 = TextEditingController(); + textController3Validator = _textController3Validator; + + textFieldFocusNode4 = FocusNode(); + textController4 = TextEditingController(); + textController4Validator = _textController4Validator; + } @override void dispose() { 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 c495da52..ea48ca5f 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_widget.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_widget.dart @@ -116,772 +116,813 @@ class _RegisterVisitorPageWidgetState extends State { ), ), child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - 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: 200.0, - fit: BoxFit.cover, + child: Form( + // key: UniqueKey(), + autovalidateMode: AutovalidateMode.onUserInteraction, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + 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: 200.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; + ); + } 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; + } } - 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, + }, + 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), + ), ), - options: FFButtonOptions( - width: 300.0, - height: 80.0, + ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Padding( 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, + 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), + ), ), - borderRadius: BorderRadius.circular(8.0), ), ), + ], + ); + } + }, + ), + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 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, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + 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).customColor6, + width: 0.5, ), - 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), - ), - ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.person, + color: FlutterFlowTheme.of(context).accent1, + ), + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + maxLines: null, + keyboardType: TextInputType.name, + validator: _model.textController1Validator + .asValidator(context), + ), + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController2, + focusNode: _model.textFieldFocusNode2, + autofocus: false, + 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).customColor6, + 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: Column( + children: [ + 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).customColor6, + 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)), + ), + if (_model.dropDownValue == null || + _model.dropDownValue == '') + Align( + alignment: const AlignmentDirectional(0.4, 0), + child: Text(FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ), + style: FlutterFlowTheme.of(context).bodySmall.override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + color: FlutterFlowTheme.of(context).error, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodySmallFamily), + )), ), ], - ); - } - }, - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 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, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - 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).customColor6, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.person, - color: FlutterFlowTheme.of(context).accent1, ), ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - maxLines: null, - keyboardType: TextInputType.name, - validator: _model.textController1Validator - .asValidator(context), ), - ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController2, - focusNode: _model.textFieldFocusNode2, - autofocus: false, - 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).customColor6, - width: 0.5, + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 0.0, 0.0, 15.0), + child: Text( + FFLocalizations.of(context).getText( + 'bqpucwh0' /* Contatos */, ), - 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: */, + 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), ), - 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).customColor6, - 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( - 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, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - 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 */, - ), - 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).customColor6, - 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), ), - ), - 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).customColor6, - 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( padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 65.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(); + 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 */, + ), + 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).customColor6, + 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), + ), + ), + 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).customColor6, + 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, 65.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', + ).onError((e, s) async { + return await showAdaptiveDialog( + context: context, + builder: (context) { + return GestureDetector( + onTap: () => Navigator.pop(context), + child: Padding( + padding: MediaQuery.viewInsetsOf(context), + child: Dialog( + child: ThrowExceptionWidget( + msg: FFLocalizations.of(context).getVariableText( + ptText: 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', + enText: 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', + ), + ), + ), + ), + ); + }, + ); }); + + 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 showAdaptiveDialog( + 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: Dialog( + child: ThrowExceptionWidget( + msg:FFLocalizations.of(context).getVariableText( + ptText: 'Erro ao cadastrar visitante. Tente novamente.', + enText: 'Error registering visitor. Try again.', + ), + ), + ), + ), + ); + }, + ).then((value) => safeSetState(() {})); + } } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, + await showAdaptiveDialog( context: context, builder: (context) { return GestureDetector( - onTap: () => _model - .unfocusNode.canRequestFocus - ? FocusScope.of(context) - .requestFocus(_model.unfocusNode) - : FocusScope.of(context).unfocus(), + onTap: () => Navigator.pop(context), 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 ?? - ''), - )}', + padding: MediaQuery.viewInsetsOf(context), + child: Dialog( + child: ThrowExceptionWidget( + msg: FFLocalizations.of(context).getVariableText( + ptText: 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', + enText: 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', + ), + ), ), - ), + ), ); }, ).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 */, - ), - 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, + + setState(() {}); + }, + text: FFLocalizations.of(context).getText( + 'okbw0aiu' /* Cadastrar */, ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(15.0), - bottomRight: Radius.circular(15.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), + 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, + ), + 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)) - .addToStart(const SizedBox(height: 30.0)), + ] + .divide(const SizedBox(height: 10.0)) + .addToStart(const SizedBox(height: 30.0)), + ), ), ), ), From d95c82d3557ece5ced293246fd37e0b635abba83 Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Tue, 30 Jul 2024 11:06:32 -0300 Subject: [PATCH 02/10] misc --- lib/actions/actions.dart | 388 ++++---- lib/app_state.dart | 58 +- .../throw_exception_widget.dart | 5 +- .../visitor_not_found_component_widget.dart | 33 +- ...ot_password_template_component_widget.dart | 488 ++++----- ...siter_vistor_template_component_model.dart | 94 +- ...iter_vistor_template_component_widget.dart | 638 +++++++----- .../sign_in_template_component_model.dart | 1 + .../sign_in_template_component_widget.dart | 179 ++-- ...earch_modal_template_component_widget.dart | 800 ++++++++------- lib/flutter_flow/flutter_flow_util.dart | 89 +- lib/pages/home_page/home_page_widget.dart | 908 ++++++++--------- .../preferences_settings_model.dart | 245 +++-- .../preferences_settings_widget.dart | 107 +- .../register_visitor_page_model.dart | 108 +- .../register_visitor_page_widget.dart | 933 +----------------- .../schedule_complete_visit_page_model.dart | 4 +- .../schedule_complete_visit_page_widget.dart | 250 ++--- 18 files changed, 2388 insertions(+), 2940 deletions(-) diff --git a/lib/actions/actions.dart b/lib/actions/actions.dart index 5d80d184..a0bc441a 100644 --- a/lib/actions/actions.dart +++ b/lib/actions/actions.dart @@ -16,9 +16,6 @@ import 'package:hub/flutter_flow/random_data_util.dart'; import 'package:hub/pages/home_page/home_page_model.dart'; import 'package:qr_flutter/qr_flutter.dart'; - - - import 'package:url_launcher/url_launcher.dart'; Future openTermsOfUse(BuildContext context) async { @@ -165,6 +162,7 @@ Future singInLoginAction( return; } else { await showModalBottomSheet( + useRootNavigator: true, isScrollControlled: true, backgroundColor: Colors.transparent, useSafeArea: true, @@ -333,7 +331,6 @@ Future toggleSignInPage(BuildContext context) async { } Future toggleSignUpPage(BuildContext context) async { - context.pushNamed( 'signUpPage', extra: { @@ -468,12 +465,12 @@ Future checkLocals({ ), ), ); - safeSetState(() {}); // Chamada otimizada fora do then para evitar encadeamentos desnecessários. + safeSetState( + () {}); // Chamada otimizada fora do then para evitar encadeamentos desnecessários. return false; } } - Future changeStatusAction( BuildContext context, String status, @@ -523,13 +520,9 @@ Future changeStatusAction( default: break; } - - } - -/// QR Code - +/// QR Code Uint8List assembleQRPacket(int direction, String identifier, String password) { List packet = [direction]; @@ -569,13 +562,15 @@ Uint8List assembleQRPacket(int direction, String identifier, String password) { check ^= b; } - if (check == int.parse('0D', radix: 16) || check == int.parse('0A', radix: 16)) { + if (check == int.parse('0D', radix: 16) || + check == int.parse('0A', radix: 16)) { packet.add(int.parse('FF', radix: 16)); } else { packet.add(check); } - var bytes = packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' ')); + var bytes = + packet.map((byte) => byte.toRadixString(16).padLeft(2, '0')).join((' ')); log("Pacote: $packet"); log("Bytes: $bytes"); @@ -586,22 +581,24 @@ Uint8List hexStringToByteArray(String s) { int len = s.length; Uint8List data = Uint8List(len ~/ 2); for (int i = 0; i < len; i += 2) { - data[i ~/ 2] = ((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16)); + data[i ~/ 2] = + ((int.parse(s[i], radix: 16) << 4) + int.parse(s[i + 1], radix: 16)); } return data; } String byteToHexa(Uint8List pDados) { - return pDados.map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase()).join(); + return pDados + .map((byte) => byte.toRadixString(16).padLeft(2, '0').toUpperCase()) + .join(); } Future byteToString(Uint8List bytes) async { return String.fromCharCodes(bytes); } - Widget buildQrCode( -{ + { // required String data, // required String type, // required int version, @@ -610,204 +607,207 @@ Widget buildQrCode( required double dimension, required String identifier, required String pass, - required int direction - } - ) { + required int direction}) { try { log("pass: $pass"); const Color backgroundColor = Colors.white; const Color foregroundColor = Colors.black; - return QrImageView.withQr(qr: QrCode.fromUint8List(data: assembleQRPacket(direction, identifier, pass), errorCorrectLevel: errorCorrectLevel), size: dimension, padding: const EdgeInsets.all(10), backgroundColor: backgroundColor, foregroundColor: foregroundColor); + return QrImageView.withQr( + qr: QrCode.fromUint8List( + data: assembleQRPacket(direction, identifier, pass), + errorCorrectLevel: errorCorrectLevel), + size: dimension, + padding: const EdgeInsets.all(10), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor); } catch (e) { return Text("Erro ao gerar QR Code: ${e.toString()}"); } } +// // Retorna o conteúdo a ser codificado no QR Code. +// String getContents() { +// return data; +// } - // // Retorna o conteúdo a ser codificado no QR Code. - // String getContents() { - // return data; - // } +// // Retorna uma versão do conteúdo otimizada para exibição. +// String getDisplayContents() { +// return data.trim(); +// } - // // Retorna uma versão do conteúdo otimizada para exibição. - // String getDisplayContents() { - // return data.trim(); - // } +// // Retorna o título baseado no tipo de conteúdo. +// String getTitle() { +// return type; +// } - // // Retorna o título baseado no tipo de conteúdo. - // String getTitle() { - // return type; - // } +// // Codifica o conteúdo em uma string adequada para o QR Code. +// Future encodeContents() async { +// // Implementação específica para codificar o conteúdo. +// return data; // Exemplo simplificado. +// } - // // Codifica o conteúdo em uma string adequada para o QR Code. - // Future encodeContents() async { - // // Implementação específica para codificar o conteúdo. - // return data; // Exemplo simplificado. - // } +// // Codifica o conteúdo específico do QR Code. +// Future encodeQRCodeContents() async { +// return getQrCode(); +// } - // // Codifica o conteúdo específico do QR Code. - // Future encodeQRCodeContents() async { - // return getQrCode(); - // } +// // Gera o QR Code como um widget. - // // Gera o QR Code como um widget. - +// // Codifica o conteúdo como um bitmap (pode ser útil para operações de baixo nível). +// // Future encodeAsBitmap() async { +// // // Implementação para codificar como bitmap. +// // return Image(image); // Exemplo simplificado. +// // } - // // Codifica o conteúdo como um bitmap (pode ser útil para operações de baixo nível). - // // Future encodeAsBitmap() async { - // // // Implementação para codificar como bitmap. - // // return Image(image); // Exemplo simplificado. - // // } +// // Adivinha a codificação apropriada para o conteúdo. +// String guessAppropriateEncoding(String content) { +// // Implementação para adivinhar a codificação. +// return "UTF-8"; // Exemplo simplificado. +// } - // // Adivinha a codificação apropriada para o conteúdo. - // String guessAppropriateEncoding(String content) { - // // Implementação para adivinhar a codificação. - // return "UTF-8"; // Exemplo simplificado. - // } +// // Remove espaços em branco do início e do fim do conteúdo. +// String trim(String content) { +// return content.trim(); +// } - // // Remove espaços em branco do início e do fim do conteúdo. - // String trim(String content) { - // return content.trim(); - // } +// // Escapa caracteres especiais para o formato MECARD. +// String escapeMECARD(String content) { +// // Implementação para escapar caracteres. +// return content.replaceAll(':', '\\:'); // Exemplo simplificado. +// } - // // Escapa caracteres especiais para o formato MECARD. - // String escapeMECARD(String content) { - // // Implementação para escapar caracteres. - // return content.replaceAll(':', '\\:'); // Exemplo simplificado. - // } +/// menu - /// menu - - Future scheduleVisitOptAction(BuildContext context) async { - await showAdaptiveDialog( - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: OptionSelectionModalWidget( - routesListStr: [ - 'scheduleCompleteVisitPage', - 'scheduleProvisionalVisitPage', - 'fastPassPage', - ], - iconsListIcon: [ - Icons.date_range_rounded, - Icons.date_range_rounded, - Icons.date_range_rounded, - ], - nameListStr: [ - FFLocalizations.of(context).getVariableText( - ptText: 'Visita\nCompleta', - enText: 'Complete\nSchedule', - ), - FFLocalizations.of(context).getVariableText( - ptText: 'Visita\nProvisória', - enText: 'Provisional\nSchedule', - ), - FFLocalizations.of(context).getVariableText( - ptText: 'Visita\nRápida', - enText: 'Fast\nSchedule', - ), - ], - ), - ); - }, - ); - } - - Future registerVisitorOptAction(BuildContext context) async { - context.pushNamed( - 'registerVisitorPage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, +Future scheduleVisitOptAction(BuildContext context) async { + await showAdaptiveDialog( + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: OptionSelectionModalWidget( + routesListStr: [ + 'scheduleCompleteVisitPage', + 'scheduleProvisionalVisitPage', + 'fastPassPage', + ], + iconsListIcon: [ + Icons.date_range_rounded, + Icons.date_range_rounded, + Icons.date_range_rounded, + ], + nameListStr: [ + FFLocalizations.of(context).getVariableText( + ptText: 'Visita\nCompleta', + enText: 'Complete\nSchedule', + ), + FFLocalizations.of(context).getVariableText( + ptText: 'Visita\nProvisória', + enText: 'Provisional\nSchedule', + ), + FFLocalizations.of(context).getVariableText( + ptText: 'Visita\nRápida', + enText: 'Fast\nSchedule', + ), + ], ), - }, - ); - } + ); + }, + ); +} - Future peopleOnThePropertyAction(BuildContext context) async { - context.pushNamed( - 'peopleOnThePropertyPage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.fade, +Future registerVisitorOptAction(BuildContext context) async { + context.pushNamed( + 'registerVisitorPage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); +} + +Future peopleOnThePropertyAction(BuildContext context) async { + context.pushNamed( + 'peopleOnThePropertyPage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.fade, + ), + }, + ); +} + +Future preferencesSettings(BuildContext context) async { + context.pushNamed( + 'preferencesSettings', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); +} + +Future liberationHistoryOptAction(BuildContext context) async { + await showAdaptiveDialog( + // isScrollControlled: true, + // backgroundColor: Colors.transparent, + // enableDrag: false, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: OptionSelectionModalWidget( + routesListStr: [ + 'liberationHistory', + 'acessHistoryPage', + 'scheduleCompleteVisitPage', + // 'messageHistoryPage', + ], + iconsListIcon: [ + Icons.history_rounded, + Icons.history_rounded, + Icons.history_rounded, + // Icons.history_rounded, + ], + nameListStr: [ + FFLocalizations.of(context).getVariableText( + ptText: 'Histórico\nde Liberação', + enText: 'Liberation\nHistory', + ), + FFLocalizations.of(context).getVariableText( + ptText: 'Histórico\nde Acesso', + enText: 'Access\nHistory', + ), + FFLocalizations.of(context).getVariableText( + ptText: 'Histórico\nde Visita', + enText: 'Visit\nHistory', + ), + // FFLocalizations.of(context).getVariableText( + // ptText: 'Histórico\nde Mensagens', + // enText: 'Message\nHistory', + // ), + ], ), - }, - ); - } + ); + }, + ); +} - Future preferencesSettings(BuildContext context) async { - context.pushNamed( - 'preferencesSettings', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); - } - - Future liberationHistoryOptAction(BuildContext context) async { - await showAdaptiveDialog( - // isScrollControlled: true, - // backgroundColor: Colors.transparent, - // enableDrag: false, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: OptionSelectionModalWidget( - routesListStr: [ - 'liberationHistory', - 'acessHistoryPage', - 'scheduleCompleteVisitPage', - // 'messageHistoryPage', - ], - iconsListIcon: [ - Icons.history_rounded, - Icons.history_rounded, - Icons.history_rounded, - // Icons.history_rounded, - ], - nameListStr: [ - FFLocalizations.of(context).getVariableText( - ptText: 'Histórico\nde Liberação', - enText: 'Liberation\nHistory', - ), - FFLocalizations.of(context).getVariableText( - ptText: 'Histórico\nde Acesso', - enText: 'Access\nHistory', - ), - FFLocalizations.of(context).getVariableText( - ptText: 'Histórico\nde Visita', - enText: 'Visit\nHistory', - ), - // FFLocalizations.of(context).getVariableText( - // ptText: 'Histórico\nde Mensagens', - // enText: 'Message\nHistory', - // ), - ], - ), - ); - }, - ); - } - - Future accessQRCodeOptAction(BuildContext context) async { - context.pushNamed( - 'qrCodePage', - extra: { - kTransitionInfoKey: const TransitionInfo( - hasTransition: true, - transitionType: PageTransitionType.scale, - alignment: Alignment.bottomCenter, - ), - }, - ); - } \ No newline at end of file +Future accessQRCodeOptAction(BuildContext context) async { + context.pushNamed( + 'qrCodePage', + extra: { + kTransitionInfoKey: const TransitionInfo( + hasTransition: true, + transitionType: PageTransitionType.scale, + alignment: Alignment.bottomCenter, + ), + }, + ); +} diff --git a/lib/app_state.dart b/lib/app_state.dart index 917fb812..115951d0 100644 --- a/lib/app_state.dart +++ b/lib/app_state.dart @@ -17,7 +17,7 @@ class FFAppState extends ChangeNotifier { // Verifica suporte biométrico Future checkBiometrics() async { try { - return await auth.canCheckBiometrics; + return await auth.canCheckBiometrics; } catch (e) { clearBiometricAuthentication(); debugPrint('Error checking biometrics: $e'); @@ -30,14 +30,13 @@ class FFAppState extends ChangeNotifier { bool authenticated = false; try { authenticated = await auth.authenticate( - localizedReason: 'Scan your fingerprint to authenticate', - options: const AuthenticationOptions( - biometricOnly: true, - stickyAuth: true, - useErrorDialogs: true, - sensitiveTransaction: true, - ) - ); + localizedReason: 'Scan your fingerprint to authenticate', + options: const AuthenticationOptions( + biometricOnly: true, + stickyAuth: true, + useErrorDialogs: true, + sensitiveTransaction: true, + )); if (authenticated) { _isBiometricAuthenticated = true; notifyListeners(); @@ -50,7 +49,8 @@ class FFAppState extends ChangeNotifier { clearBiometricAuthentication(); return Future.error(e); } - return Future.error(''); // Add this line to ensure a value is always returned + return Future.error( + ''); // Add this line to ensure a value is always returned } // Função para limpar o estado de autenticação biométrica @@ -60,9 +60,6 @@ class FFAppState extends ChangeNotifier { // Limpar a informação salva, se necessário } - - - static FFAppState _instance = FFAppState._internal(); factory FFAppState() { @@ -123,13 +120,16 @@ class FFAppState extends ChangeNotifier { _tokenAPNS = await secureStorage.getString('ff_tokenAPNS') ?? _tokenAPNS; }); await _safeInitAsync(() async { - _userDevUUID = await secureStorage.getString('ff_user_dev_id') ?? _userDevUUID; + _userDevUUID = + await secureStorage.getString('ff_user_dev_id') ?? _userDevUUID; }); await _safeInitAsync(() async { - _serialNumber = await secureStorage.getString('ff_serialNumber') ?? _serialNumber; + _serialNumber = + await secureStorage.getString('ff_serialNumber') ?? _serialNumber; }); await _safeInitAsync(() async { - _fingerprintOPT = await secureStorage.getBool('fingerprint') ?? _fingerprintOPT; + _fingerprintOPT = + await secureStorage.getBool('fingerprint') ?? _fingerprintOPT; }); await _safeInitAsync(() async { _personOPT = await secureStorage.getBool('person') ?? _personOPT; @@ -137,6 +137,9 @@ class FFAppState extends ChangeNotifier { await _safeInitAsync(() async { _passOPT = await secureStorage.getBool('pass') ?? _passOPT; }); + await _safeInitAsync(() async { + _panicOPT = await secureStorage.getBool('panic') ?? _panicOPT; + }); await _safeInitAsync(() async { _notifyOPT = await secureStorage.getBool('notify') ?? _notifyOPT; }); @@ -147,9 +150,9 @@ class FFAppState extends ChangeNotifier { _panicPass = await secureStorage.getString('panicPass') ?? _panicPass; }); await _safeInitAsync(() async { - _fingerprintPass = await secureStorage.getString('fingerprintPass') ?? _fingerprintPass; + _fingerprintPass = + await secureStorage.getString('fingerprintPass') ?? _fingerprintPass; }); - } void update(VoidCallback callback) { @@ -159,6 +162,17 @@ class FFAppState extends ChangeNotifier { late FlutterSecureStorage secureStorage; + bool _panicOPT = false; + bool get panic => _panicOPT; + set panic(bool value) { + _panicOPT = value; + secureStorage.setBool('panic', value); + } + + void deletePanic() { + secureStorage.delete(key: 'panic'); + } + String _fingerprintPass = ''; String get fingerprintPass => _fingerprintPass; set fingerprintPass(String value) { @@ -185,8 +199,7 @@ class FFAppState extends ChangeNotifier { String get panicPass => _panicPass; set panicPass(String value) { _panicPass = value; - secureStorage.setString - ('panicPass', value); + secureStorage.setString('panicPass', value); } void deletePanicPass() { @@ -203,8 +216,7 @@ class FFAppState extends ChangeNotifier { bool _passOPT = false; bool get pass => _passOPT; set pass(bool value) { - _passOPT = - value; + _passOPT = value; secureStorage.setBool('pass', value); } @@ -486,4 +498,4 @@ extension FlutterSecureStorageExtensions on FlutterSecureStorage { Future setStringList(String key, List value) async => await writeSync( key: key, value: const ListToCsvConverter().convert([value])); -} \ No newline at end of file +} 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 95333ddd..22686297 100644 --- a/lib/components/molecular_components/throw_exception/throw_exception_widget.dart +++ b/lib/components/molecular_components/throw_exception/throw_exception_widget.dart @@ -134,7 +134,7 @@ class _ThrowExceptionWidgetState extends State ), Padding( padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 10.0, 0.0, 0.0), + const EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), child: Text( valueOrDefault( widget.msg, @@ -150,6 +150,7 @@ class _ThrowExceptionWidgetState extends State FlutterFlowTheme.of(context) .bodyMediumFamily), ), + textAlign: TextAlign.left, ), ), ].addToStart(const SizedBox(height: 50.0)), @@ -162,4 +163,4 @@ class _ThrowExceptionWidgetState extends State ], ); } -} \ No newline at end of file +} diff --git a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart index 421d595f..783d3801 100644 --- a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart +++ b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart @@ -1,16 +1,13 @@ - import 'package:hub/components/molecular_components/visitor_not_found_component/visitor_not_found_component_model.dart'; import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; - import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; - class VisitorNotFoundComponentWidget extends StatefulWidget { const VisitorNotFoundComponentWidget({super.key}); @@ -65,7 +62,8 @@ class _VisitorNotFoundComponentWidgetState Align( alignment: const AlignmentDirectional(1.0, -1.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 5.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 5.0, 0.0), child: FlutterFlowIconButton( borderRadius: 20.0, borderWidth: 1.0, @@ -87,7 +85,8 @@ class _VisitorNotFoundComponentWidgetState size: 72.0, ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0), child: Text( FFLocalizations.of(context).getText( '1p9mykbj' /* Usuário não encontrado */, @@ -102,7 +101,8 @@ class _VisitorNotFoundComponentWidgetState ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(10.0, 4.0, 10.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(10.0, 4.0, 10.0, 0.0), child: Text( FFLocalizations.of(context).getText( 'kt937sp6' /* O documento inserido não corre... */, @@ -128,12 +128,19 @@ class _VisitorNotFoundComponentWidgetState await showModalBottomSheet( isScrollControlled: true, backgroundColor: Colors.transparent, - enableDrag: false, + enableDrag: true, + useSafeArea: true, context: context, builder: (context) { return Padding( padding: MediaQuery.viewInsetsOf(context), - child: const RegisiterVistorTemplateComponentWidget(), + child: SizedBox( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.9, + child: + const RegisiterVistorTemplateComponentWidget( + source: 'VisitorNotFoundComponent', + )), ); }, ).then((value) => safeSetState(() {})); @@ -144,10 +151,10 @@ class _VisitorNotFoundComponentWidgetState options: FFButtonOptions( width: double.infinity, height: 30.0, - padding: - const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - iconPadding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.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: @@ -177,4 +184,4 @@ class _VisitorNotFoundComponentWidgetState ), ); } -} \ No newline at end of file +} 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 156672de..d2ec0caa 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 @@ -12,7 +12,6 @@ export 'forgot_password_template_component_model.dart'; // - class ForgotPasswordTemplateComponentWidget extends StatefulWidget { const ForgotPasswordTemplateComponentWidget({super.key}); @@ -49,186 +48,106 @@ class _ForgotPasswordTemplateComponentWidgetState @override Widget build(BuildContext context) { - return Align( - alignment: const AlignmentDirectional(0.0, 1.0), - child: Container( - width: double.infinity, - height: 300.0, - constraints: const BoxConstraints( - maxWidth: 570.0, - ), - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), + return GestureDetector( + child: Align( + alignment: const AlignmentDirectional(0.0, 1.0), + child: Container( + width: double.infinity, + height: 300.0, + constraints: const BoxConstraints( + maxWidth: 570.0, ), - ), - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // This row exists for when the "app bar" is hidden on desktop, having a way back for the user can work well. - if (responsiveVisibility( - context: context, - phone: false, - tablet: false, - )) + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(0.0), + bottomRight: Radius.circular(0.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), + ), + ), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // This row exists for when the "app bar" is hidden on desktop, having a way back for the user can work well. + if (responsiveVisibility( + context: context, + phone: false, + tablet: false, + )) + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 16.0, 0.0, 16.0, 8.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + context.safePop(); + }, + child: Row( + mainAxisSize: MainAxisSize.max, + children: [ + const Padding( + padding: EdgeInsetsDirectional.fromSTEB( + 0.0, 12.0, 0.0, 12.0), + child: Icon( + Icons.arrow_back_rounded, + color: Color(0xFF15161E), + size: 24.0, + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 12.0, 0.0, 0.0, 0.0), + child: Text( + '', + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: 'Plus Jakarta Sans', + color: const Color(0xFF15161E), + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), + ), + ), + ], + ), + ), + ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 16.0, 8.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - context.safePop(); - }, - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - const Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0.0, 12.0, 0.0, 12.0), - child: Icon( - Icons.arrow_back_rounded, - color: Color(0xFF15161E), - size: 24.0, - ), - ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(12.0, 0.0, 0.0, 0.0), - child: Text( - '', - style: - FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: const Color(0xFF15161E), - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), - ), - ), - ], + padding: + const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context).getText( + 'xxm3ajsy' /* ESQUECEU SUA SENHA? */, ), + style: FlutterFlowTheme.of(context).headlineMedium.override( + fontFamily: 'Outfit', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 24.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: + GoogleFonts.asMap().containsKey('Outfit'), + ), ), ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 0.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - 'xxm3ajsy' /* ESQUECEU SUA SENHA? */, - ), - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: 'Outfit', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 24.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap().containsKey('Outfit'), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), - child: Text( - FFLocalizations.of(context).getText( - 'wu2f7yzo' /* Não se preucupe nós vamos te a... */, - ), - style: 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'), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0), - child: SizedBox( - width: double.infinity, - child: TextFormField( - controller: _model.emailAddressTextController, - focusNode: _model.emailAddressFocusNode, - autofillHints: const [AutofillHints.email], - obscureText: false, - decoration: InputDecoration( - isDense: true, - labelText: FFLocalizations.of(context).getText( - 'mtz8l7ft' /* Email */, - ), - labelStyle: - FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: 'Plus Jakarta Sans', - color: FlutterFlowTheme.of(context).accent1, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.w500, - useGoogleFonts: GoogleFonts.asMap() - .containsKey('Plus Jakarta Sans'), - ), - hintText: FFLocalizations.of(context).getText( - 'w7y5wlnv' /* digite o seu email..... */, - ), - hintStyle: - 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'), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent3, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 2.0, - ), - borderRadius: BorderRadius.circular(12.0), - ), - filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, - contentPadding: - const EdgeInsetsDirectional.fromSTEB(24.0, 24.0, 20.0, 24.0), - suffixIcon: Icon( - Icons.email, - color: FlutterFlowTheme.of(context).accent1, - size: 22.0, - ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(16.0, 4.0, 16.0, 4.0), + child: Text( + FFLocalizations.of(context).getText( + 'wu2f7yzo' /* Não se preucupe nós vamos te a... */, ), - style: FlutterFlowTheme.of(context).bodyMedium.override( + style: FlutterFlowTheme.of(context).labelMedium.override( fontFamily: 'Plus Jakarta Sans', color: FlutterFlowTheme.of(context).primaryText, fontSize: 14.0, @@ -237,82 +156,173 @@ class _ForgotPasswordTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap() .containsKey('Plus Jakarta Sans'), ), - maxLines: null, - keyboardType: TextInputType.emailAddress, - cursorColor: const Color(0xFF6F61EF), - validator: _model.emailAddressTextControllerValidator - .asValidator(context), ), ), - ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), - child: FFButtonWidget( - onPressed: () async { - _model.req = await PhpGroup.forgotPasswordCall.call( - email: _model.emailAddressTextController.text, - ); - - if (PhpGroup.forgotPasswordCall.error( - (_model.req?.jsonBody ?? ''), - ) == - false) { - Navigator.pop(context); - } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget( - msg: PhpGroup.forgotPasswordCall.msg( - (_model.req?.jsonBody ?? ''), - )!, - ), - ); - }, - ).then((value) => safeSetState(() {})); - } - - setState(() {}); - }, - text: FFLocalizations.of(context).getText( - '74rnd5bu' /* Enviar */, - ), - options: FFButtonOptions( - width: 270.0, - height: 50.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(0xFF1AAB5F), - textStyle: FlutterFlowTheme.of(context).titleSmall.override( + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 16.0, 0.0), + child: SizedBox( + width: double.infinity, + child: TextFormField( + controller: _model.emailAddressTextController, + focusNode: _model.emailAddressFocusNode, + autofillHints: const [AutofillHints.email], + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + 'mtz8l7ft' /* Email */, + ), + labelStyle: + FlutterFlowTheme.of(context).labelMedium.override( + fontFamily: 'Plus Jakarta Sans', + color: FlutterFlowTheme.of(context).accent1, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), + hintText: FFLocalizations.of(context).getText( + 'w7y5wlnv' /* digite o seu email..... */, + ), + hintStyle: + 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'), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent1, + width: 2.0, + ), + borderRadius: BorderRadius.circular(12.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent3, + width: 2.0, + ), + borderRadius: BorderRadius.circular(12.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 2.0, + ), + borderRadius: BorderRadius.circular(12.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 2.0, + ), + borderRadius: BorderRadius.circular(12.0), + ), + filled: true, + fillColor: FlutterFlowTheme.of(context).primaryBackground, + contentPadding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 24.0, 20.0, 24.0), + suffixIcon: Icon( + Icons.email, + color: FlutterFlowTheme.of(context).accent1, + size: 22.0, + ), + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: 'Plus Jakarta Sans', - color: Colors.white, - fontSize: 16.0, + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, letterSpacing: 0.0, fontWeight: FontWeight.w500, useGoogleFonts: GoogleFonts.asMap() .containsKey('Plus Jakarta Sans'), ), - elevation: 3.0, - borderSide: const BorderSide( - color: Colors.transparent, - width: 1.0, - ), + maxLines: null, + keyboardType: TextInputType.emailAddress, + cursorColor: const Color(0xFF6F61EF), + validator: _model.emailAddressTextControllerValidator + .asValidator(context), ), - showLoadingIndicator: false, ), ), - ), - ], + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 24.0, 0.0, 0.0), + child: FFButtonWidget( + onPressed: () async { + _model.req = await PhpGroup.forgotPasswordCall.call( + email: _model.emailAddressTextController.text, + ); + + if (PhpGroup.forgotPasswordCall.error( + (_model.req?.jsonBody ?? ''), + ) == + false) { + Navigator.pop(context); + } else { + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + enableDrag: false, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: ThrowExceptionWidget( + msg: PhpGroup.forgotPasswordCall.msg( + (_model.req?.jsonBody ?? ''), + )!, + ), + ); + }, + ).then((value) => safeSetState(() {})); + } + + setState(() {}); + }, + text: FFLocalizations.of(context).getText( + '74rnd5bu' /* Enviar */, + ), + options: FFButtonOptions( + width: 270.0, + height: 50.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(0xFF1AAB5F), + textStyle: + FlutterFlowTheme.of(context).titleSmall.override( + fontFamily: 'Plus Jakarta Sans', + color: Colors.white, + fontSize: 16.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w500, + useGoogleFonts: GoogleFonts.asMap() + .containsKey('Plus Jakarta Sans'), + ), + elevation: 3.0, + borderSide: const BorderSide( + color: Colors.transparent, + width: 1.0, + ), + ), + showLoadingIndicator: false, + ), + ), + ), + ], + ), ), ), ); } -} \ No newline at end of file +} diff --git a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart index e0f842b7..f0fffd4e 100644 --- a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart +++ b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart @@ -1,17 +1,15 @@ - -import 'dart:typed_data'; - +import '/backend/api_requests/api_calls.dart'; +import '/flutter_flow/flutter_flow_util.dart'; +import '/flutter_flow/form_field_controller.dart'; import 'package:flutter/material.dart'; -import 'package:hub/backend/api_requests/api_manager.dart'; -import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart'; -import 'package:hub/flutter_flow/flutter_flow_model.dart'; -import 'package:hub/flutter_flow/form_field_controller.dart'; -import 'package:hub/flutter_flow/uploaded_file.dart'; + +import 'regisiter_vistor_template_component_widget.dart'; class RegisiterVistorTemplateComponentModel extends FlutterFlowModel { - /// State fields for stateful widgets in this component. + /// State fields for stateful widgets in this page. + final unfocusNode = FocusNode(); bool isDataUploading = false; FFUploadedFile uploadedLocalFile = FFUploadedFile(bytes: Uint8List.fromList([])); @@ -20,31 +18,98 @@ class RegisiterVistorTemplateComponentModel FocusNode? textFieldFocusNode1; TextEditingController? textController1; String? Function(BuildContext, String?)? textController1Validator; - // State field(s) for DropDown widget. - String? dropDownValue; - FormFieldController? dropDownValueController; + String? _textController1Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + return null; + } + // State field(s) for TextField widget. FocusNode? textFieldFocusNode2; TextEditingController? textController2; String? Function(BuildContext, String?)? textController2Validator; + String? _textController2Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + + return null; + } + + // State field(s) for DropDown widget. + String? dropDownValue; + FormFieldController? dropDownValueController; // State field(s) for TextField widget. FocusNode? textFieldFocusNode3; TextEditingController? textController3; String? Function(BuildContext, String?)? textController3Validator; + String? _textController3Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + return null; + } + // State field(s) for TextField widget. FocusNode? textFieldFocusNode4; TextEditingController? textController4; String? Function(BuildContext, String?)? textController4Validator; + String? _textController4Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ); + } + if (!val.contains('@') || !val.contains('.')) { + return FFLocalizations.of(context).getVariableText( + enText: 'Invalid email', + ptText: 'Email inválido', + ); + } + return null; + } + // Stores action output result for [Custom Action - convertImageFileToBase64] action in Button widget. String? imgBase64; // Stores action output result for [Backend Call - API (postScheduleVisitor)] action in Button widget. - ApiCallResponse? registerVisitor; + ApiCallResponse? scheduleVisitor; @override - void initState(BuildContext context) {} + void initState(BuildContext context) { + textFieldFocusNode1 = FocusNode(); + textController1 = TextEditingController(); + textController1Validator = _textController1Validator; + + textFieldFocusNode2 = FocusNode(); + textController2 = TextEditingController(); + textController2Validator = _textController2Validator; + + dropDownValue = ''; + // dropDownValueController = FormFieldController(initialValue: dropDownValue); + + textFieldFocusNode3 = FocusNode(); + textController3 = TextEditingController(); + textController3Validator = _textController3Validator; + + textFieldFocusNode4 = FocusNode(); + textController4 = TextEditingController(); + textController4Validator = _textController4Validator; + } @override void dispose() { + unfocusNode.dispose(); textFieldFocusNode1?.dispose(); textController1?.dispose(); @@ -58,4 +123,3 @@ class RegisiterVistorTemplateComponentModel textController4?.dispose(); } } - 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 2ea62d9b..2b541bf5 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 @@ -1,28 +1,27 @@ +import 'dart:developer'; -import 'dart:typed_data'; +import 'package:flutter/services.dart'; +import '/backend/api_requests/api_calls.dart'; +import '/components/molecular_components/throw_exception/throw_exception_widget.dart'; +import '/flutter_flow/flutter_flow_drop_down.dart'; +import '/flutter_flow/flutter_flow_theme.dart'; +import '/flutter_flow/flutter_flow_util.dart'; +import '/flutter_flow/flutter_flow_widgets.dart'; +import '/flutter_flow/form_field_controller.dart'; +import '/flutter_flow/upload_data.dart'; +import '/custom_code/actions/index.dart' as actions; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; -import 'package:hub/app_state.dart'; -import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart'; -import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart'; -import 'package:hub/custom_code/actions/convert_image_file_to_base64.dart'; -import 'package:hub/flutter_flow/flutter_flow_drop_down.dart'; -import 'package:hub/flutter_flow/flutter_flow_model.dart'; -import 'package:hub/flutter_flow/flutter_flow_theme.dart'; -import 'package:hub/flutter_flow/flutter_flow_util.dart'; -import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; -import 'package:hub/flutter_flow/form_field_controller.dart'; -import 'package:hub/flutter_flow/internationalization.dart'; -import 'package:hub/flutter_flow/upload_data.dart'; -import 'package:hub/flutter_flow/uploaded_file.dart'; import 'package:provider/provider.dart'; - - +import 'regisiter_vistor_template_component_model.dart'; +export 'regisiter_vistor_template_component_model.dart'; class RegisiterVistorTemplateComponentWidget extends StatefulWidget { - const RegisiterVistorTemplateComponentWidget({super.key}); + final String source; + + const RegisiterVistorTemplateComponentWidget( + {super.key, required this.source}); @override State createState() => @@ -33,11 +32,7 @@ class _RegisiterVistorTemplateComponentWidgetState extends State { late RegisiterVistorTemplateComponentModel _model; - @override - void setState(VoidCallback callback) { - super.setState(callback); - _model.onUpdate(); - } + final scaffoldKey = GlobalKey(); @override void initState() { @@ -60,7 +55,7 @@ class _RegisiterVistorTemplateComponentWidgetState @override void dispose() { - _model.maybeDispose(); + _model.dispose(); super.dispose(); } @@ -68,10 +63,14 @@ class _RegisiterVistorTemplateComponentWidgetState @override Widget build(BuildContext context) { context.watch(); - + log(context + .describeWidget('RegisiterVistorTemplateComponentWidget') + .toString()); return 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( @@ -81,33 +80,14 @@ class _RegisiterVistorTemplateComponentWidgetState topRight: Radius.circular(25.0), ), ), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 30.0, 0.0, 0.0), - child: SingleChildScrollView( + child: SingleChildScrollView( + child: Form( + // key: UniqueKey(), + autovalidateMode: AutovalidateMode.disabled, 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( - 'wnhkedzt' /* 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)) { @@ -129,7 +109,7 @@ class _RegisiterVistorTemplateComponentWidgetState _model.uploadedLocalFile.bytes ?? Uint8List.fromList([]), width: 300.0, - height: 100.0, + height: 200.0, fit: BoxFit.cover, ), ), @@ -171,7 +151,7 @@ class _RegisiterVistorTemplateComponentWidgetState bytes: m.bytes, height: m.dimensions?.height, width: m.dimensions?.width, - blurHash: m.blurHash, + // blurHash: m.blurHash, )) .toList(); } finally { @@ -205,8 +185,9 @@ class _RegisiterVistorTemplateComponentWidgetState 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), + iconPadding: + const EdgeInsetsDirectional.fromSTEB( + 14.0, 0.0, 0.0, 20.0), color: FlutterFlowTheme.of(context) .primaryBackground, textStyle: FlutterFlowTheme.of(context) @@ -238,7 +219,7 @@ class _RegisiterVistorTemplateComponentWidgetState 0.0, 50.0, 0.0, 0.0), child: Text( FFLocalizations.of(context).getText( - 'kpd31z4d' /* Clique para adicionar a foto p... */, + 'p4ftwxcy' /* Clique para adicionar a foto p... */, ), style: FlutterFlowTheme.of(context) .bodyMedium @@ -264,11 +245,11 @@ class _RegisiterVistorTemplateComponentWidgetState Align( alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(20.0, 30.0, 0.0, 30.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 30.0, 0.0, 15.0), child: Text( FFLocalizations.of(context).getText( - 'q986vs4m' /* Preencha o formulário com os d... */, + 'zazj5d8b' /* Preencha o formulário com os d... */, ), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context).bodyMedium.override( @@ -282,16 +263,19 @@ class _RegisiterVistorTemplateComponentWidgetState ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController1, + autovalidateMode: AutovalidateMode.onUserInteraction, focusNode: _model.textFieldFocusNode1, autofocus: false, textInputAction: TextInputAction.next, obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( - 'llcw2tei' /* Nome */, + 'v7g73yik' /* Nome */, ), labelStyle: FlutterFlowTheme.of(context) .labelMedium @@ -315,7 +299,7 @@ class _RegisiterVistorTemplateComponentWidgetState ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context).customColor6, width: 0.5, ), borderRadius: BorderRadius.circular(10.0), @@ -360,105 +344,23 @@ class _RegisiterVistorTemplateComponentWidgetState _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( - '67ykbznt' /* 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, 20.0, 0.0, 5.0), - child: FlutterFlowDropDown( - controller: _model.dropDownValueController ??= - FormFieldController(null), - options: [ - FFLocalizations.of(context).getText( - 'ugjkeiz7' /* Visitante */, - ), - FFLocalizations.of(context).getText( - '8nlk5xlk' /* Prestador de Serviço */, - ) - ], - onChanged: (val) => - setState(() => _model.dropDownValue = val), - width: 200.0, - height: 48.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( - 'kw07i43y' /* 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( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController2, focusNode: _model.textFieldFocusNode2, + autovalidateMode: AutovalidateMode.onUserInteraction, autofocus: false, textCapitalization: TextCapitalization.none, + autofillHints: const [AutofillHints.password], + keyboardType: TextInputType.number, textInputAction: TextInputAction.next, obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( - '96ayre48' /* Documento */, + 'rl8tvwnr' /* Documento */, ), labelStyle: FlutterFlowTheme.of(context) .labelMedium @@ -481,7 +383,7 @@ class _RegisiterVistorTemplateComponentWidgetState ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context).customColor6, width: 0.5, ), borderRadius: BorderRadius.circular(10.0), @@ -522,16 +424,135 @@ class _RegisiterVistorTemplateComponentWidgetState ), validator: _model.textController2Validator.asValidator(context), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp('[0-9]')), + ], + ), + ), + 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: Column( + children: [ + 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).customColor6, + 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)), + ), + if (_model.dropDownValue == null || + _model.dropDownValue == '') + Align( + alignment: const AlignmentDirectional(0.4, 0), + child: Text( + FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ), + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + color: FlutterFlowTheme.of(context) + .customColor6, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodySmallFamily), + )), + ), + ], + ), ), ), Align( alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(20.0, 30.0, 0.0, 30.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 0.0, 0.0, 15.0), child: Text( FFLocalizations.of(context).getText( - 'j0g7ggs2' /* Contatos */, + 'bqpucwh0' /* Contatos */, ), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context).bodyMedium.override( @@ -545,16 +566,24 @@ class _RegisiterVistorTemplateComponentWidgetState ), ), Padding( - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController3, focusNode: _model.textFieldFocusNode3, + autovalidateMode: AutovalidateMode.onUserInteraction, autofocus: false, textInputAction: TextInputAction.next, + keyboardType: TextInputType.phone, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp('[0-9, +, -, (, )]')), + ], obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( - 'ybdjabnd' /* Telefone */, + 'h84ls2r6' /* Telefone */, ), labelStyle: FlutterFlowTheme.of(context) .labelMedium @@ -578,7 +607,7 @@ class _RegisiterVistorTemplateComponentWidgetState ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context).customColor6, width: 0.5, ), borderRadius: BorderRadius.circular(10.0), @@ -617,21 +646,24 @@ class _RegisiterVistorTemplateComponentWidgetState useGoogleFonts: GoogleFonts.asMap().containsKey( FlutterFlowTheme.of(context).bodyMediumFamily), ), - validator: - _model.textController3Validator.asValidator(context), + // validator: + // _model.textController3Validator.asValidator(context), ), ), Padding( - padding: const EdgeInsets.all(24.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), child: TextFormField( controller: _model.textController4, focusNode: _model.textFieldFocusNode4, + autovalidateMode: AutovalidateMode.onUserInteraction, autofocus: false, textInputAction: TextInputAction.done, obscureText: false, decoration: InputDecoration( + isDense: true, labelText: FFLocalizations.of(context).getText( - 'tlr6uxo4' /* Email */, + 'fqp7qmka' /* Email */, ), labelStyle: FlutterFlowTheme.of(context) .labelMedium @@ -655,7 +687,7 @@ class _RegisiterVistorTemplateComponentWidgetState ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, + color: FlutterFlowTheme.of(context).customColor6, width: 0.5, ), borderRadius: BorderRadius.circular(10.0), @@ -695,135 +727,199 @@ class _RegisiterVistorTemplateComponentWidgetState FlutterFlowTheme.of(context).bodyMediumFamily), ), keyboardType: TextInputType.emailAddress, - validator: - _model.textController4Validator.asValidator(context), + // 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 convertImageFileToBase64( - _model.uploadedLocalFile, - ); - _model.registerVisitor = - await PhpGroup.postScheduleVisitorCall.call( - devUUID: FFAppState().devUUID, - userUUID: FFAppState().userUUID, - cliID: FFAppState().cliUUID, - atividade: 'putVisitante', - documento: _model.textController2.text, - nome: _model.textController1.text, - tipo: (_model.dropDownValue == 'Visitante') || - (_model.dropDownValue == 'Visitor') - ? 'V' - : 'P', - foto: 'base64;jpeg,klajsalkjslkajslkajl', - ); - - if (PhpGroup.postScheduleVisitorCall.error( - (_model.registerVisitor?.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 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.registerVisitor?.jsonBody ?? ''), - )}', - ), - ); - }, - ).then((value) => safeSetState(() {})); - } - } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 65.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: _model.textController2.text, + nome: _model.textController1.text, + tipo: _model.dropDownValue == + FFLocalizations.of(context).getText( + 'n8vddmcq' /* Visitante */, + ) + ? 'V' + : 'P', + foto: 'base64;jpeg,${_model.imgBase64}', + ) + .onError((e, s) async { + return await showAdaptiveDialog( context: context, builder: (context) { - return 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}', + return GestureDetector( + onTap: () => Navigator.pop(context), + child: Padding( + padding: MediaQuery.viewInsetsOf(context), + child: Dialog( + backgroundColor: Colors.transparent, + child: ThrowExceptionWidget( + msg: FFLocalizations.of(context) + .getVariableText( + ptText: + 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', + enText: + 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', + ), + ), + ), + ), + ); + }, + ); + }); + + if (PhpGroup.postScheduleVisitorCall.error( + (_model.scheduleVisitor?.jsonBody ?? ''), + ) == + false) { + setState(() { + _model.textController1?.clearComposing(); + _model.textController2?.clearComposing(); + _model.textController3?.clearComposing(); + _model.textController4?.clearComposing(); + _model.dropDownValueController?.reset(); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + ptText: + 'Visitante cadastrado com sucesso.', + enText: + 'Visitor successfully registered.'), + style: TextStyle( + color: + FlutterFlowTheme.of(context).info)), + backgroundColor: + FlutterFlowTheme.of(context).primary, + duration: const Duration(seconds: 3), + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + ); + if (widget.source == 'VisitorNotFoundComponent') { + Navigator.pop(context); + } + }); + } else { + await showAdaptiveDialog( + 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: Dialog( + backgroundColor: Colors.transparent, + child: ThrowExceptionWidget( + msg: PhpGroup.postScheduleVisitorCall + .errorMsg(_model + .scheduleVisitor?.jsonBody) + .toString()), + ), ), ); }, ).then((value) => safeSetState(() {})); } + } else { + await showAdaptiveDialog( + context: context, + builder: (context) { + return GestureDetector( + onTap: () { + Form.of(context)?.validate(); + Navigator.pop(context); + }, + child: Padding( + padding: MediaQuery.viewInsetsOf(context), + child: Dialog( + backgroundColor: Colors.transparent, + child: ThrowExceptionWidget( + msg: FFLocalizations.of(context) + .getVariableText( + ptText: + 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', + enText: + 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', + ), + ), + ), + ), + ); + }, + ).then((value) => safeSetState(() {})); + } - setState(() {}); - }, - text: FFLocalizations.of(context).getText( - '65puvap9' /* 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)) + .addToStart(const SizedBox(height: 30.0)) + .addToEnd(const SizedBox(height: 30.0)), ), ), ), ), ); } -} \ No newline at end of file +} diff --git a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart index fd542965..e1010ec7 100644 --- a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart +++ b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_model.dart @@ -8,6 +8,7 @@ class SignInTemplateComponentModel /// State fields for stateful widgets in this component. final formKey = GlobalKey(); + final unfocusNode = FocusNode(); // State field(s) for emailAddress widget. FocusNode? emailAddressFocusNode; TextEditingController? emailAddressTextController; diff --git a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart index ae8cc9df..3f5d1c36 100644 --- a/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart +++ b/lib/components/templates_components/sign_in_template_component/sign_in_template_component_widget.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import '/components/templates_components/forgot_password_template_component/forgot_password_template_component_widget.dart'; import '/flutter_flow/flutter_flow_animations.dart'; import '/flutter_flow/flutter_flow_theme.dart'; @@ -113,8 +115,8 @@ class _SignInTemplateComponentWidgetState mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 35.0, 0.0, 35.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 35.0, 0.0, 35.0), child: Container( width: 548.0, height: 112.0, @@ -130,7 +132,8 @@ class _SignInTemplateComponentWidgetState children: [ Expanded( child: Align( - alignment: const AlignmentDirectional(0.0, 1.0), + alignment: + const AlignmentDirectional(0.0, 1.0), child: Padding( padding: const EdgeInsets.all(3.0), child: Text( @@ -210,8 +213,9 @@ class _SignInTemplateComponentWidgetState mainAxisSize: MainAxisSize.max, children: [ Padding( - padding: const EdgeInsetsDirectional - .fromSTEB( + padding: + const EdgeInsetsDirectional + .fromSTEB( 0.0, 0.0, 0.0, 16.0), child: SizedBox( width: double.infinity, @@ -223,7 +227,8 @@ class _SignInTemplateComponentWidgetState onChanged: (_) => EasyDebounce.debounce( '_model.emailAddressTextController', - const Duration(milliseconds: 500), + const Duration( + milliseconds: 500), () => setState(() {}), ), autofocus: true, @@ -351,8 +356,9 @@ class _SignInTemplateComponentWidgetState ), ), Padding( - padding: const EdgeInsetsDirectional - .fromSTEB( + padding: + const EdgeInsetsDirectional + .fromSTEB( 0.0, 0.0, 0.0, 16.0), child: SizedBox( width: double.infinity, @@ -364,7 +370,8 @@ class _SignInTemplateComponentWidgetState onChanged: (_) => EasyDebounce.debounce( '_model.passwordTextController', - const Duration(milliseconds: 500), + const Duration( + milliseconds: 500), () => setState(() {}), ), autofocus: true, @@ -417,7 +424,8 @@ class _SignInTemplateComponentWidgetState ), focusedBorder: OutlineInputBorder( - borderSide: const BorderSide( + borderSide: + const BorderSide( color: Color(0xFF1AAB5F), width: 0.25, @@ -428,7 +436,8 @@ class _SignInTemplateComponentWidgetState ), errorBorder: OutlineInputBorder( - borderSide: const BorderSide( + borderSide: + const BorderSide( color: Color(0xFFFF5963), width: 0.25, @@ -439,7 +448,8 @@ class _SignInTemplateComponentWidgetState ), focusedErrorBorder: OutlineInputBorder( - borderSide: const BorderSide( + borderSide: + const BorderSide( color: Color(0xFFFF5963), width: 0.25, @@ -514,16 +524,18 @@ class _SignInTemplateComponentWidgetState mainAxisSize: MainAxisSize.max, children: [ Padding( - padding: const EdgeInsetsDirectional - .fromSTEB( + padding: + const EdgeInsetsDirectional + .fromSTEB( 0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( - onPressed: ((_model.emailAddressTextController - .text == - '') && + onPressed: ((_model + .emailAddressTextController + .text == + '') && (_model.passwordTextController - .text == - '')) + .text == + '')) ? null : () async { await action_blocks @@ -548,18 +560,12 @@ class _SignInTemplateComponentWidgetState height: 44.0, padding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), iconPadding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), color: FlutterFlowTheme.of( context) @@ -586,7 +592,8 @@ class _SignInTemplateComponentWidgetState 'Plus Jakarta Sans'), ), elevation: 3.0, - borderSide: const BorderSide( + borderSide: + const BorderSide( color: Colors.transparent, width: 1.0, @@ -605,8 +612,9 @@ class _SignInTemplateComponentWidgetState ), ), Padding( - padding: const EdgeInsetsDirectional - .fromSTEB( + padding: + const EdgeInsetsDirectional + .fromSTEB( 0.0, 0.0, 0.0, 16.0), child: FFButtonWidget( onPressed: () async { @@ -624,18 +632,12 @@ class _SignInTemplateComponentWidgetState height: 44.0, padding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), iconPadding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), color: FlutterFlowTheme.of( context) @@ -662,7 +664,8 @@ class _SignInTemplateComponentWidgetState 'Plus Jakarta Sans'), ), elevation: 3.0, - borderSide: const BorderSide( + borderSide: + const BorderSide( color: Colors.transparent, width: 1.0, @@ -687,20 +690,21 @@ class _SignInTemplateComponentWidgetState padding: const EdgeInsetsDirectional .fromSTEB(0.0, 0.0, - 0.0, 16.0), + 0.0, 16.0), child: FFButtonWidget( onPressed: (((_model.emailAddressTextController - .text == - '') || + .text == + '') || ((_model.emailAddressFocusNode ?.hasFocus ?? false) != null)) && ((_model.emailAddressTextController + .text == + '') || + ((_model.passwordTextController .text == '') || - ((_model.passwordTextController.text == - '') || ((_model.passwordFocusNode?.hasFocus ?? false) != null)))) @@ -728,18 +732,12 @@ class _SignInTemplateComponentWidgetState height: 44.0, padding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), iconPadding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), color: FlutterFlowTheme.of( context) @@ -767,7 +765,8 @@ class _SignInTemplateComponentWidgetState 'Plus Jakarta Sans'), ), elevation: 3.0, - borderSide: const BorderSide( + borderSide: + const BorderSide( color: Colors .transparent, width: 1.0, @@ -776,7 +775,8 @@ class _SignInTemplateComponentWidgetState BorderRadius .circular(12.0), disabledColor: - const Color(0xE81AAB5F), + const Color( + 0xE81AAB5F), ), showLoadingIndicator: false, @@ -788,7 +788,7 @@ class _SignInTemplateComponentWidgetState padding: const EdgeInsetsDirectional .fromSTEB(0.0, 0.0, - 0.0, 16.0), + 0.0, 16.0), child: FFButtonWidget( onPressed: () async { await widget @@ -805,18 +805,12 @@ class _SignInTemplateComponentWidgetState height: 44.0, padding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), iconPadding: const EdgeInsetsDirectional - .fromSTEB( - 0.0, - 0.0, - 0.0, - 0.0), + .fromSTEB(0.0, + 0.0, 0.0, 0.0), color: FlutterFlowTheme.of( context) @@ -844,7 +838,8 @@ class _SignInTemplateComponentWidgetState 'Plus Jakarta Sans'), ), elevation: 3.0, - borderSide: const BorderSide( + borderSide: + const BorderSide( color: Colors .transparent, width: 1.0, @@ -858,7 +853,8 @@ class _SignInTemplateComponentWidgetState ), ), ), - ].divide(const SizedBox(width: 7.0)), + ].divide( + const SizedBox(width: 7.0)), ); } }, @@ -866,8 +862,8 @@ class _SignInTemplateComponentWidgetState // You will have to add an action on this rich text to go to your login page. Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 12.0, 0.0, 12.0), + padding: const EdgeInsetsDirectional + .fromSTEB(0.0, 12.0, 0.0, 12.0), child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, @@ -879,14 +875,35 @@ class _SignInTemplateComponentWidgetState backgroundColor: Colors.transparent, enableDrag: false, + useSafeArea: true, context: context, builder: (context) { - return Padding( - padding: - MediaQuery.viewInsetsOf( - context), - child: - const ForgotPasswordTemplateComponentWidget(), + return GestureDetector( + onTap: () => _model + .unfocusNode + .canRequestFocus + ? FocusScope.of(context) + .requestFocus(_model + .unfocusNode) + : FocusScope.of(context) + .unfocus(), + child: SizedBox( + height: + MediaQuery.of(context) + .size + .height, + width: + MediaQuery.of(context) + .size + .width, + child: Padding( + padding: MediaQuery + .viewInsetsOf( + context), + child: + const ForgotPasswordTemplateComponentWidget(), + ), + ), ); }, ).then( 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 460ef502..6d8138cb 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 @@ -1,4 +1,3 @@ - import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart'; import 'package:hub/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart'; @@ -9,8 +8,6 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:hub/flutter_flow/internationalization.dart'; - - import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -69,171 +66,167 @@ class _VisitorSearchModalTemplateComponentWidgetState Widget build(BuildContext context) { context.watch(); - return Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 300.0, 0.0, 0.0), - child: Container( - width: double.infinity, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), + return Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 50.0, 0.0, 0.0), + child: Container( + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(0.0), + bottomRight: Radius.circular(0.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), ), - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsetsDirectional.fromSTEB(16.0, 10.0, 16.0, 0.0), - child: TextFormField( - controller: _model.textController, - focusNode: _model.textFieldFocusNode, - onFieldSubmitted: (_) async { - setState(() { - _model.textController?.text = valueOrDefault( - _model.textController.text, - '69696777', - ); - _model.textController?.selection = - TextSelection.collapsed( - offset: _model.textController!.text.length); - }); - _model.getVisitorByDoc = - await PhpGroup.getVisitorByDocCall.call( - devUUID: FFAppState().devUUID, - userUUID: FFAppState().userUUID, - cliID: FFAppState().cliUUID, - atividade: 'getVisitante', - documento: _model.textController.text, + ), + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(16.0, 10.0, 16.0, 0.0), + child: TextFormField( + controller: _model.textController, + focusNode: _model.textFieldFocusNode, + onFieldSubmitted: (_) async { + setState(() { + _model.textController?.text = valueOrDefault( + _model.textController.text, + '69696777', ); + _model.textController?.selection = TextSelection.collapsed( + offset: _model.textController!.text.length); + }); + _model.getVisitorByDoc = + await PhpGroup.getVisitorByDocCall.call( + devUUID: FFAppState().devUUID, + userUUID: FFAppState().userUUID, + cliID: FFAppState().cliUUID, + atividade: 'getVisitante', + documento: _model.textController.text, + ); - if (PhpGroup.getVisitorByDocCall.vistanteId( - (_model.getVisitorByDoc?.jsonBody ?? ''), - ) != - '0') { - _model - .addToVisitors(PhpGroup.getVisitorByDocCall.visitante( + if (PhpGroup.getVisitorByDocCall.vistanteId( (_model.getVisitorByDoc?.jsonBody ?? ''), - )); - setState(() {}); - _model.addToDocs(_model.textController.text); - setState(() {}); - } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: const VisitorNotFoundComponentWidget(), - ); - }, - ).then((value) => safeSetState(() {})); - } - + ) != + '0') { + _model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante( + (_model.getVisitorByDoc?.jsonBody ?? ''), + )); setState(() {}); - }, - autofocus: false, - textInputAction: TextInputAction.done, - obscureText: false, - decoration: InputDecoration( - isDense: false, - labelText: FFLocalizations.of(context).getText( - 'cjlpru1m' /* Procure pelo documento do visi... */, - ), - 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), - ), - hintText: FFLocalizations.of(context).getText( - '8i1qszba' /* test */, - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).accent1, - width: 0.5, - ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(15.0), - bottomRight: Radius.circular(15.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(15.0), - bottomRight: Radius.circular(15.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(15.0), - bottomRight: Radius.circular(15.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(15.0), - bottomRight: Radius.circular(15.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), - ), - filled: true, - fillColor: FlutterFlowTheme.of(context).primaryBackground, - prefixIcon: Icon( - Icons.search_outlined, - color: FlutterFlowTheme.of(context).accent1, - ), + _model.addToDocs(_model.textController.text); + setState(() {}); + } else { + await showModalBottomSheet( + isScrollControlled: true, + enableDrag: true, + isDismissible: true, + backgroundColor: Colors.transparent, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: const VisitorNotFoundComponentWidget(), + ); + }, + ).then((value) => safeSetState(() {})); + } + + setState(() {}); + }, + autofocus: false, + textInputAction: TextInputAction.done, + obscureText: false, + decoration: InputDecoration( + isDense: false, + labelText: FFLocalizations.of(context).getText( + 'cjlpru1m' /* Procure pelo documento do visi... */, ), - style: FlutterFlowTheme.of(context).bodyMedium.override( + labelStyle: FlutterFlowTheme.of(context).labelMedium.override( fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, + FlutterFlowTheme.of(context).labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), + FlutterFlowTheme.of(context).labelMediumFamily), ), - keyboardType: TextInputType.number, - validator: - _model.textControllerValidator.asValidator(context), + hintText: FFLocalizations.of(context).getText( + '8i1qszba' /* test */, + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent1, + width: 0.5, + ), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15.0), + bottomRight: Radius.circular(15.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), + ), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15.0), + bottomRight: Radius.circular(15.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), + ), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15.0), + bottomRight: Radius.circular(15.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), + ), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15.0), + bottomRight: Radius.circular(15.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), + ), + ), + filled: true, + fillColor: FlutterFlowTheme.of(context).primaryBackground, + prefixIcon: Icon( + Icons.search_outlined, + color: FlutterFlowTheme.of(context).accent1, + ), ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), + ), + keyboardType: TextInputType.number, + validator: _model.textControllerValidator.asValidator(context), ), + ), + if (_model.visitors.isNotEmpty && _model.visitors.length > 0) Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, children: [ Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(16.0, 12.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 16.0, 12.0, 0.0, 0.0), child: Text( FFLocalizations.of(context).getText( '9coywebh' /* Visitantes encontrados */, @@ -249,12 +242,10 @@ class _VisitorSearchModalTemplateComponentWidgetState ), ), Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(4.0, 12.0, 16.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 4.0, 12.0, 16.0, 0.0), child: Text( - FFLocalizations.of(context).getText( - '6f5p0fv6' /* 24 */, - ), + _model.visitors.length.toString(), style: FlutterFlowTheme.of(context).bodyMedium.override( fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily, @@ -266,273 +257,270 @@ class _VisitorSearchModalTemplateComponentWidgetState ), ], ), - Expanded( - child: Builder( - builder: (context) { - if (_model.visitors.isNotEmpty) { - return Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(8.0, 8.0, 8.0, 0.0), - child: Builder( - builder: (context) { - final visitor = - _model.visitors.map((e) => e).toList(); + Expanded( + child: Builder( + builder: (context) { + if (_model.visitors.isNotEmpty) { + return Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 8.0, 8.0, 0.0), + child: Builder( + builder: (context) { + final visitor = + _model.visitors.map((e) => e).toList(); - return ListView.builder( - padding: EdgeInsets.zero, - scrollDirection: Axis.vertical, - itemCount: visitor.length, - itemBuilder: (context, visitorIndex) { - final visitorItem = visitor[visitorIndex]; - return Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 1.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - await showModalBottomSheet( - isScrollControlled: true, - enableDrag: false, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf( - context), - child: const SizedBox( - height: 610.0, - child: - VisitorDetailsModalTemplateComponentWidget(), - ), - ); - }, - ).then((value) => safeSetState(() {})); - }, - child: Container( - width: 100.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context) - .secondaryBackground, - boxShadow: [ - BoxShadow( - blurRadius: 0.0, - color: FlutterFlowTheme.of(context) - .alternate, - offset: const Offset( - 0.0, - 1.0, - ), - ) - ], - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - ClipRRect( - borderRadius: - BorderRadius.circular(40.0), - child: CachedNetworkImage( - fadeInDuration: - const Duration(milliseconds: 500), - fadeOutDuration: - const Duration(milliseconds: 500), - imageUrl: - valueOrDefault( - 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( - visitorItem, - r'''$.VTE_DOCUMENTO''', - ).toString()}&tipo=E', - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', - ), - width: 60.0, - height: 60.0, - fit: BoxFit.cover, + return ListView.builder( + padding: EdgeInsets.zero, + scrollDirection: Axis.vertical, + itemCount: visitor.length, + itemBuilder: (context, visitorIndex) { + final visitorItem = visitor[visitorIndex]; + return Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 1.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + await showModalBottomSheet( + isScrollControlled: true, + enableDrag: false, + context: context, + builder: (context) { + return Padding( + padding: + MediaQuery.viewInsetsOf(context), + child: const SizedBox( + height: 610.0, + child: + VisitorDetailsModalTemplateComponentWidget(), + ), + ); + }, + ).then((value) => safeSetState(() {})); + }, + child: Container( + width: 100.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context) + .secondaryBackground, + boxShadow: [ + BoxShadow( + blurRadius: 0.0, + color: FlutterFlowTheme.of(context) + .alternate, + offset: const Offset( + 0.0, + 1.0, + ), + ) + ], + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + ClipRRect( + borderRadius: + BorderRadius.circular(40.0), + child: CachedNetworkImage( + fadeInDuration: const Duration( + milliseconds: 500), + fadeOutDuration: const Duration( + milliseconds: 500), + imageUrl: valueOrDefault( + "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + visitorItem, + r'''$.VTE_DOCUMENTO''', + ).toString()}&tipo=E", + 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', ), + width: 60.0, + height: 60.0, + fit: BoxFit.cover, ), - Expanded( - child: Column( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB(12.0, 0.0, - 0.0, 0.0), - child: Text( - valueOrDefault( - getJsonField( - visitorItem, - r'''$.VTE_NOME''', - )?.toString(), - 'NOT FOUND', - ), - style: - FlutterFlowTheme.of( - context) - .bodyLarge - .override( - fontFamily: FlutterFlowTheme.of( - context) - .bodyLargeFamily, - letterSpacing: - 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyLargeFamily), - ), + ), + Expanded( + child: Column( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 12.0, 0.0, 0.0, 0.0), + child: Text( + valueOrDefault( + getJsonField( + visitorItem, + r'''$.VTE_NOME''', + )?.toString(), + 'NOT FOUND', ), + style: FlutterFlowTheme.of( + context) + .bodyLarge + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyLargeFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyLargeFamily), + ), ), - Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB(4.0, 4.0, - 0.0, 0.0), - child: Row( - mainAxisSize: - MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Align( - alignment: - const AlignmentDirectional( - 0.0, -1.0), - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, - 0.0, - 0.0, - 0.0), - child: Text( - getJsonField( - visitorItem, - r'''$.VTE_TELEFONE''', - ).toString(), - style: FlutterFlowTheme - .of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - color: FlutterFlowTheme.of( - context) - .primary, - letterSpacing: - 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), - ), - ), + ), + Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 4.0, 4.0, 0.0, 0.0), + child: Row( + mainAxisSize: + MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Align( + alignment: + const AlignmentDirectional( + 0.0, -1.0), + child: Padding( + padding: + const EdgeInsetsDirectional + .fromSTEB( + 10.0, + 0.0, + 0.0, + 0.0), + child: Text( + getJsonField( + visitorItem, + r'''$.VTE_TELEFONE''', + ).toString(), + style: FlutterFlowTheme + .of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of( + context) + .bodyMediumFamily, + color: FlutterFlowTheme.of( + context) + .primary, + letterSpacing: + 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), ), ), - ], - ), + ), + ], ), - ], - ), + ), + ], ), - FlutterFlowIconButton( - borderRadius: 20.0, - borderWidth: 1.0, - buttonSize: 40.0, - icon: Icon( - Icons.restore_from_trash, - color: - FlutterFlowTheme.of(context) - .primary, - size: 20.0, - ), - onPressed: () async { - _model.removeFromVisitors( - visitorItem); - setState(() {}); - }, + ), + FlutterFlowIconButton( + borderRadius: 20.0, + borderWidth: 1.0, + buttonSize: 40.0, + icon: Icon( + Icons.restore_from_trash, + color: + FlutterFlowTheme.of(context) + .primary, + size: 20.0, ), - ], - ), + onPressed: () async { + _model.removeFromVisitors( + visitorItem); + setState(() {}); + }, + ), + ], ), ), ), - ); - }, - ); - }, - ), - ); - } else { - return Container( - width: 100.0, - height: 100.0, - decoration: BoxDecoration( - color: - FlutterFlowTheme.of(context).secondaryBackground, - ), - ); - } - }, - ), - ), - FFButtonWidget( - onPressed: () async { - await widget.getVisitors?.call( - _model.visitors, - ); - await widget.getDocs?.call( - _model.docs, - ); - Navigator.pop(context); - }, - text: FFLocalizations.of(context).getText( - 'ug6qzyla' /* Adicionar */, - ), - options: FFButtonOptions( - width: double.infinity, - height: 30.0, - padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.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: Colors.white, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).titleSmallFamily), + ), + ); + }, + ); + }, ), - elevation: 3.0, - borderSide: const BorderSide( - color: Colors.transparent, - width: 1.0, - ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), - ), + ); + } else { + return Container( + width: 100.0, + height: 100.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).secondaryBackground, + ), + ); + } + }, + ), + ), + FFButtonWidget( + onPressed: () async { + await widget.getVisitors?.call( + _model.visitors, + ); + await widget.getDocs?.call( + _model.docs, + ); + Navigator.pop(context); + }, + text: FFLocalizations.of(context).getText( + 'ug6qzyla' /* Adicionar */, + ), + options: FFButtonOptions( + width: double.infinity, + height: 30.0, + padding: + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.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: Colors.white, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).titleSmallFamily), + ), + elevation: 3.0, + borderSide: const BorderSide( + color: Colors.transparent, + width: 1.0, + ), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(0.0), + bottomRight: Radius.circular(0.0), + topLeft: Radius.circular(0.0), + topRight: Radius.circular(0.0), ), ), - ], - ), + ), + ], ), ), ); } -} \ No newline at end of file +} diff --git a/lib/flutter_flow/flutter_flow_util.dart b/lib/flutter_flow/flutter_flow_util.dart index e66e26b7..8a3cc1be 100644 --- a/lib/flutter_flow/flutter_flow_util.dart +++ b/lib/flutter_flow/flutter_flow_util.dart @@ -13,7 +13,6 @@ import 'package:url_launcher/url_launcher.dart'; import '../main.dart'; - export 'keep_alive_wrapper.dart'; export 'lat_lng.dart'; export 'place.dart'; @@ -87,6 +86,46 @@ Theme wrapInMaterialDatePickerTheme( return Theme( data: baseTheme.copyWith( + textSelectionTheme: baseTheme.textSelectionTheme.copyWith( + cursorColor: headerBackgroundColor, + selectionColor: headerBackgroundColor.withOpacity(0.4), + selectionHandleColor: headerBackgroundColor, + ), + inputDecorationTheme: baseTheme.inputDecorationTheme.copyWith( + isDense: true, + hoverColor: headerBackgroundColor.withOpacity(0.04), + floatingLabelStyle: baseTheme.textTheme.labelMedium!.copyWith( + color: headerBackgroundColor, + ), + labelStyle: baseTheme.textTheme.labelMedium!.copyWith( + color: headerBackgroundColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor.withOpacity(0.6), + ), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + ), colorScheme: baseTheme.colorScheme.copyWith( onSurface: pickerForegroundColor, ), @@ -149,9 +188,54 @@ Theme wrapInMaterialTimePickerTheme( final baseTheme = Theme.of(context); return Theme( data: baseTheme.copyWith( + focusColor: headerBackgroundColor, iconTheme: baseTheme.iconTheme.copyWith( size: iconSize, ), + textSelectionTheme: baseTheme.textSelectionTheme.copyWith( + cursorColor: headerBackgroundColor, + selectionColor: headerBackgroundColor.withOpacity(0.4), + selectionHandleColor: headerBackgroundColor, + ), + inputDecorationTheme: baseTheme.inputDecorationTheme.copyWith( + isDense: true, + focusColor: headerBackgroundColor, + hoverColor: headerBackgroundColor.withOpacity(0.04), + floatingLabelStyle: baseTheme.textTheme.labelMedium!.copyWith( + color: headerBackgroundColor, + ), + labelStyle: baseTheme.textTheme.labelMedium!.copyWith( + color: headerBackgroundColor, + ), + outlineBorder: BorderSide( + color: headerBackgroundColor, + ), + border: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor.withOpacity(0.6), + ), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: headerBackgroundColor, + ), + ), + ), textButtonTheme: TextButtonThemeData( style: ButtonStyle( foregroundColor: WidgetStatePropertyAll( @@ -169,6 +253,7 @@ Theme wrapInMaterialTimePickerTheme( })), ), timePickerTheme: baseTheme.timePickerTheme.copyWith( + hourMinuteColor: selectedDateTimeBackgroundColor, backgroundColor: pickerBackgroundColor, hourMinuteTextColor: pickerForegroundColor, dialHandColor: selectedDateTimeBackgroundColor, @@ -574,4 +659,4 @@ double computeGradientAlignmentY(double evaluatedAngle) { y = sin(2 * rads); } return double.parse(roundTo(y, 2)); -} \ No newline at end of file +} diff --git a/lib/pages/home_page/home_page_widget.dart b/lib/pages/home_page/home_page_widget.dart index 6955a811..6cf9f539 100644 --- a/lib/pages/home_page/home_page_widget.dart +++ b/lib/pages/home_page/home_page_widget.dart @@ -22,17 +22,11 @@ import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/home_page/home_page_model.dart'; - import 'package:provider/provider.dart'; - - class HomePageWidget extends StatefulWidget { const HomePageWidget({super.key}); - - - @override State createState() => _HomePageWidgetState(); } @@ -42,7 +36,6 @@ class _HomePageWidgetState extends State { bool localStatus = false; final scaffoldKey = GlobalKey(); - Future checkLocalStatus() async { localStatus = await checkLocals( context: context, @@ -57,9 +50,6 @@ class _HomePageWidgetState extends State { _model = createModel(context, () => HomePageModel()); SchedulerBinding.instance.addPostFrameCallback((_) async { await PushNotificationService().initialize(context); - - - @override void initState() { @@ -105,7 +95,6 @@ class _HomePageWidgetState extends State { @override Widget build(BuildContext context) { - context.watch(); return GestureDetector( onTap: () => _model.unfocusNode.canRequestFocus @@ -122,523 +111,485 @@ class _HomePageWidgetState extends State { Container buildPage(BuildContext context, bool localStatus) { return Container( - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, + 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(), + ], + ), + ], ), - 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(), - ], - ), - ], - ), - ), - ); + ), + ); } Wrap createBody() { return 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( - expandable: true, - style: MenuView.list_grid, - item: MenuItem.button, - ), - ), - 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, - ) - ], - ); + 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( + expandable: true, + style: MenuView.list_grid, + item: MenuItem.button, + ), + ), + 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, - ), - ); + 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, 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( - 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: - FlutterFlowTheme.of( - context) - .bodyMediumFamily, - color: FlutterFlowTheme - .of(context) - .info, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - ), - ), - ], - ), + 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, 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(0.0, 1.0), - child: Container( - width: 100.0, - height: 50.0, - decoration: const BoxDecoration(), - child: Align( - alignment: - 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, + ), + 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: FlutterFlowTheme.of(context) + .bodyMediumFamily, + color: FlutterFlowTheme.of(context).info, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), ), - onPressed: () { - log('IconButton pressed ...'); - }, - ), - ), ), ), - ], - ), + ), + ], ), ), - ], - ); + ), + ), + 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), + 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, + 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), ), - 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, - ), + 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, ), - Container( - width: 150.0, - child: Text( - valueOrDefault( - 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'), - ), + 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, ), - ].divide(const SizedBox(width: 20.0)), - ), + ), + Container( + width: 150.0, + child: Text( + valueOrDefault( + 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); - } - }, + ), + 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)), - ), + ), + ] + .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 + ].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) - .bodyMediumFamily, + .labelMediumFamily, + color: + FlutterFlowTheme.of(context).primaryText, letterSpacing: 0.0, useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), + .containsKey(FlutterFlowTheme.of(context) + .labelMediumFamily), ), - validator: _model.textControllerValidator - .asValidator(context), + 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)), - ), - ), - Expanded( - child: wrapWithModel( - model: _model.menuComponentModel, - updateCallback: () => setState(() {}), - child: MenuComponentWidget( - expandable: false, - style: MenuView.list, - item: MenuItem.card, - ), - ), - ), - 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), + ] + .addToStart(const SizedBox(width: 30.0)) + .addToEnd(const SizedBox(width: 30.0)), + ), + ), + Expanded( + child: wrapWithModel( + model: _model.menuComponentModel, + updateCallback: () => setState(() {}), + child: MenuComponentWidget( + expandable: false, + style: MenuView.list, + item: MenuItem.card, ), ), - - ].addToEnd(const SizedBox(height: 64.0)), ), - ), + 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)), ), - ); + ), + ), + ); // body: Container( // decoration: BoxDecoration( @@ -836,6 +787,5 @@ class _HomePageWidgetState extends State { // ), // ), // ); - } } diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index 4668af2e..cac62056 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -1,94 +1,159 @@ - import 'dart:developer'; - - import 'package:hub/app_state.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:flutter/material.dart'; import 'package:hub/components/templates_components/change_passs_qr_code_pass_key_template_component/change_pass_widget.dart'; +import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; +import 'package:share_plus/share_plus.dart'; class PreferencesPageModel with ChangeNotifier { final unfocusNode = FocusNode(); - Future toggleFingerprint(BuildContext context) async { - // FFAppState().checkBiometrics() // .then((value) => FFAppState().authenticateBiometric() // .then( (value) { // FFAppState().fingerprint = !FFAppState().fingerprint; - + // }) // .whenComplete(() => notifyListeners())); - if(FFAppState().fingerprint) { + if (FFAppState().fingerprint) { FFAppState().fingerprint = false; FFAppState().deleteFingerprintPass(); notifyListeners(); } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - useSafeArea: true, - context: context, - builder: (context) { - return Padding( - padding: - MediaQuery.viewInsetsOf(context), - child: - PassKeyTemplateWidget( - toggleActionStatus: (key) async { - log(key); - FFAppState().fingerprintPass = key; - FFAppState().fingerprint = true; - }, - ), - ); - }, - ).whenComplete(() => notifyListeners()); + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + useSafeArea: true, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: PassKeyTemplateWidget( + toggleActionStatus: (key) async { + log(key); + FFAppState().fingerprintPass = key; + FFAppState().fingerprint = true; + }, + ), + ); + }, + ).whenComplete(() => notifyListeners()); } - } void enablePerson(BuildContext context) { - notifyListeners(); ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(FFAppState().userDevUUID, style: TextStyle(color: FlutterFlowTheme.of(context).info) ), + SnackBar( + content: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(FFAppState().userDevUUID, + style: TextStyle(color: FlutterFlowTheme.of(context).info)), + FlutterFlowIconButton( + borderColor: Colors.transparent, + borderRadius: 20.0, + borderWidth: 1.0, + buttonSize: 40.0, + icon: Icon( + Icons.share, + color: FlutterFlowTheme.of(context).info, + size: 24.0, + ), + onPressed: () { + log('IconButton pressed ...'); + // Implement share functionality here + Share.share( + FFAppState().userDevUUID, + ); + }, + ), + ], + ), backgroundColor: FlutterFlowTheme.of(context).primary, duration: const Duration(seconds: 1), behavior: SnackBarBehavior.floating, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), - ), + ), ), ); } - void toggleNotify() { + void toggleNotify(BuildContext context) { FFAppState().notify = !FFAppState().notify; - PhpGroup.changeNotifica.call( + PhpGroup.changeNotifica + .call( userUUID: FFAppState().userUUID, devUUID: FFAppState().devUUID, cliID: FFAppState().cliUUID, atividade: 'updVisitado', notifica: FFAppState().notify ? 'S' : 'N', - ); + ) + .catchError((err) { + log(err.toString()); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Error changing notification', + ptText: 'Erro ao alterar notificação', + ), + style: TextStyle(color: FlutterFlowTheme.of(context).info)), + backgroundColor: FlutterFlowTheme.of(context).error, + duration: const Duration(seconds: 3), + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + ); + }); notifyListeners(); } - void localLogout(){ - PhpGroup.resopndeVinculo.call( + void localUnlink(BuildContext context) { + PhpGroup.resopndeVinculo + .call( userUUID: FFAppState().userUUID, devUUID: FFAppState().devUUID, cliID: FFAppState().cliUUID, tarefa: 'I', + ) + .catchError((err) { + log(err.toString()); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Error unlinking device', + ptText: 'Erro ao desvincular dispositivo', + ), + style: TextStyle(color: FlutterFlowTheme.of(context).info)), + backgroundColor: FlutterFlowTheme.of(context).error, + duration: const Duration(seconds: 3), + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + ); + }).then( + (value) { + FFAppState().deleteCliUUID(); + FFAppState().deleteLocal(); + FFAppState().deleteOwnerUUID(); + Navigator.pop(context); + }, ); notifyListeners(); } @@ -108,57 +173,99 @@ class PreferencesPageModel with ChangeNotifier { ); } - - Future togglePass(BuildContext context) async { + Future togglePass(BuildContext context) async { debugPrint('pass: ${FFAppState().pass}'); - if(FFAppState().pass) { + if (FFAppState().pass) { FFAppState().pass = false; FFAppState().deleteAccessPass(); notifyListeners(); } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - useSafeArea: true, - context: context, - builder: (context) { - return Padding( - padding: - MediaQuery.viewInsetsOf(context), - child: - PassKeyTemplateWidget( - toggleActionStatus: (key) async { - FFAppState().accessPass = key; + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + useSafeArea: true, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: PassKeyTemplateWidget( + toggleActionStatus: (key) async { + FFAppState().accessPass = key; notifyListeners(); debugPrint('key: $key'); - await PhpGroup.changePass.call( + await PhpGroup.changePass + .call( userUUID: FFAppState().userUUID, devUUID: FFAppState().devUUID, cliID: FFAppState().cliUUID, atividade: 'updVisitado', newSenha: FFAppState().accessPass, ) - .then((value) { + .then((value) { FFAppState().pass = true; // var error = jsonDecode(value.jsonBody['error'].toString()); // log('${jsonDecode(value.jsonBody['error'].toString())}'); - if(jsonDecode(value.jsonBody['error'].toString()) == false) { + if (jsonDecode(value.jsonBody['error'].toString()) == false) { FFAppState().pass = true; } else { FFAppState().pass = false; } - }) - .onError((error, StackTrace) { - FFAppState().pass = false; - log(error.toString()); - log(StackTrace.toString()); - }) - .whenComplete(() => notifyListeners()); - }, - ), - ); - }, - ); + }).onError((error, StackTrace) { + FFAppState().pass = false; + log(error.toString()); + log(StackTrace.toString()); + }).whenComplete(() => notifyListeners()); + }, + ), + ); + }, + ); + } + } + + Future togglePanic(BuildContext context) async { + if (FFAppState().panic) { + FFAppState().panic = false; + FFAppState().deletePanicPass(); + notifyListeners(); + } else { + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + useSafeArea: true, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: PassKeyTemplateWidget( + toggleActionStatus: (key) async { + FFAppState().panicPass = key; + notifyListeners(); + await PhpGroup.changePass + .call( + userUUID: FFAppState().userUUID, + devUUID: FFAppState().devUUID, + cliID: FFAppState().cliUUID, + atividade: 'updVisitado', + newSenha: FFAppState().panicPass, + ) + .then((value) { + FFAppState().panic = true; + if (jsonDecode(value.jsonBody['error'].toString()) == false) { + FFAppState().panic = true; + } else { + FFAppState().panic = false; + } + }).onError((e, s) { + FFAppState().panic = false; + log(e.toString()); + log(s.toString()); + }).whenComplete(() => notifyListeners()); + }, + ), + ); + }, + ); } } @@ -167,4 +274,4 @@ class PreferencesPageModel with ChangeNotifier { unfocusNode.dispose(); super.dispose(); } -} \ No newline at end of file +} diff --git a/lib/pages/preferences_settings_page/preferences_settings_widget.dart b/lib/pages/preferences_settings_page/preferences_settings_widget.dart index f2173bfd..8a036ed9 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_widget.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_widget.dart @@ -9,7 +9,6 @@ import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/preferences_settings_page/preferences_settings_model.dart'; import 'package:provider/provider.dart'; - class PreferencesPageWidget extends StatelessWidget { const PreferencesPageWidget({super.key}); @@ -46,7 +45,7 @@ class PreferencesPageWidget extends StatelessWidget { FFLocalizations.of(context).getVariableText( enText: 'Preferences', ptText: 'Preferências', - ), + ), style: FlutterFlowTheme.of(context).headlineMedium.override( fontFamily: 'Nunito', color: FlutterFlowTheme.of(context).primaryText, @@ -74,7 +73,7 @@ class PreferencesPageWidget extends StatelessWidget { // childAspectRatio: 1.0, // mainAxisExtent: 100.0, // ), - itemCount: 6, // Assuming 4 items for simplicity + itemCount: 7, // Assuming 4 items for simplicity padding: const EdgeInsets.symmetric(horizontal: 20.0), physics: const AlwaysScrollableScrollPhysics(), itemBuilder: (BuildContext context, int index) { @@ -90,82 +89,110 @@ class PreferencesPageWidget extends StatelessWidget { ); } - Widget _buildIconButton(BuildContext context, int index, PreferencesPageModel model) { + Widget _buildIconButton( + BuildContext context, int index, PreferencesPageModel model) { IconData icon; - Function() onPressed =() => {}; + Function() onPressed = () => {}; bool isEnabled; String content; switch (index) { case 0: icon = Icons.fingerprint; - onPressed = () => model.toggleFingerprint(context); // Disable if fingerprint is false + onPressed = () => + model.toggleFingerprint(context); // Disable if fingerprint is false isEnabled = FFAppState().fingerprint; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Ative a autenticação por impressão digital para login seguro.', + content = FFLocalizations.of(context).getVariableText( + ptText: + 'Ative a autenticação por impressão digital para login seguro.', enText: 'Enable fingerprint authentication for secure login.', - ); + ); break; case 1: icon = Icons.person; onPressed = () => model.enablePerson(context); isEnabled = FFAppState().person; - content = FFLocalizations.of(context).getVariableText( + content = FFLocalizations.of(context).getVariableText( ptText: 'Exibir código de identificação remota', enText: 'Display remote identification code', - ); + ); break; case 2: icon = Icons.notifications; - onPressed = model.toggleNotify; + onPressed = () => model.toggleNotify(context); isEnabled = FFAppState().notify; - content = FFLocalizations.of(context).getVariableText( + content = FFLocalizations.of(context).getVariableText( ptText: 'Ative para receber sua notificação de acesso', enText: 'Enable to receive your access notification', - ); + ); break; case 3: - icon = Icons.lock_clock_sharp; + icon = Icons.lock; // onLongPress = model.togglePass(context, model); isEnabled = FFAppState().pass; - content = FFLocalizations.of(context).getVariableText( + content = FFLocalizations.of(context).getVariableText( ptText: 'Ative para inserir uma credencial de acesso para o QRCode', enText: 'Enable to enter an access credential for the QRCode', - ); + ); break; case 4: - icon = Icons.landscape; - onPressed = model.localLogout; - isEnabled = false; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Ative para se desvincular do local selecionado', - enText: 'Enable to unlink from the selected location', - ); + icon = Icons.lock_clock_sharp; + // onLongPress = model.togglePass(context, model); + isEnabled = FFAppState().panic; + content = FFLocalizations.of(context).getVariableText( + ptText: 'Ative para inserir uma credencial de pânico para o QRCode', + enText: 'Enable to enter an panic credential for the QRCode', + ); break; case 5: + icon = Icons.landscape; + onPressed = () => model.localUnlink(context); + isEnabled = true; + content = FFLocalizations.of(context).getVariableText( + ptText: 'Desative para se desvincular do local selecionado', + enText: 'Enable to unlink from the selected location', + ); + break; + case 6: icon = Icons.delete; onPressed = () => model.deleteAccount(context); - isEnabled = false; - content = FFLocalizations.of(context).getVariableText( - ptText: 'Delete sua conta e todos os dados associados permanentemente.', + isEnabled = true; + content = FFLocalizations.of(context).getVariableText( + ptText: + 'Delete sua conta e todos os dados associados permanentemente.', enText: 'Delete your account and all associated data permanently.', - ); + ); break; default: throw Exception('Invalid index: $index'); } - return Container( + return SizedBox( height: 100, child: GestureDetector( - onTap: index != 3 ? onPressed : () {model.togglePass(context);}, + onTap: () { + switch (index) { + case 3: + model.togglePass(context); + break; + case 4: + model.togglePanic(context); + break; + default: + onPressed(); + } + }, child: Row( children: [ CircleAvatar( - backgroundColor: isEnabled ? FlutterFlowTheme.of(context).primary : FlutterFlowTheme.of(context).alternate, + backgroundColor: isEnabled + ? FlutterFlowTheme.of(context).primary + : FlutterFlowTheme.of(context).alternate, child: Icon( icon, - color: isEnabled ? FlutterFlowTheme.of(context).primaryBackground : FlutterFlowTheme.of(context).primary, + color: isEnabled + ? FlutterFlowTheme.of(context).primaryBackground + : FlutterFlowTheme.of(context).primary, // icon: Icon(icon, color: isEnabled ? FlutterFlowTheme.of(context).primaryBackground : FlutterFlowTheme.of(context).primary, size: 40.0), // onPressed: index != 3 ? onPressed : () {model.togglePass(context);}, // borderRadius: 20.0, @@ -181,13 +208,13 @@ class PreferencesPageWidget extends StatelessWidget { child: Text( content, style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: 'Nunito', - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontWeight: FontWeight.normal, - fontStyle: FontStyle.normal, - ), + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontWeight: FontWeight.normal, + fontStyle: FontStyle.normal, + ), overflow: TextOverflow.clip, ), ), @@ -196,4 +223,4 @@ class PreferencesPageWidget extends StatelessWidget { ), ); } -} \ No newline at end of file +} 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 7c216c8d..85e15627 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_model.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_model.dart @@ -1,3 +1,5 @@ +import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart'; + import '/backend/api_requests/api_calls.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/form_field_controller.dart'; @@ -8,108 +10,12 @@ class RegisterVisitorPageModel extends FlutterFlowModel { /// State fields for stateful widgets in this page. - final unfocusNode = FocusNode(); - bool isDataUploading = false; - FFUploadedFile uploadedLocalFile = - FFUploadedFile(bytes: Uint8List.fromList([])); - - // State field(s) for TextField widget. - FocusNode? textFieldFocusNode1; - TextEditingController? textController1; - String? Function(BuildContext, String?)? textController1Validator; - String? _textController1Validator(BuildContext context, String? val) { - if (val == null || val.isEmpty) { - return FFLocalizations.of(context).getVariableText( - enText: 'This field is required', - ptText: 'Este campo é obrigatório', - ); - } - return null; - } - // State field(s) for TextField widget. - FocusNode? textFieldFocusNode2; - TextEditingController? textController2; - String? Function(BuildContext, String?)? textController2Validator; - String? _textController2Validator(BuildContext context, String? val) { - if (val == null || val.isEmpty) { - return FFLocalizations.of(context).getVariableText( - enText: 'This field is required', - ptText: 'Este campo é obrigatório', - ); - } - return null; - } - // State field(s) for DropDown widget. - String? dropDownValue; - FormFieldController? dropDownValueController; - // State field(s) for TextField widget. - FocusNode? textFieldFocusNode3; - TextEditingController? textController3; - String? Function(BuildContext, String?)? textController3Validator; - String? _textController3Validator(BuildContext context, String? val) { - if (val == null || val.isEmpty) { - return FFLocalizations.of(context).getVariableText( - enText: 'This field is required', - ptText: 'Este campo é obrigatório', - ); - } - return null; - } - // State field(s) for TextField widget. - FocusNode? textFieldFocusNode4; - TextEditingController? textController4; - String? Function(BuildContext, String?)? textController4Validator; - String? _textController4Validator(BuildContext context, String? val) { - if (val == null || val.isEmpty) { - return FFLocalizations.of(context).getVariableText( - enText: 'This field is required', - ptText: 'Este campo é obrigatório', - ); - } - return null; - } - // Stores action output result for [Custom Action - convertImageFileToBase64] action in Button widget. - String? imgBase64; - // Stores action output result for [Backend Call - API (postScheduleVisitor)] action in Button widget. - ApiCallResponse? scheduleVisitor; + late RegisiterVistorTemplateComponentModel + regisiterVistorTemplateComponentModel; @override - void initState(BuildContext context) { - - textFieldFocusNode1 = FocusNode(); - textController1 = TextEditingController(); - textController1Validator = _textController1Validator; - - textFieldFocusNode2 = FocusNode(); - textController2 = TextEditingController(); - textController2Validator = _textController2Validator; - - - dropDownValue = ''; - // dropDownValueController = FormFieldController(initialValue: dropDownValue); - - textFieldFocusNode3 = FocusNode(); - textController3 = TextEditingController(); - textController3Validator = _textController3Validator; - - textFieldFocusNode4 = FocusNode(); - textController4 = TextEditingController(); - textController4Validator = _textController4Validator; - } + void initState(BuildContext context) {} @override - void dispose() { - unfocusNode.dispose(); - textFieldFocusNode1?.dispose(); - textController1?.dispose(); - - textFieldFocusNode2?.dispose(); - textController2?.dispose(); - - textFieldFocusNode3?.dispose(); - textController3?.dispose(); - - textFieldFocusNode4?.dispose(); - textController4?.dispose(); - } -} \ No newline at end of file + void dispose() {} +} 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 ea48ca5f..67eae017 100644 --- a/lib/pages/register_visitor_page/register_visitor_page_widget.dart +++ b/lib/pages/register_visitor_page/register_visitor_page_widget.dart @@ -1,17 +1,10 @@ -import 'package:hub/flutter_flow/nav/nav.dart'; - -import '/backend/api_requests/api_calls.dart'; -import '/components/molecular_components/throw_exception/throw_exception_widget.dart'; -import '/flutter_flow/flutter_flow_drop_down.dart'; -import '/flutter_flow/flutter_flow_icon_button.dart'; -import '/flutter_flow/flutter_flow_theme.dart'; -import '/flutter_flow/flutter_flow_util.dart'; -import '/flutter_flow/flutter_flow_widgets.dart'; -import '/flutter_flow/form_field_controller.dart'; -import '/flutter_flow/upload_data.dart'; -import '/custom_code/actions/index.dart' as actions; -import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; +import 'package:hub/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_widget.dart'; +import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; +import 'package:hub/flutter_flow/flutter_flow_theme.dart'; +import 'package:hub/flutter_flow/nav/nav.dart'; +import '/flutter_flow/flutter_flow_util.dart'; +import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'register_visitor_page_model.dart'; export 'register_visitor_page_model.dart'; @@ -33,18 +26,6 @@ class _RegisterVisitorPageWidgetState extends State { void initState() { super.initState(); _model = createModel(context, () => RegisterVisitorPageModel()); - - _model.textController1 ??= TextEditingController(); - _model.textFieldFocusNode1 ??= FocusNode(); - - _model.textController2 ??= TextEditingController(); - _model.textFieldFocusNode2 ??= FocusNode(); - - _model.textController3 ??= TextEditingController(); - _model.textFieldFocusNode3 ??= FocusNode(); - - _model.textController4 ??= TextEditingController(); - _model.textFieldFocusNode4 ??= FocusNode(); } @override @@ -57,878 +38,46 @@ class _RegisterVisitorPageWidgetState extends State { @override Widget build(BuildContext context) { context.watch(); - - return GestureDetector( - onTap: () => _model.unfocusNode.canRequestFocus - ? FocusScope.of(context).requestFocus(_model.unfocusNode) - : FocusScope.of(context).unfocus(), - child: Scaffold( - key: scaffoldKey, + return Scaffold( + appBar: AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, - appBar: AppBar( - backgroundColor: FlutterFlowTheme.of(context).primaryBackground, - automaticallyImplyLeading: false, - leading: FlutterFlowIconButton( - borderColor: Colors.transparent, - borderRadius: 30.0, - borderWidth: 1.0, - buttonSize: 60.0, - icon: Icon( - Icons.keyboard_arrow_left, - color: FlutterFlowTheme.of(context).primaryText, - size: 30.0, - ), - onPressed: () async { - context.pop(); - }, + automaticallyImplyLeading: false, + leading: FlutterFlowIconButton( + borderColor: Colors.transparent, + borderRadius: 30.0, + borderWidth: 1.0, + buttonSize: 60.0, + icon: Icon( + Icons.keyboard_arrow_left, + color: FlutterFlowTheme.of(context).primaryText, + size: 30.0, ), - title: Text( - FFLocalizations.of(context).getText( - 'megskb6s' /* Cadastro Visitante */, - ), - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 15.0, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).headlineMediumFamily), - ), - ), - actions: const [], - centerTitle: true, - elevation: 0.0, + onPressed: () async { + context.pop(); + }, ), - body: SafeArea( - top: true, - 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( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(25.0), - topRight: Radius.circular(25.0), - ), - ), - child: SingleChildScrollView( - child: Form( - // key: UniqueKey(), - autovalidateMode: AutovalidateMode.onUserInteraction, - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - 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: 200.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, 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, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - 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).customColor6, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.person, - color: FlutterFlowTheme.of(context).accent1, - ), - ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - maxLines: null, - keyboardType: TextInputType.name, - validator: _model.textController1Validator - .asValidator(context), - ), - ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController2, - focusNode: _model.textFieldFocusNode2, - autofocus: false, - 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).customColor6, - 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: Column( - children: [ - 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).customColor6, - 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)), - ), - if (_model.dropDownValue == null || - _model.dropDownValue == '') - Align( - alignment: const AlignmentDirectional(0.4, 0), - child: Text(FFLocalizations.of(context).getVariableText( - enText: 'This field is required', - ptText: 'Este campo é obrigatório', - ), - style: FlutterFlowTheme.of(context).bodySmall.override( - fontFamily: FlutterFlowTheme.of(context) - .bodySmallFamily, - color: FlutterFlowTheme.of(context).error, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodySmallFamily), - )), - ), - ], - ), - ), - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 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, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - 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 */, - ), - 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).customColor6, - 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), - ), - ), - 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).customColor6, - 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, 65.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', - ).onError((e, s) async { - return await showAdaptiveDialog( - context: context, - builder: (context) { - return GestureDetector( - onTap: () => Navigator.pop(context), - child: Padding( - padding: MediaQuery.viewInsetsOf(context), - child: Dialog( - child: ThrowExceptionWidget( - msg: FFLocalizations.of(context).getVariableText( - ptText: 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', - enText: 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', - ), - ), - ), - ), - ); - }, - ); - }); - - 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 showAdaptiveDialog( - 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: Dialog( - child: ThrowExceptionWidget( - msg:FFLocalizations.of(context).getVariableText( - ptText: 'Erro ao cadastrar visitante. Tente novamente.', - enText: 'Error registering visitor. Try again.', - ), - ), - ), - ), - ); - }, - ).then((value) => safeSetState(() {})); - } - } else { - await showAdaptiveDialog( - context: context, - builder: (context) { - return GestureDetector( - onTap: () => Navigator.pop(context), - child: Padding( - padding: MediaQuery.viewInsetsOf(context), - child: Dialog( - child: ThrowExceptionWidget( - msg: FFLocalizations.of(context).getVariableText( - ptText: 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', - enText: 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', - ), - ), - ), - ), - ); - }, - ).then((value) => safeSetState(() {})); - } - - 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, - ), - 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)) - .addToStart(const SizedBox(height: 30.0)), - ), - ), - ), - ), + title: Text( + FFLocalizations.of(context).getText( + 'megskb6s' /* Cadastro Visitante */, ), + style: FlutterFlowTheme.of(context).headlineMedium.override( + fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 15.0, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).headlineMediumFamily), + ), ), + actions: const [], + centerTitle: true, + elevation: 0.0, ), + body: const SafeArea( + top: true, + child: RegisiterVistorTemplateComponentWidget( + source: 'RegisterVisitorPage', + )), ); } -} \ No newline at end of file +} diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart index f5192ee5..1551cf20 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart @@ -4,7 +4,6 @@ import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/form_field_controller.dart'; import 'package:hub/flutter_flow/request_manager.dart'; - import 'package:flutter/material.dart'; import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'; @@ -51,6 +50,7 @@ class ScheduleCompleteVisitPageModel FocusNode? textFieldFocusNode1; TextEditingController? textController1; String? Function(BuildContext, String?)? textController1Validator; + DateTime? datePicked1; // State field(s) for TextField widget. FocusNode? textFieldFocusNode2; @@ -107,4 +107,4 @@ class ScheduleCompleteVisitPageModel return false; } -} \ No newline at end of file +} 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 8b684610..81708039 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,6 +1,5 @@ import 'dart:developer'; - import 'package:auto_size_text/auto_size_text.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; @@ -24,7 +23,6 @@ import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart'; import 'package:provider/provider.dart'; - class ScheduleCompleteVisitPageWidget extends StatefulWidget { const ScheduleCompleteVisitPageWidget({ super.key, @@ -111,7 +109,7 @@ class _ScheduleCompleteVisitPageWidgetState // Simulate fetching data from an API or database Future> fetchVisitHistory(int start, int limit) async { // Simulate network delay - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); // Generate a list of visit history items return List.generate(limit, (index) => "Item ${start + index}"); } @@ -163,7 +161,6 @@ class _ScheduleCompleteVisitPageWidgetState } } - PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) { return AppBar( backgroundColor: FlutterFlowTheme.of(context).primaryBackground, @@ -315,8 +312,8 @@ Widget scheduleVisit( padding: const EdgeInsets.fromLTRB( 0, 0, - 0, - 20.0, + 20, + 20, ), shrinkWrap: true, scrollDirection: Axis.vertical, @@ -362,14 +359,16 @@ Widget scheduleVisit( setState(() {}); }, child: Container( - width: 100.0, + width: MediaQuery.of(context).size.width, height: 70.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context) - .secondaryBackground, + .primaryBackground, ), child: Row( mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Container( width: 50.0, @@ -393,57 +392,35 @@ Widget scheduleVisit( fit: BoxFit.cover, ), ), - Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Text( - getJsonField( - visitorListViewItem, - r'''$.VTE_NOME''', - ).toString(), - style: - FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - Text( - getJsonField( - visitorListViewItem, - r'''$.VTE_TIPO''', - ).toString(), - style: - FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - ], + Text( + getJsonField( + visitorListViewItem, + r'''$.VTE_NOME''', + ).toString(), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of( + context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .bodyMediumFamily), + ), ), + IconButton( + onPressed: () async { + _model + .removeFromVisitorJsonList( + visitorListViewItem); + setState(() {}); + }, + icon: const Icon(Icons.close)), ] .divide(const SizedBox(width: 30.0)) .addToStart( @@ -466,10 +443,11 @@ Widget scheduleVisit( onPressed: () async { await showModalBottomSheet( isScrollControlled: true, + isDismissible: true, backgroundColor: FlutterFlowTheme.of(context) .primaryBackground, - enableDrag: false, + enableDrag: true, context: context, builder: (context) { return GestureDetector( @@ -480,25 +458,34 @@ Widget scheduleVisit( _model.unfocusNode) : FocusScope.of(context) .unfocus(), - child: Padding( - padding: MediaQuery.viewInsetsOf( - context), - child: - VisitorSearchModalTemplateComponentWidget( - getVisitors: - (visitorsParam) async { - _model.visitorJsonList = - visitorsParam! - .toList() - .cast(); - setState(() {}); - }, - getDocs: (docsParam) async { - _model.visitorStrList = - strListToStr( - docsParam!.toList()); - setState(() {}); - }, + child: SizedBox( + height: MediaQuery.of(context) + .size + .height * + 0.9, + width: MediaQuery.of(context) + .size + .width, + child: Padding( + padding: MediaQuery.viewInsetsOf( + context), + child: + VisitorSearchModalTemplateComponentWidget( + getVisitors: + (visitorsParam) async { + _model.visitorJsonList = + visitorsParam! + .toList() + .cast(); + setState(() {}); + }, + getDocs: (docsParam) async { + _model.visitorStrList = + strListToStr( + docsParam!.toList()); + setState(() {}); + }, + ), ), ), ); @@ -801,7 +788,7 @@ Widget scheduleVisit( pickerBackgroundColor: FlutterFlowTheme.of( context) - .secondaryBackground, + .primaryBackground, pickerForegroundColor: FlutterFlowTheme.of( context) @@ -822,7 +809,7 @@ Widget scheduleVisit( ); }, ); - + TimeOfDay? datePicked1Time; if (datePicked1Date != null) { datePicked1Time = @@ -868,7 +855,7 @@ Widget scheduleVisit( pickerBackgroundColor: FlutterFlowTheme.of( context) - .secondaryBackground, + .primaryBackground, pickerForegroundColor: FlutterFlowTheme.of( context) @@ -890,7 +877,7 @@ Widget scheduleVisit( }, ); } - + if (datePicked1Date != null && datePicked1Time != null) { safeSetState(() { @@ -1125,7 +1112,7 @@ Widget scheduleVisit( pickerBackgroundColor: FlutterFlowTheme.of( context) - .secondaryBackground, + .primaryBackground, pickerForegroundColor: FlutterFlowTheme.of( context) @@ -1146,7 +1133,7 @@ Widget scheduleVisit( ); }, ); - + TimeOfDay? datePicked2Time; if (datePicked2Date != null) { datePicked2Time = @@ -1192,7 +1179,7 @@ Widget scheduleVisit( pickerBackgroundColor: FlutterFlowTheme.of( context) - .secondaryBackground, + .primaryBackground, pickerForegroundColor: FlutterFlowTheme.of( context) @@ -1214,7 +1201,7 @@ Widget scheduleVisit( }, ); } - + if (datePicked2Date != null && datePicked2Time != null) { safeSetState(() { @@ -1563,12 +1550,58 @@ Widget scheduleVisit( onChanged: (newValue) async { setState(() => _model.switchValue = newValue); }, + applyCupertinoTheme: false, + focusColor: + FlutterFlowTheme.of(context).primary, + trackColor: WidgetStateProperty.resolveWith( + (states) { + if (states.contains(WidgetState.disabled)) { + return FlutterFlowTheme.of(context) + .alternate; + } + return FlutterFlowTheme.of(context) + .alternate; + }, + ), + hoverColor: FlutterFlowTheme.of(context) + .primaryBackground, + // thumbColor: WidgetStateColor.resolveWith( + // (states) { + // if (states.contains(WidgetState.disabled)) { + // return FlutterFlowTheme.of(context) + // .alternate; + // } + // return FlutterFlowTheme.of(context) + // .alternate; + // }, + // ), + overlayColor: WidgetStateProperty.resolveWith( + (states) { + if (states.contains(WidgetState.disabled)) { + return FlutterFlowTheme.of(context) + .accent4; + } + return FlutterFlowTheme.of(context) + .primaryBackground; + }, + ), + trackOutlineColor: + WidgetStateProperty.resolveWith( + (states) { + if (states.contains(WidgetState.disabled)) { + return FlutterFlowTheme.of(context) + .accent4; + } + return FlutterFlowTheme.of(context) + .primaryBackground; + }, + ), activeColor: FlutterFlowTheme.of(context).success, - activeTrackColor: - FlutterFlowTheme.of(context).customColor4, - inactiveTrackColor: - FlutterFlowTheme.of(context).customColor4, + activeTrackColor: FlutterFlowTheme.of(context) + .primaryBackground, + inactiveTrackColor: FlutterFlowTheme.of(context) + .primaryBackground, inactiveThumbColor: FlutterFlowTheme.of(context).error, ), @@ -1792,11 +1825,10 @@ Widget scheduleVisit( alignment: const AlignmentDirectional(0.0, 1.0), child: Align( alignment: const AlignmentDirectional(0.0, 0.0), - child: Icon( - Icons.save_alt, - color: FlutterFlowTheme.of(context).info, - size: 24.0, - ), + child: Text(FFLocalizations.of(context).getVariableText( + enText: 'Schedule', + ptText: 'Agendar', + )), ), ), ), @@ -1937,10 +1969,10 @@ Widget visitHistory( r'''$.VAW_OBS''', ).toString(), visitorImgPath: valueOrDefault( - 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( visitaWrapItem, r'''$.VTE_DOCUMENTO''', - ).toString()}&tipo=E', + ).toString()}&tipo=E", 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', ), visitorStrList: getJsonField( @@ -1972,8 +2004,8 @@ Widget visitHistory( }, child: Card( clipBehavior: Clip.antiAliasWithSaveLayer, - color: FlutterFlowTheme.of(context) - .secondaryBackground, + color: + FlutterFlowTheme.of(context).primaryBackground, elevation: 5.0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), @@ -1983,7 +2015,7 @@ Widget visitHistory( height: 115.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context) - .secondaryBackground, + .primaryBackground, ), child: Row( mainAxisSize: MainAxisSize.max, @@ -2193,8 +2225,8 @@ Widget visitHistory( return FlutterFlowTheme .of(context) .success; - } else if (( jsonToStr( - getJsonField( + } else if ((jsonToStr( + getJsonField( visitaWrapItem, r'''$.VAW_STATUS''', )) == @@ -2220,9 +2252,8 @@ Widget visitHistory( return FlutterFlowTheme .of(context) .error; - } else if ( - jsonToStr( - getJsonField( + } else if (jsonToStr( + getJsonField( visitaWrapItem, r'''$.VAW_STATUS''', )) == @@ -2261,9 +2292,8 @@ Widget visitHistory( ptText: 'Ativo', enText: 'Active', ); - } else if (( - jsonToStr( - getJsonField( + } else if ((jsonToStr( + getJsonField( visitaWrapItem, r'''$.VAW_STATUS''', )) == @@ -2360,6 +2390,4 @@ Widget visitHistory( ), ), ); - - -} \ No newline at end of file +} From 14d2c2f19e2bd82a757e8584c561cd78bb9b0525 Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Wed, 31 Jul 2024 12:00:25 -0300 Subject: [PATCH 03/10] fix message well, visitor register and preferences pages --- .../schedule_visit_detail_widget.dart | 101 +- ...siter_vistor_template_component_model.dart | 24 + ...iter_vistor_template_component_widget.dart | 922 +++--- .../view_visit_detail_widget.dart | 38 +- ...tails_modal_template_component_widget.dart | 358 +-- ...earch_modal_template_component_widget.dart | 230 +- .../message_history_page_model.dart | 12 +- .../message_history_page_widget.dart | 134 +- .../preferences_settings_model.dart | 37 +- .../preferences_settings_widget.dart | 4 +- .../schedule_complete_visit_page_model.dart | 93 +- .../schedule_complete_visit_page_widget.dart | 2676 ++++++++--------- 12 files changed, 2264 insertions(+), 2365 deletions(-) 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 935379ad..ad430d41 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 @@ -15,7 +15,6 @@ import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:provider/provider.dart'; - class ScheduleVisitDetailWidget extends StatefulWidget { const ScheduleVisitDetailWidget({ super.key, @@ -59,24 +58,22 @@ class _ScheduleVisitDetailWidgetState extends State { super.initState(); _model = createModel(context, () => ScheduleVisitDetailModel()); - _model.textController1 ??= - TextEditingController(text: widget.visitTempStr); + _model.textController1 ??= TextEditingController(text: widget.visitTempStr); _model.textFieldFocusNode1 ??= FocusNode(); _model.textController2 ??= TextEditingController(text: widget.visitStartDate); _model.textFieldFocusNode2 ??= FocusNode(); - _model.textController3 ??= - TextEditingController(text: widget.visitEndDate); + _model.textController3 ??= TextEditingController(text: widget.visitEndDate); _model.textFieldFocusNode3 ??= FocusNode(); - _model.textController4 ??= TextEditingController( - text: extractDescToStr(widget.visitResonStr!)); + _model.textController4 ??= + TextEditingController(text: extractDescToStr(widget.visitResonStr!)); _model.textFieldFocusNode4 ??= FocusNode(); - _model.textController5 ??= TextEditingController( - text: extractDescToStr(widget.visitLevelStr!)); + _model.textController5 ??= + TextEditingController(text: extractDescToStr(widget.visitLevelStr!)); _model.textFieldFocusNode5 ??= FocusNode(); _model.textController6 ??= TextEditingController(text: widget.visitObsStr); @@ -132,8 +129,8 @@ class _ScheduleVisitDetailWidgetState extends State { child: Align( alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(15.0, 0.0, 0.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 15.0, 0.0, 0.0, 0.0), child: FlutterFlowIconButton( borderRadius: 20.0, borderWidth: 1.0, @@ -192,41 +189,47 @@ class _ScheduleVisitDetailWidgetState extends State { BorderRadius.circular(100.0), ), child: Align( - alignment: - const AlignmentDirectional(1.0, -1.0), + alignment: const AlignmentDirectional( + 1.0, -1.0), child: InkWell( splashColor: Colors.transparent, focusColor: Colors.transparent, hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { - Navigator.pop(context); - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: - Colors.transparent, - useSafeArea: true, - context: context, - builder: (context) { - return Padding( - padding: - MediaQuery.viewInsetsOf( - context), - child: - const VisitorDetailsModalTemplateComponentWidget(), - ); - }, - ).then((value) => - safeSetState(() {})); + // Navigator.pop(context); + // await showModalBottomSheet( + // isScrollControlled: true, + // backgroundColor: + // Colors.transparent, + // useSafeArea: true, + // context: context, + // builder: (context) { + // return Padding( + // padding: + // MediaQuery.viewInsetsOf( + // context), + // child: + // VisitorDetailsModalTemplateComponentWidget( + // visitorImageURL: '', + // visitorEmail: '', + // visitorName: '', + // visitorPhone: '', + // visitorType: '', + // ), + // ); + // }, + // ).then((value) => + // safeSetState(() {})); }, child: ClipRRect( borderRadius: BorderRadius.circular(100.0), child: CachedNetworkImage( - fadeInDuration: - const Duration(milliseconds: 500), - fadeOutDuration: - const Duration(milliseconds: 500), + fadeInDuration: const Duration( + milliseconds: 500), + fadeOutDuration: const Duration( + milliseconds: 500), imageUrl: valueOrDefault( "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( @@ -352,8 +355,9 @@ class _ScheduleVisitDetailWidgetState extends State { children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController2, focusNode: _model.textFieldFocusNode2, @@ -459,8 +463,9 @@ class _ScheduleVisitDetailWidgetState extends State { ), Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController3, focusNode: _model.textFieldFocusNode3, @@ -576,8 +581,9 @@ class _ScheduleVisitDetailWidgetState extends State { children: [ Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController4, focusNode: _model.textFieldFocusNode4, @@ -683,8 +689,9 @@ class _ScheduleVisitDetailWidgetState extends State { ), Expanded( child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), child: TextFormField( controller: _model.textController5, focusNode: _model.textFieldFocusNode5, @@ -905,7 +912,8 @@ class _ScheduleVisitDetailWidgetState extends State { Align( alignment: const AlignmentDirectional(0.0, 1.0), child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 6.0, 0.0, 0.0), + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 6.0, 0.0, 0.0), child: Container( width: double.infinity, height: 35.0, @@ -934,8 +942,7 @@ class _ScheduleVisitDetailWidgetState extends State { dtInicio: widget.visitStartDate, dtFim: widget.visitEndDate, unica: widget.visitTempStr, - idMotivo: - extractIdToStr(widget.visitResonStr!), + idMotivo: extractIdToStr(widget.visitResonStr!), idNAC: extractIdToStr(widget.visitLevelStr!), obs: widget.visitObsStr, cliID: FFAppState().cliUUID, @@ -981,4 +988,4 @@ class _ScheduleVisitDetailWidgetState extends State { ), ); } -} \ No newline at end of file +} diff --git a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart index f0fffd4e..6e812792 100644 --- a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart +++ b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart @@ -1,3 +1,9 @@ +import 'dart:developer'; + +import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart'; +import 'package:hub/custom_code/actions/convert_image_file_to_base64.dart'; +import 'package:hub/flutter_flow/flutter_flow_theme.dart'; + import '/backend/api_requests/api_calls.dart'; import '/flutter_flow/flutter_flow_util.dart'; import '/flutter_flow/form_field_controller.dart'; @@ -25,6 +31,24 @@ class RegisiterVistorTemplateComponentModel ptText: 'Este campo é obrigatório', ); } + + return null; + } + + Future getVisitanteByDocument( + String document, BuildContext context) async { + final response = await PhpGroup.getVisitorByDocCall.call( + devUUID: FFAppState().devUUID, + userUUID: FFAppState().userUUID, + cliID: FFAppState().cliUUID, + atividade: 'getVisitante', + documento: document, + ); + log('${response.jsonBody}'); + if (response.jsonBody['visitante']['VTE_ID'] != '0' && + response.jsonBody['error'] != 'false') { + return true; + } return null; } 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 2b541bf5..b47c79ee 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 @@ -1,6 +1,9 @@ import 'dart:developer'; import 'package:flutter/services.dart'; +import 'package:hub/shared/utils/dialog_util.dart'; +import 'package:json_path/fun_sdk.dart'; +import 'package:rxdart/rxdart.dart'; import '/backend/api_requests/api_calls.dart'; import '/components/molecular_components/throw_exception/throw_exception_widget.dart'; @@ -15,6 +18,7 @@ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'regisiter_vistor_template_component_model.dart'; + export 'regisiter_vistor_template_component_model.dart'; class RegisiterVistorTemplateComponentWidget extends StatefulWidget { @@ -45,6 +49,7 @@ class _RegisiterVistorTemplateComponentWidgetState _model.textController2 ??= TextEditingController(); _model.textFieldFocusNode2 ??= FocusNode(); + _model.textController2?.addListener(_onTextChanged); _model.textController3 ??= TextEditingController(); _model.textFieldFocusNode3 ??= FocusNode(); @@ -58,10 +63,17 @@ class _RegisiterVistorTemplateComponentWidgetState _model.dispose(); super.dispose(); + _model.textController2?.removeListener(_onTextChanged); + } + + void _onTextChanged() { + log('changed'); + setState(() {}); } @override Widget build(BuildContext context) { + BehaviorSubject visitorAlreadyRegistered = BehaviorSubject(); context.watch(); log(context .describeWidget('RegisiterVistorTemplateComponentWidget') @@ -83,11 +95,360 @@ class _RegisiterVistorTemplateComponentWidgetState child: SingleChildScrollView( child: Form( // key: UniqueKey(), - autovalidateMode: AutovalidateMode.disabled, + autovalidateMode: AutovalidateMode.onUserInteraction, child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 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, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), + ), + ), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController2, + focusNode: _model.textFieldFocusNode2, + autovalidateMode: AutovalidateMode.onUserInteraction, + autofocus: false, + textCapitalization: TextCapitalization.none, + autofillHints: const [AutofillHints.password], + keyboardType: TextInputType.number, + 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).customColor6, + 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), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp('[0-9]')), + ], + ), + ), + FutureBuilder( + future: _model.textController2.text.isNotEmpty + ? _model.getVisitanteByDocument( + _model.textController2.text, context) + : null, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const SizedBox(); + } else if (snapshot.hasError || + snapshot.data == null || + snapshot.data == '') { + visitorAlreadyRegistered.add(true); + return const SizedBox(); + } else { + visitorAlreadyRegistered.add(false); + return _model.textController2.text.isEmpty + ? const SizedBox() + : Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: EdgeInsets.only( + right: MediaQuery.sizeOf(context).width * + 0.1), + child: Text( + FFLocalizations.of(context) + .getVariableText( + enText: 'Visitor already registered', + ptText: 'Visitante já cadastrado', + ), + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: 'Nunito', + color: FlutterFlowTheme.of(context) + .error, + fontSize: 14.0, + letterSpacing: 0.0, + )), + ), + ], + ); + } + }, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController1, + autovalidateMode: AutovalidateMode.onUserInteraction, + 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).customColor6, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(10.0), + ), + suffixIcon: Icon( + Icons.person, + color: FlutterFlowTheme.of(context).accent1, + ), + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), + ), + maxLines: null, + keyboardType: TextInputType.name, + validator: + _model.textController1Validator.asValidator(context), + ), + ), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), + child: Container( + width: MediaQuery.sizeOf(context).width * 0.95, + decoration: const BoxDecoration(), + child: Column( + children: [ + 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).customColor6, + 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)), + ), + if (_model.dropDownValue == null || + _model.dropDownValue == '') + Align( + alignment: const AlignmentDirectional(0.4, 0), + child: Text( + FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ), + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + color: FlutterFlowTheme.of(context) + .customColor6, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodySmallFamily), + )), + ), + ], + ), + ), + ), Builder( builder: (context) { if ((_model.uploadedLocalFile.bytes?.isNotEmpty ?? false)) { @@ -246,310 +607,7 @@ class _RegisiterVistorTemplateComponentWidgetState alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 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, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), - ), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController1, - autovalidateMode: AutovalidateMode.onUserInteraction, - 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).customColor6, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(10.0), - ), - suffixIcon: Icon( - Icons.person, - color: FlutterFlowTheme.of(context).accent1, - ), - ), - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).bodyMediumFamily), - ), - maxLines: null, - keyboardType: TextInputType.name, - validator: - _model.textController1Validator.asValidator(context), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController2, - focusNode: _model.textFieldFocusNode2, - autovalidateMode: AutovalidateMode.onUserInteraction, - autofocus: false, - textCapitalization: TextCapitalization.none, - autofillHints: const [AutofillHints.password], - keyboardType: TextInputType.number, - 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).customColor6, - 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), - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp('[0-9]')), - ], - ), - ), - 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: Column( - children: [ - 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).customColor6, - 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)), - ), - if (_model.dropDownValue == null || - _model.dropDownValue == '') - Align( - alignment: const AlignmentDirectional(0.4, 0), - child: Text( - FFLocalizations.of(context).getVariableText( - enText: 'This field is required', - ptText: 'Este campo é obrigatório', - ), - style: FlutterFlowTheme.of(context) - .bodySmall - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodySmallFamily, - color: FlutterFlowTheme.of(context) - .customColor6, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodySmallFamily), - )), - ), - ], - ), - ), - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 0.0, 0.0, 15.0), + 20.0, 10.0, 0.0, 15.0), child: Text( FFLocalizations.of(context).getText( 'bqpucwh0' /* Contatos */, @@ -735,155 +793,129 @@ class _RegisiterVistorTemplateComponentWidgetState padding: const EdgeInsetsDirectional.fromSTEB(0.0, 65.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: _model.textController2.text, - nome: _model.textController1.text, - tipo: _model.dropDownValue == - FFLocalizations.of(context).getText( - 'n8vddmcq' /* Visitante */, - ) - ? 'V' - : 'P', - foto: 'base64;jpeg,${_model.imgBase64}', - ) - .onError((e, s) async { - return await showAdaptiveDialog( - context: context, - builder: (context) { - return GestureDetector( - onTap: () => Navigator.pop(context), - child: Padding( - padding: MediaQuery.viewInsetsOf(context), - child: Dialog( - backgroundColor: Colors.transparent, - child: ThrowExceptionWidget( - msg: FFLocalizations.of(context) - .getVariableText( - ptText: - 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', - enText: - 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', + onPressed: (((_model.uploadedLocalFile.bytes?.isNotEmpty ?? + false)) && + (_model.textController1.text != '') && + (_model.dropDownValue != null && + _model.dropDownValue != '') && + (_model.textController2.text != '')) + ? () async { + log(visitorAlreadyRegistered.value.toString()); + if (visitorAlreadyRegistered.value == true) { + _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: _model.textController2.text, + nome: _model.textController1.text, + tipo: _model.dropDownValue == + FFLocalizations.of(context).getText( + 'n8vddmcq' /* Visitante */, + ) + ? 'V' + : 'P', + foto: 'base64;jpeg,${_model.imgBase64}', + ) + .onError((e, s) async { + return await showAdaptiveDialog( + context: context, + builder: (context) { + return GestureDetector( + onTap: () => Navigator.pop(context), + child: Padding( + padding: + MediaQuery.viewInsetsOf(context), + child: Dialog( + backgroundColor: Colors.transparent, + child: ThrowExceptionWidget( + msg: FFLocalizations.of(context) + .getVariableText( + ptText: + 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', + enText: + 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', + ), + ), + ), + ), + ); + }, + ); + }); + if (PhpGroup.postScheduleVisitorCall.error( + (_model.scheduleVisitor?.jsonBody ?? ''), + ) == + false) { + setState(() { + _model.textController1?.clear(); + _model.textController2?.clear(); + _model.textController3?.clear(); + _model.textController4?.clear(); + _model.dropDownValueController?.reset(); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + FFLocalizations.of(context).getVariableText( + ptText: + 'Visitante cadastrado com sucesso.', + enText: + 'Visitor successfully registered.'), + style: TextStyle( + color: + FlutterFlowTheme.of(context) + .info)), + backgroundColor: + FlutterFlowTheme.of(context).primary, + duration: const Duration(seconds: 3), + width: MediaQuery.of(context).size.width, + behavior: SnackBarBehavior.floating, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15), + ), ), ), - ), - ), - ); - }, - ); - }); - - if (PhpGroup.postScheduleVisitorCall.error( - (_model.scheduleVisitor?.jsonBody ?? ''), - ) == - false) { - setState(() { - _model.textController1?.clearComposing(); - _model.textController2?.clearComposing(); - _model.textController3?.clearComposing(); - _model.textController4?.clearComposing(); - _model.dropDownValueController?.reset(); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - FFLocalizations.of(context).getVariableText( - ptText: - 'Visitante cadastrado com sucesso.', - enText: - 'Visitor successfully registered.'), - style: TextStyle( - color: - FlutterFlowTheme.of(context).info)), - backgroundColor: - FlutterFlowTheme.of(context).primary, - duration: const Duration(seconds: 3), - behavior: SnackBarBehavior.floating, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30), - ), - ), - ); - if (widget.source == 'VisitorNotFoundComponent') { - Navigator.pop(context); + ); + if (widget.source == + 'VisitorNotFoundComponent') { + Navigator.pop(context); + } + }); + } else { + return DialogUtil.error( + context, + PhpGroup.postScheduleVisitorCall + .errorMsg( + _model.scheduleVisitor?.jsonBody) + .toString()); + } + } else { + DialogUtil.error( + context, + FFLocalizations.of(context).getVariableText( + ptText: + 'Visitante já cadastrado. Verifique se o documento foi preenchido corretamente.', + enText: + 'Visitor already registered. Check if the document was filled in correctly.', + )); } - }); - } else { - await showAdaptiveDialog( - 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: Dialog( - backgroundColor: Colors.transparent, - child: ThrowExceptionWidget( - msg: PhpGroup.postScheduleVisitorCall - .errorMsg(_model - .scheduleVisitor?.jsonBody) - .toString()), - ), - ), - ); - }, - ).then((value) => safeSetState(() {})); - } - } else { - await showAdaptiveDialog( - context: context, - builder: (context) { - return GestureDetector( - onTap: () { - Form.of(context)?.validate(); - Navigator.pop(context); - }, - child: Padding( - padding: MediaQuery.viewInsetsOf(context), - child: Dialog( - backgroundColor: Colors.transparent, - child: ThrowExceptionWidget( - msg: FFLocalizations.of(context) - .getVariableText( - ptText: - 'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.', - enText: - 'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.', - ), - ), - ), - ), - ); - }, - ).then((value) => safeSetState(() {})); - } - - setState(() {}); - }, + } + : null, text: FFLocalizations.of(context).getText( 'okbw0aiu' /* Cadastrar */, ), options: FFButtonOptions( width: 250.0, height: 36.0, + disabledColor: FlutterFlowTheme.of(context).customColor6, padding: const EdgeInsetsDirectional.fromSTEB( 80.0, 0.0, 80.0, 0.0), iconPadding: const EdgeInsetsDirectional.fromSTEB( diff --git a/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart b/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart index bea401b7..0b82c87a 100644 --- a/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart +++ b/lib/components/templates_components/view_visit_detail/view_visit_detail_widget.dart @@ -101,8 +101,7 @@ class _ViewVisitDetailWidgetState extends State { TextEditingController(text: widget.visitStartDate); _model.textFieldFocusNode2 ??= FocusNode(); - _model.textController3 ??= - TextEditingController(text: widget.visitEndDate); + _model.textController3 ??= TextEditingController(text: widget.visitEndDate); _model.textFieldFocusNode3 ??= FocusNode(); _model.textController4 ??= @@ -212,20 +211,26 @@ class _ViewVisitDetailWidgetState extends State { hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { - Navigator.pop(context); - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - useSafeArea: true, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: - const VisitorDetailsModalTemplateComponentWidget(), - ); - }, - ).then((value) => safeSetState(() {})); + // Navigator.pop(context); + // await showModalBottomSheet( + // isScrollControlled: true, + // backgroundColor: Colors.transparent, + // useSafeArea: true, + // context: context, + // builder: (context) { + // return Padding( + // padding: MediaQuery.viewInsetsOf(context), + // child: + // const VisitorDetailsModalTemplateComponentWidget( + // visitorImageURL: '', + // visitorEmail: '', + // visitorName: '', + // visitorPhone: '', + // visitorType: '', + // ), + // ); + // }, + // ).then((value) => safeSetState(() {})); }, child: ClipRRect( borderRadius: BorderRadius.circular(100.0), @@ -870,7 +875,6 @@ class _ViewVisitDetailWidgetState extends State { Share.share( 'Visita agendada para ${widget.visitStartDate} com término previsto para ${widget.visitEndDate}. Motivo: ${widget.visitReasonStr}. Nível de acesso: ${widget.visitLevelStr}. Observações: ${widget.visitObsStr}.', ); - }, ), ], diff --git a/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart b/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart index 5f29a6fe..307ba81b 100644 --- a/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart +++ b/lib/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart @@ -6,7 +6,19 @@ import 'visitor_details_modal_template_component_model.dart'; export 'visitor_details_modal_template_component_model.dart'; class VisitorDetailsModalTemplateComponentWidget extends StatefulWidget { - const VisitorDetailsModalTemplateComponentWidget({super.key}); + const VisitorDetailsModalTemplateComponentWidget( + {super.key, + required this.visitorImageURL, + required this.visitorName, + required this.visitorType, + required this.visitorPhone, + required this.visitorEmail}); + + final String? visitorImageURL; + final String? visitorName; + final String? visitorType; + final String? visitorPhone; + final String? visitorEmail; @override State createState() => @@ -50,20 +62,40 @@ class _VisitorDetailsModalTemplateComponentWidgetState color: FlutterFlowTheme.of(context).primaryBackground, borderRadius: BorderRadius.circular(25.0), ), - child: Stack( + child: Column( + mainAxisSize: MainAxisSize.max, children: [ - Align( - alignment: const AlignmentDirectional(0.0, 1.0), - child: Container( - width: double.infinity, - height: 34.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryText, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), + Container( + width: double.infinity, + height: 34.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryText, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(0.0), + bottomRight: Radius.circular(0.0), + topLeft: Radius.circular(25.0), + topRight: Radius.circular(25.0), + ), + shape: BoxShape.rectangle, + ), + child: Align( + alignment: const AlignmentDirectional(1.0, -1.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 10.0, 5.0, 15.0, 0.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + Navigator.pop(context); + }, + child: Icon( + Icons.close, + color: FlutterFlowTheme.of(context).primaryBackground, + size: 24.0, + ), ), ), ), @@ -71,68 +103,99 @@ class _VisitorDetailsModalTemplateComponentWidgetState Align( alignment: const AlignmentDirectional(0.0, -1.0), child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(20.0, 40.0, 20.0, 0.0), + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 40.0, 20.0, 0.0), child: Container( decoration: const BoxDecoration( shape: BoxShape.rectangle, ), - child: Stack( - children: [ - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 10.0, 0.0, 0.0), - child: Column( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 10.0, 0.0, 0.0), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + if (widget.visitorImageURL != '' && + widget.visitorImageURL != null) + Container( + width: 100.0, + height: 100.0, + clipBehavior: Clip.antiAlias, + decoration: const BoxDecoration( + shape: BoxShape.circle, + ), + child: Image.network( + widget.visitorImageURL!, + fit: BoxFit.cover, + ), + ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 0.0, 20.0, 0.0), + child: Text( + widget.visitorName ?? '', + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + fontSize: 24.0, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 0.0, 20.0, 30.0), + child: Text( + FFLocalizations.of(context).getText( + 'hz7ivuqn' /* Tipo de Visitante */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + Row( mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, children: [ - Container( - width: 100.0, - height: 100.0, - clipBehavior: Clip.antiAlias, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: Image.network( - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', - fit: BoxFit.cover, - ), + Icon( + Icons.phone, + color: FlutterFlowTheme.of(context).primary, + size: 24.0, ), Align( - alignment: const AlignmentDirectional(0.0, 0.0), + alignment: + const AlignmentDirectional(-1.0, 0.0), child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( 20.0, 0.0, 20.0, 0.0), child: Text( FFLocalizations.of(context).getText( - 'kqzf7nx2' /* Nome do Visitante */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - fontSize: 24.0, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 0.0, 20.0, 30.0), - child: Text( - FFLocalizations.of(context).getText( - 'hz7ivuqn' /* Tipo de Visitante */, + 'rwqn0det' /* (00) 0 0000-0000 */, ), textAlign: TextAlign.start, style: FlutterFlowTheme.of(context) @@ -151,128 +214,67 @@ class _VisitorDetailsModalTemplateComponentWidgetState ), ), ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Icon( - Icons.phone, - color: FlutterFlowTheme.of(context).primary, - size: 24.0, - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 0.0, 20.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - 'rwqn0det' /* (00) 0 0000-0000 */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - ), - ), - ], - ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Icon( - Icons.email, - color: FlutterFlowTheme.of(context).primary, - size: 24.0, - ), - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 0.0, 20.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - '0wqbiekp' /* email@provider.etc */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), - ), - ), - ], - ), ], ), - ), - ], - ), - ), - ), - ), - Align( - alignment: const AlignmentDirectional(-1.0, -1.0), - child: Container( - width: double.infinity, - height: 34.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryText, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(25.0), - topRight: Radius.circular(25.0), - ), - shape: BoxShape.rectangle, - ), - child: Align( - alignment: const AlignmentDirectional(1.0, -1.0), - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(10.0, 5.0, 15.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - Navigator.pop(context); - }, - child: Icon( - Icons.close, - color: FlutterFlowTheme.of(context).primaryBackground, - size: 24.0, - ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Icon( + Icons.email, + color: FlutterFlowTheme.of(context).primary, + size: 24.0, + ), + Align( + alignment: + const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 0.0, 20.0, 0.0), + child: Text( + FFLocalizations.of(context).getText( + '0wqbiekp' /* email@provider.etc */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + ], + ), + ], ), ), ), ), ), + // Align( + // alignment: const AlignmentDirectional(0.0, 1.0), + // child: Container( + // width: double.infinity, + // height: 34.0, + // decoration: BoxDecoration( + // color: FlutterFlowTheme.of(context).primaryText, + // borderRadius: const BorderRadius.only( + // bottomLeft: Radius.circular(0.0), + // bottomRight: Radius.circular(0.0), + // topLeft: Radius.circular(0.0), + // topRight: Radius.circular(0.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 6d8138cb..35b21ac6 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 @@ -47,12 +47,6 @@ class _VisitorSearchModalTemplateComponentWidgetState _model.textController ??= TextEditingController(); _model.textFieldFocusNode ??= FocusNode(); - - WidgetsBinding.instance.addPostFrameCallback((_) => setState(() { - _model.textController?.text = FFLocalizations.of(context).getText( - 'oj12tamm' /* test */, - ); - })); } @override @@ -91,10 +85,7 @@ class _VisitorSearchModalTemplateComponentWidgetState focusNode: _model.textFieldFocusNode, onFieldSubmitted: (_) async { setState(() { - _model.textController?.text = valueOrDefault( - _model.textController.text, - '69696777', - ); + _model.textController?.text = _model.textController.text; _model.textController?.selection = TextSelection.collapsed( offset: _model.textController!.text.length); }); @@ -268,7 +259,6 @@ class _VisitorSearchModalTemplateComponentWidgetState builder: (context) { final visitor = _model.visitors.map((e) => e).toList(); - return ListView.builder( padding: EdgeInsets.zero, scrollDirection: Axis.vertical, @@ -284,39 +274,42 @@ class _VisitorSearchModalTemplateComponentWidgetState hoverColor: Colors.transparent, highlightColor: Colors.transparent, onTap: () async { - await showModalBottomSheet( - isScrollControlled: true, - enableDrag: false, - context: context, - builder: (context) { - return Padding( - padding: - MediaQuery.viewInsetsOf(context), - child: const SizedBox( - height: 610.0, - child: - VisitorDetailsModalTemplateComponentWidget(), - ), - ); - }, - ).then((value) => safeSetState(() {})); + // await showModalBottomSheet( + // isScrollControlled: true, + // enableDrag: true, + // isDismissible: true, + // context: context, + // builder: (context) { + // return Padding( + // padding: + // MediaQuery.viewInsetsOf(context), + // child: SizedBox( + // height: 610.0, + // child: + // VisitorDetailsModalTemplateComponentWidget( + // visitorImageURL: + // "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + // visitorItem, + // r'''$.VTE_DOCUMENTO''', + // ).toString()}&tipo=E", + // visitorEmail: '', + // visitorName: getJsonField( + // visitorItem, + // r'''$.VTE_NOME''', + // )?.toString(), + // visitorPhone: '', + // visitorType: '', + // ), + // ), + // ); + // }, + // ).then((value) => safeSetState(() {})); }, child: Container( width: 100.0, decoration: BoxDecoration( color: FlutterFlowTheme.of(context) - .secondaryBackground, - boxShadow: [ - BoxShadow( - blurRadius: 0.0, - color: FlutterFlowTheme.of(context) - .alternate, - offset: const Offset( - 0.0, - 1.0, - ), - ) - ], + .primaryBackground, ), child: Padding( padding: const EdgeInsets.all(8.0), @@ -333,13 +326,11 @@ class _VisitorSearchModalTemplateComponentWidgetState milliseconds: 500), fadeOutDuration: const Duration( milliseconds: 500), - imageUrl: valueOrDefault( - "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( - visitorItem, - r'''$.VTE_DOCUMENTO''', - ).toString()}&tipo=E", - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', - ), + imageUrl: + "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + visitorItem, + r'''$.VTE_DOCUMENTO''', + ).toString()}&tipo=E", width: 60.0, height: 60.0, fit: BoxFit.cover, @@ -348,6 +339,8 @@ class _VisitorSearchModalTemplateComponentWidgetState Expanded( child: Column( mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -382,58 +375,6 @@ class _VisitorSearchModalTemplateComponentWidgetState ), ), ), - Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 4.0, 4.0, 0.0, 0.0), - child: Row( - mainAxisSize: - MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Align( - alignment: - const AlignmentDirectional( - 0.0, -1.0), - child: Padding( - padding: - const EdgeInsetsDirectional - .fromSTEB( - 10.0, - 0.0, - 0.0, - 0.0), - child: Text( - getJsonField( - visitorItem, - r'''$.VTE_TELEFONE''', - ).toString(), - style: FlutterFlowTheme - .of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of( - context) - .bodyMediumFamily, - color: FlutterFlowTheme.of( - context) - .primary, - letterSpacing: - 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - ], - ), - ), ], ), ), @@ -442,10 +383,10 @@ class _VisitorSearchModalTemplateComponentWidgetState borderWidth: 1.0, buttonSize: 40.0, icon: Icon( - Icons.restore_from_trash, + Icons.close, color: FlutterFlowTheme.of(context) - .primary, + .customColor6, size: 20.0, ), onPressed: () async { @@ -470,54 +411,65 @@ class _VisitorSearchModalTemplateComponentWidgetState width: 100.0, height: 100.0, decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).secondaryBackground, + color: FlutterFlowTheme.of(context).primaryBackground, ), ); } }, ), ), - FFButtonWidget( - onPressed: () async { - await widget.getVisitors?.call( - _model.visitors, - ); - await widget.getDocs?.call( - _model.docs, - ); - Navigator.pop(context); - }, - text: FFLocalizations.of(context).getText( - 'ug6qzyla' /* Adicionar */, - ), - options: FFButtonOptions( - width: double.infinity, - height: 30.0, - padding: - const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.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: Colors.white, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).titleSmallFamily), + Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + FFButtonWidget( + onPressed: () async { + await widget.getVisitors?.call( + _model.visitors, + ); + await widget.getDocs?.call( + _model.docs, + ); + Navigator.pop(context); + }, + text: FFLocalizations.of(context).getVariableText( + enText: 'Add', + ptText: 'Adicionar', + ), + options: FFButtonOptions( + width: MediaQuery.of(context).size.width * 0.3, + height: MediaQuery.of(context).size.width * 0.1, + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.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: Colors.white, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).titleSmallFamily), + ), + elevation: 3.0, + borderSide: const BorderSide( + color: Colors.transparent, + width: 1.0, ), - elevation: 3.0, - borderSide: const BorderSide( - color: Colors.transparent, - width: 1.0, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15), + bottomRight: Radius.circular(15), + topLeft: Radius.circular(15), + topRight: Radius.circular(15), + ), + ), ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), - ), - ), + ], ), + const SizedBox( + height: 10.0, + ) ], ), ), diff --git a/lib/pages/message_history_page/message_history_page_model.dart b/lib/pages/message_history_page/message_history_page_model.dart index 9a40e0c4..8d11df7b 100644 --- a/lib/pages/message_history_page/message_history_page_model.dart +++ b/lib/pages/message_history_page/message_history_page_model.dart @@ -1,15 +1,16 @@ +import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/request_manager.dart'; - import 'package:flutter/material.dart'; import 'package:hub/pages/message_history_page/message_history_page_widget.dart'; -class MessageHistoryPageModel extends FlutterFlowModel { +class MessageHistoryPageModel + extends FlutterFlowModel { /// State fields for stateful widgets in this page. - /// - + /// + //copyWith final unfocusNode = FocusNode(); @@ -49,9 +50,8 @@ class MessageHistoryPageModel extends FlutterFlowModel textController?.dispose(); tabBarController?.dispose(); - /// Dispose query cache managers for this widget. clearGetLiberationsCache(); } -} \ No newline at end of file +} 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 18cffa18..8d9d7d5c 100644 --- a/lib/pages/message_history_page/message_history_page_widget.dart +++ b/lib/pages/message_history_page/message_history_page_widget.dart @@ -12,7 +12,6 @@ import 'package:hub/flutter_flow/flutter_flow_util.dart'; import 'package:hub/flutter_flow/nav/nav.dart'; import 'package:hub/pages/message_history_page/message_history_page_model.dart'; - import 'package:flutter/material.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -26,7 +25,8 @@ class MessageHistoryPageWidget extends StatefulWidget { _MessageHistoryPageWidgetState(); } -class _MessageHistoryPageWidgetState extends State with TickerProviderStateMixin { +class _MessageHistoryPageWidgetState extends State + with TickerProviderStateMixin { late MessageHistoryPageModel _model; final scaffoldKey = GlobalKey(); @@ -36,7 +36,7 @@ class _MessageHistoryPageWidgetState extends State wit super.initState(); _model = createModel(context, () => MessageHistoryPageModel()); - _model.tabBarController = TabController( + _model.tabBarController = TabController( vsync: this, length: 3, initialIndex: 1, @@ -106,8 +106,7 @@ PreferredSizeWidget appBarMessage(BuildContext context) { ); } -Widget bodyMessage( - BuildContext context, MessageHistoryPageModel _model) { +Widget bodyMessage(BuildContext context, MessageHistoryPageModel _model) { return SafeArea( top: true, child: Column( @@ -155,33 +154,26 @@ Widget bodyMessage( }, ), ), - Expanded(child: TabBarView( - controller: _model.tabBarController, - children: [ - liberationDynamicListView(context, _model, 'P'), - liberationDynamicListView(context, _model, 'A'), - liberationDynamicListView(context, _model, 'T'), - ] - )), + Expanded( + child: TabBarView(controller: _model.tabBarController, children: [ + liberationDynamicListView(context, _model, 'P'), + liberationDynamicListView(context, _model, 'A'), + liberationDynamicListView(context, _model, 'T'), + ])), ].addToStart(const SizedBox(height: 0)), ), ); } - - - Widget liberationDynamicListView( - BuildContext context, - MessageHistoryPageModel _model, - String DestIndex -) { + BuildContext context, MessageHistoryPageModel _model, String DestIndex) { return Container( width: double.infinity, height: double.infinity, decoration: const BoxDecoration(), child: FutureBuilder( - future: PhpGroup.getMessagesCall.call( + future: PhpGroup.getMessagesCall + .call( devUUID: FFAppState().devUUID.toString(), userUUID: FFAppState().userUUID.toString(), cliID: FFAppState().cliUUID.toString(), @@ -189,7 +181,8 @@ Widget liberationDynamicListView( pageSize: '100', pageNumber: '1', tipoDestino: DestIndex, - ).catchError((error) { + ) + .catchError((error) { log('Error: ${error.toString()}'); return Future.delayed(Duration(seconds: 1), () { return Center( @@ -217,8 +210,15 @@ Widget liberationDynamicListView( child: Text('Erro ao carregar mensagens'), ); } + final mensagens = snapshot.data!.jsonBody['mensagens']; + final totalRows = snapshot.data!.jsonBody['total_rows']; + if (totalRows == 0 || mensagens == null || mensagens.isEmpty) { + return const Center( + child: Text('Nenhuma mensagem encontrada'), + ); + } return ListView.builder( - itemCount: snapshot.data!.jsonBody['total_rows'], + itemCount: totalRows, addAutomaticKeepAlives: false, addRepaintBoundaries: true, cacheExtent: 1000.0, @@ -234,8 +234,7 @@ Widget liberationDynamicListView( ); } -Widget messageHistoryItem( - BuildContext context, dynamic jsonBody) { +Widget messageHistoryItem(BuildContext context, dynamic jsonBody) { log(jsonBody.toString()); return Padding( padding: const EdgeInsets.symmetric(horizontal: 15), @@ -250,55 +249,60 @@ Widget messageHistoryItem( Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: const EdgeInsets.only(left: 15.0), - child: Text( - jsonBody['MSG_DATE'].toString(), - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: FlutterFlowTheme.of(context).primary, - overflow: TextOverflow.ellipsis, - ), - ), - ), - Icon( - jsonBody['MSG_DESTINO_TP'] == 'T' - ? Icons.group - : Icons.person, - color: FlutterFlowTheme.of(context).accent1, - ) - ], - ), - SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Text( - jsonBody['MSG_ORIGEM_DESC'].toString(), - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - color: FlutterFlowTheme.of(context).primary, + Row( + mainAxisAlignment: MainAxisAlignment.end, + mainAxisSize: MainAxisSize.max, + children: [ + Padding( + padding: const EdgeInsets.only(left: 15.0), + child: Text( + jsonBody['MSG_DATE'].toString(), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 10, + color: FlutterFlowTheme.of(context).customColor6, + overflow: TextOverflow.ellipsis, + ), ), - overflow: TextOverflow.fade, ), - ), + ], + ), + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 15.0), + child: Text( + jsonBody['MSG_ORIGEM_DESC'].toString(), + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 12, + color: FlutterFlowTheme.of(context).primary, + ), + overflow: TextOverflow.fade, + ), + ), + Icon( + jsonBody['MSG_DESTINO_TP'] == 'T' + ? Icons.group + : Icons.person, + color: FlutterFlowTheme.of(context).primary, + ), + ], ), ], ), SizedBox(height: 8), - Text(jsonBody['MSG_TEXTO'].toString(),), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + jsonBody['MSG_TEXTO'].toString(), + ), + ), + SizedBox(height: 8), ], ), ), ), ), ); - - -} \ No newline at end of file +} diff --git a/lib/pages/preferences_settings_page/preferences_settings_model.dart b/lib/pages/preferences_settings_page/preferences_settings_model.dart index cac62056..d7c05015 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_model.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_model.dart @@ -51,41 +51,8 @@ class PreferencesPageModel with ChangeNotifier { void enablePerson(BuildContext context) { notifyListeners(); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(FFAppState().userDevUUID, - style: TextStyle(color: FlutterFlowTheme.of(context).info)), - FlutterFlowIconButton( - borderColor: Colors.transparent, - borderRadius: 20.0, - borderWidth: 1.0, - buttonSize: 40.0, - icon: Icon( - Icons.share, - color: FlutterFlowTheme.of(context).info, - size: 24.0, - ), - onPressed: () { - log('IconButton pressed ...'); - // Implement share functionality here - Share.share( - FFAppState().userDevUUID, - ); - }, - ), - ], - ), - backgroundColor: FlutterFlowTheme.of(context).primary, - duration: const Duration(seconds: 1), - behavior: SnackBarBehavior.floating, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30), - ), - ), + Share.share( + FFAppState().userDevUUID, ); } diff --git a/lib/pages/preferences_settings_page/preferences_settings_widget.dart b/lib/pages/preferences_settings_page/preferences_settings_widget.dart index 8a036ed9..e0aa39c1 100644 --- a/lib/pages/preferences_settings_page/preferences_settings_widget.dart +++ b/lib/pages/preferences_settings_page/preferences_settings_widget.dart @@ -113,8 +113,8 @@ class PreferencesPageWidget extends StatelessWidget { onPressed = () => model.enablePerson(context); isEnabled = FFAppState().person; content = FFLocalizations.of(context).getVariableText( - ptText: 'Exibir código de identificação remota', - enText: 'Display remote identification code', + ptText: 'Compartilhe o código de identificação remota', + enText: 'Share the remote identification code', ); break; case 2: diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart index 1551cf20..d1ea6e19 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart @@ -1,11 +1,14 @@ +import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/form_field_controller.dart'; +import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/request_manager.dart'; import 'package:flutter/material.dart'; import 'package:hub/pages/schedule_complete_visit_page/schedule_complete_visit_page_widget.dart'; +import 'package:intl/intl.dart'; class ScheduleCompleteVisitPageModel extends FlutterFlowModel { @@ -37,6 +40,18 @@ class ScheduleCompleteVisitPageModel visitorJsonList[index] = updateFn(visitorJsonList[index]); String visitorStrList = '0'; + bool? dropDownValidator1; + bool? dropDownValidator2; + + bool isValid() { + if ((textController1!.text != '') && + (textController2!.text != '') && + (dropDownValue1 != null && dropDownValue1 != '') && + (dropDownValue2 != null && dropDownValue2 != '')) { + return true; + } + return false; + } /// State fields for stateful widgets in this page. @@ -50,16 +65,66 @@ class ScheduleCompleteVisitPageModel FocusNode? textFieldFocusNode1; TextEditingController? textController1; String? Function(BuildContext, String?)? textController1Validator; + String? _textController1Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required.', + ptText: 'Este campo é obrigatório.', + ); + } + if (val != null) { + try { + DateTime startDate = DateFormat('d/M/y H:mm:ss').parse(val); + DateTime endDate = + DateFormat('d/M/y H:mm:ss').parse(textController2!.text); + if (startDate.isAfter(endDate)) { + return FFLocalizations.of(context).getVariableText( + ptText: 'A data de início deve ser anterior à data de término.', + enText: 'Start date must be before end date.', + ); + } + } catch (e) { + return '$e'; + } + } + return null; + } DateTime? datePicked1; // State field(s) for TextField widget. FocusNode? textFieldFocusNode2; TextEditingController? textController2; String? Function(BuildContext, String?)? textController2Validator; + String? _textController2Validator(BuildContext context, String? val) { + if (val == null || val.isEmpty) { + return FFLocalizations.of(context).getVariableText( + enText: 'This field is required.', + ptText: 'Este campo é obrigatório.', + ); + } + if (val != null) { + try { + DateTime endDate = DateFormat('d/M/y H:mm:ss').parse(val); + DateTime startDate = + DateFormat('d/M/y H:mm:ss').parse(textController1!.text); + if (endDate.isBefore(startDate)) { + return FFLocalizations.of(context).getVariableText( + enText: 'End date must be after start date.', + ptText: 'A data de término deve ser posterior à data de início.', + ); + } + } catch (e) { + return '$e'; + } + } + return null; + } + DateTime? datePicked2; // State field(s) for DropDown widget. String? dropDownValue1; FormFieldController? dropDownValueController1; + // State field(s) for DropDown widget. String? dropDownValue2; FormFieldController? dropDownValueController2; @@ -69,9 +134,35 @@ class ScheduleCompleteVisitPageModel FocusNode? textFieldFocusNode3; TextEditingController? textController3; String? Function(BuildContext, String?)? textController3Validator; + String? _textController3Validator(BuildContext context, String? val) { + // if (val == null || val.isEmpty) { + // return FFLocalizations.of(context).getVariableText( + // enText: 'This field is required.', + // ptText: 'Este campo é obrigatório.', + // ); + // } + return null; + } @override - void initState(BuildContext context) {} + void initState(BuildContext context) { + tabBarController = TabController( + vsync: Navigator.of(context), + length: 2, + ); + + textFieldFocusNode1 = FocusNode(); + textController1 = TextEditingController(); + textController1Validator = _textController1Validator; + + textFieldFocusNode2 = FocusNode(); + textController2 = TextEditingController(); + textController2Validator = _textController2Validator; + + textFieldFocusNode3 = FocusNode(); + textController3 = TextEditingController(); + textController3Validator = _textController3Validator; + } @override void dispose() { 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 07a4c7ca..868ba7a8 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 @@ -7,7 +7,6 @@ import 'package:flutter/scheduler.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:hub/backend/api_requests/api_calls.dart'; -import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart'; import 'package:hub/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart'; @@ -264,155 +263,151 @@ Widget scheduleVisit( child: Column( mainAxisSize: MainAxisSize.max, children: [ - Stack( - children: [ - Container( - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - ), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column( - mainAxisSize: MainAxisSize.max, - children: [ - 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( - 'u0jocx7e' /* Quais visitantes você deseja c... */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), + Form( + autovalidateMode: AutovalidateMode.onUserInteraction, + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + mainAxisSize: MainAxisSize.max, + children: [ + 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( + 'u0jocx7e' /* Quais visitantes você deseja c... */, ), - if (_model.visitorJsonList.isNotEmpty) - Builder( - builder: (context) { - final visitorListView = - _model.visitorJsonList.map((e) => e).toList(); - return ListView.separated( - padding: const EdgeInsets.fromLTRB( - 0, - 0, - 20, - 20, + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + if (_model.visitorJsonList.isNotEmpty) + Builder( + builder: (context) { + final visitorListView = + _model.visitorJsonList.map((e) => e).toList(); + return ListView.separated( + padding: const EdgeInsets.fromLTRB( + 0, + 0, + 20, + 20, + ), + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: visitorListView.length, + separatorBuilder: (_, __) => + const SizedBox(height: 5.0), + itemBuilder: (context, visitorListViewIndex) { + final visitorListViewItem = + visitorListView[visitorListViewIndex]; + return InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + // 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: + // const VisitorDetailsModalTemplateComponentWidget( + // visitorImageURL: '', + // visitorEmail: '', + // visitorName: '', + // visitorPhone: '', + // visitorType: '', + // ), + // ), + // ); + // }, + // ).then((value) => safeSetState(() {})); + }, + onLongPress: () async { + // _model.removeFromVisitorJsonList( + // visitorListViewItem); + // setState(() {}); + }, + child: Container( + width: MediaQuery.of(context).size.width, + height: 70.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context) + .primaryBackground, ), - shrinkWrap: true, - scrollDirection: Axis.vertical, - itemCount: visitorListView.length, - separatorBuilder: (_, __) => - const SizedBox(height: 5.0), - itemBuilder: (context, visitorListViewIndex) { - final visitorListViewItem = - visitorListView[visitorListViewIndex]; - return InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - 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: - const VisitorDetailsModalTemplateComponentWidget(), - ), - ); - }, - ).then((value) => safeSetState(() {})); - }, - onLongPress: () async { - _model.removeFromVisitorJsonList( - visitorListViewItem); - setState(() {}); - }, - child: Container( - width: MediaQuery.of(context).size.width, - height: 70.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context) - .primaryBackground, + 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: CachedNetworkImage( + fadeInDuration: + const Duration(milliseconds: 500), + fadeOutDuration: + const Duration(milliseconds: 500), + imageUrl: + "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + visitorListViewItem, + r'''$.VTE_DOCUMENTO''', + ).toString()}&tipo=E", + fit: BoxFit.cover, + ), + ), + Text( + getJsonField( + visitorListViewItem, + r'''$.VTE_NOME''', + ).toString(), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + Expanded( child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.end, children: [ - Container( - width: 50.0, - height: 50.0, - clipBehavior: Clip.antiAlias, - decoration: const BoxDecoration( - shape: BoxShape.circle, - ), - child: CachedNetworkImage( - fadeInDuration: const Duration( - milliseconds: 500), - fadeOutDuration: const Duration( - milliseconds: 500), - imageUrl: valueOrDefault( - "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( - visitorListViewItem, - r'''$.VTE_DOCUMENTO''', - ).toString()}&tipo=E", - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', - ), - fit: BoxFit.cover, - ), - ), - Text( - getJsonField( - visitorListViewItem, - r'''$.VTE_NOME''', - ).toString(), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - ), IconButton( onPressed: () async { _model @@ -421,1239 +416,440 @@ Widget scheduleVisit( setState(() {}); }, icon: const Icon(Icons.close)), - ] - .divide(const SizedBox(width: 30.0)) - .addToStart( - const SizedBox(width: 30.0)), + ], + ), + ), + ] + .divide(const SizedBox(width: 30.0)) + .addToStart(const SizedBox(width: 30.0)), + ), + ), + ); + }, + ); + }, + ), + Stack( + children: [ + Align( + alignment: const AlignmentDirectional(0.01, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 20.0), + child: FFButtonWidget( + onPressed: () async { + await showModalBottomSheet( + isScrollControlled: true, + isDismissible: true, + backgroundColor: FlutterFlowTheme.of(context) + .primaryBackground, + enableDrag: true, + context: context, + builder: (context) { + return GestureDetector( + onTap: () => _model + .unfocusNode.canRequestFocus + ? FocusScope.of(context) + .requestFocus(_model.unfocusNode) + : FocusScope.of(context).unfocus(), + child: SizedBox( + height: + MediaQuery.of(context).size.height * + 0.9, + width: MediaQuery.of(context).size.width, + child: Padding( + padding: + MediaQuery.viewInsetsOf(context), + child: + VisitorSearchModalTemplateComponentWidget( + getVisitors: (visitorsParam) async { + _model.visitorJsonList = + visitorsParam! + .toList() + .cast(); + setState(() {}); + }, + getDocs: (docsParam) async { + _model.visitorStrList = + strListToStr( + docsParam!.toList()); + setState(() {}); + }, + ), ), ), ); }, - ); + ).then((value) => safeSetState(() {})); }, - ), - Stack( - children: [ - Align( - alignment: const AlignmentDirectional(0.01, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 20.0), - child: FFButtonWidget( - onPressed: () async { - await showModalBottomSheet( - isScrollControlled: true, - isDismissible: true, - backgroundColor: - FlutterFlowTheme.of(context) - .primaryBackground, - enableDrag: true, - context: context, - builder: (context) { - return GestureDetector( - onTap: () => _model - .unfocusNode.canRequestFocus - ? FocusScope.of(context) - .requestFocus( - _model.unfocusNode) - : FocusScope.of(context) - .unfocus(), - child: SizedBox( - height: MediaQuery.of(context) - .size - .height * - 0.9, - width: MediaQuery.of(context) - .size - .width, - child: Padding( - padding: MediaQuery.viewInsetsOf( - context), - child: - VisitorSearchModalTemplateComponentWidget( - getVisitors: - (visitorsParam) async { - _model.visitorJsonList = - visitorsParam! - .toList() - .cast(); - setState(() {}); - }, - getDocs: (docsParam) async { - _model.visitorStrList = - strListToStr( - docsParam!.toList()); - setState(() {}); - }, - ), - ), - ), - ); - }, - ).then((value) => safeSetState(() {})); - }, - text: '', - icon: Icon( - Icons.add, - color: FlutterFlowTheme.of(context).primary, - size: 30.0, - ), - options: FFButtonOptions( - width: - MediaQuery.sizeOf(context).width * 0.8, - 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), + text: '', + icon: Icon( + Icons.add, + color: FlutterFlowTheme.of(context).primary, + size: 30.0, + ), + options: FFButtonOptions( + width: MediaQuery.sizeOf(context).width * 0.8, + 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) - .primaryBackground, - textStyle: FlutterFlowTheme.of(context) - .titleSmall - .override( - fontFamily: + .primaryText, + fontSize: 16.0, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .titleSmallFamily), + ), + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).accent4, + width: 1.0, + ), + 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: Container( + width: MediaQuery.sizeOf(context).width * 0.8, + height: 20.0, + decoration: const BoxDecoration(), + child: Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: AutoSizeText( + FFLocalizations.of(context).getText( + 'r8soavtz' /* Clique para adicionar um visit... */, + ), + 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) - .titleSmallFamily, - color: FlutterFlowTheme.of(context) - .primaryText, - fontSize: 16.0, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .titleSmallFamily), - ), + .bodyMediumFamily), + ), + ), + ), + ), + ), + ), + ], + ), + ], + ), + Column(mainAxisSize: MainAxisSize.max, children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 24.0, 0.0, 24.0), + child: Text( + FFLocalizations.of(context).getText( + '98evnbbe' /* Qual o período de validade da ... */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).bodyMediumFamily), + ), + ), + ), + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width, + height: 60.0, + // decoration: const BoxDecoration(), + child: Stack( + children: [ + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: TextFormField( + controller: _model.textController1, + readOnly: true, + focusNode: _model.textFieldFocusNode1, + autovalidateMode: + AutovalidateMode.onUserInteraction, + 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), + ), + hintText: FFLocalizations.of(context).getText( + '53cbwqh9' /* Quando você inicia a visita? */, + ), + 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), + lineHeight: 1.0, + ), + enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: FlutterFlowTheme.of(context).accent4, - width: 1.0, + width: 0.5, ), borderRadius: BorderRadius.circular(8.0), ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + suffixIcon: Icon( + Icons.date_range, + color: FlutterFlowTheme.of(context).accent1, + ), ), - ), - ), - Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 50.0, 0.0, 0.0), - child: Container( - width: MediaQuery.sizeOf(context).width * 0.8, - height: 20.0, - decoration: const BoxDecoration(), - child: Align( - alignment: - const AlignmentDirectional(0.0, 0.0), - child: AutoSizeText( - FFLocalizations.of(context).getText( - 'r8soavtz' /* Clique para adicionar um visit... */, - ), - style: FlutterFlowTheme.of(context) - .bodyMedium + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + lineHeight: 1.8, + ), + textAlign: TextAlign.center, + validator: _model.textController1Validator + .asValidator(context)), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + final datePicked1Date = await showDatePicker( + context: context, + initialDate: getCurrentTimestamp, + firstDate: getCurrentTimestamp, + lastDate: DateTime(2050), + builder: (context, child) { + return wrapInMaterialDatePickerTheme( + context, + child!, + headerBackgroundColor: + FlutterFlowTheme.of(context).primary, + headerForegroundColor: + FlutterFlowTheme.of(context).info, + headerTextStyle: FlutterFlowTheme.of( + context) + .headlineLarge .override( fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - color: FlutterFlowTheme.of(context) - .primaryText, + .headlineLargeFamily, + fontSize: 32.0, letterSpacing: 0.0, + fontWeight: FontWeight.w600, useGoogleFonts: GoogleFonts.asMap() .containsKey( FlutterFlowTheme.of(context) - .bodyMediumFamily), + .headlineLargeFamily), ), - ), - ), - ), - ), - ), - ], - ), - ], - ), - Column( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 24.0, 0.0, 24.0), - child: Text( - FFLocalizations.of(context).getText( - '98evnbbe' /* Qual o período de validade da ... */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( + pickerBackgroundColor: + FlutterFlowTheme.of(context) + .primaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of(context).primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of(context).info, + actionButtonForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + iconSize: 24.0, + ); + }, + ); + + TimeOfDay? datePicked1Time; + if (datePicked1Date != null) { + datePicked1Time = await showTimePicker( + context: context, + initialTime: TimeOfDay.fromDateTime( + getCurrentTimestamp), + builder: (context, child) { + return wrapInMaterialTimePickerTheme( + context, + child!, + headerBackgroundColor: FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Row( - children: [ - Expanded( - child: Container( - width: 100.0, - height: 40.0, - decoration: const BoxDecoration(), - child: SizedBox( - height: double.infinity, - child: Stack( - children: [ - Padding( - padding: const EdgeInsetsDirectional - .fromSTEB(24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController1, - focusNode: _model.textFieldFocusNode1, - 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), - ), - hintText: - FFLocalizations.of(context) - .getText( - '53cbwqh9' /* Quando você inicia a visita? */, - ), - 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), - lineHeight: 1.0, - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .accent4, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedErrorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - suffixIcon: Icon( - Icons.date_range, - color: - FlutterFlowTheme.of(context) - .accent1, - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - lineHeight: 1.0, - ), - textAlign: TextAlign.center, - validator: _model - .textController1Validator - .asValidator(context), - ), - ), - Padding( - padding: const EdgeInsetsDirectional - .fromSTEB(24.0, 0.0, 24.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - final datePicked1Date = - await showDatePicker( - context: context, - initialDate: getCurrentTimestamp, - firstDate: getCurrentTimestamp, - lastDate: DateTime(2050), - builder: (context, child) { - return wrapInMaterialDatePickerTheme( - context, - child!, - headerBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - headerForegroundColor: - FlutterFlowTheme.of( - context) - .info, - headerTextStyle: - FlutterFlowTheme.of( - context) - .headlineLarge - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .headlineLargeFamily, - fontSize: 32.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w600, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .headlineLargeFamily), - ), - pickerBackgroundColor: - FlutterFlowTheme.of( - context) - .primaryBackground, - pickerForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - selectedDateTimeBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - selectedDateTimeForegroundColor: - FlutterFlowTheme.of( - context) - .info, - actionButtonForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - iconSize: 24.0, - ); - }, - ); - - TimeOfDay? datePicked1Time; - if (datePicked1Date != null) { - datePicked1Time = - await showTimePicker( - context: context, - initialTime: - TimeOfDay.fromDateTime( - getCurrentTimestamp), - builder: (context, child) { - return wrapInMaterialTimePickerTheme( - context, - child!, - headerBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - headerForegroundColor: - FlutterFlowTheme.of( - context) - .info, - headerTextStyle: - FlutterFlowTheme.of( - context) - .headlineLarge - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .headlineLargeFamily, - fontSize: 32.0, - letterSpacing: - 0.0, - fontWeight: - FontWeight - .w600, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .headlineLargeFamily), - ), - pickerBackgroundColor: - FlutterFlowTheme.of( - context) - .primaryBackground, - pickerForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - selectedDateTimeBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - selectedDateTimeForegroundColor: - FlutterFlowTheme.of( - context) - .info, - actionButtonForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - iconSize: 24.0, - ); - }, - ); - } - - if (datePicked1Date != null && - datePicked1Time != null) { - safeSetState(() { - _model.datePicked1 = DateTime( - datePicked1Date.year, - datePicked1Date.month, - datePicked1Date.day, - datePicked1Time!.hour, - datePicked1Time.minute, - ); - }); - } - setState(() { - _model.textController1?.text = - dateTimeFormat( - 'd/M/y H:mm:ss', - _model.datePicked1, - locale: - FFLocalizations.of(context) - .languageCode, - ); - _model.textController1 - ?.selection = - TextSelection.collapsed( - offset: _model - .textController1! - .text - .length); - }); - }, - child: Container( - width: double.infinity, - height: 55.0, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(8.0), - ), - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Container( - width: 100.0, - height: 40.0, - decoration: const BoxDecoration(), - child: SizedBox( - height: double.infinity, - child: Stack( - children: [ - Padding( - padding: const EdgeInsetsDirectional - .fromSTEB(24.0, 0.0, 24.0, 0.0), - child: TextFormField( - controller: _model.textController2, - focusNode: _model.textFieldFocusNode2, - 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), - ), - hintText: - FFLocalizations.of(context) - .getText( - 'xpgc5e8d' /* Quando a visita terminá? */, - ), - 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), - lineHeight: 1.0, - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .accent4, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedErrorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - suffixIcon: Icon( - Icons.date_range, - color: - FlutterFlowTheme.of(context) - .accent1, - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - lineHeight: 1.0, - ), - textAlign: TextAlign.center, - validator: _model - .textController2Validator - .asValidator(context), - ), - ), - Padding( - padding: const EdgeInsetsDirectional - .fromSTEB(24.0, 0.0, 24.0, 0.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - final datePicked2Date = - await showDatePicker( - context: context, - initialDate: getCurrentTimestamp, - firstDate: getCurrentTimestamp, - lastDate: DateTime(2050), - builder: (context, child) { - return wrapInMaterialDatePickerTheme( - context, - child!, - headerBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - headerForegroundColor: - FlutterFlowTheme.of( - context) - .info, - headerTextStyle: - FlutterFlowTheme.of( - context) - .headlineLarge - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .headlineLargeFamily, - fontSize: 32.0, - letterSpacing: 0.0, - fontWeight: - FontWeight.w600, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .headlineLargeFamily), - ), - pickerBackgroundColor: - FlutterFlowTheme.of( - context) - .primaryBackground, - pickerForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - selectedDateTimeBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - selectedDateTimeForegroundColor: - FlutterFlowTheme.of( - context) - .info, - actionButtonForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - iconSize: 24.0, - ); - }, - ); - - TimeOfDay? datePicked2Time; - if (datePicked2Date != null) { - datePicked2Time = - await showTimePicker( - context: context, - initialTime: - TimeOfDay.fromDateTime( - getCurrentTimestamp), - builder: (context, child) { - return wrapInMaterialTimePickerTheme( - context, - child!, - headerBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - headerForegroundColor: - FlutterFlowTheme.of( - context) - .info, - headerTextStyle: - FlutterFlowTheme.of( - context) - .headlineLarge - .override( - fontFamily: - FlutterFlowTheme.of( - context) - .headlineLargeFamily, - fontSize: 32.0, - letterSpacing: - 0.0, - fontWeight: - FontWeight - .w600, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .headlineLargeFamily), - ), - pickerBackgroundColor: - FlutterFlowTheme.of( - context) - .primaryBackground, - pickerForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - selectedDateTimeBackgroundColor: - FlutterFlowTheme.of( - context) - .primary, - selectedDateTimeForegroundColor: - FlutterFlowTheme.of( - context) - .info, - actionButtonForegroundColor: - FlutterFlowTheme.of( - context) - .primaryText, - iconSize: 24.0, - ); - }, - ); - } - - if (datePicked2Date != null && - datePicked2Time != null) { - safeSetState(() { - _model.datePicked2 = DateTime( - datePicked2Date.year, - datePicked2Date.month, - datePicked2Date.day, - datePicked2Time!.hour, - datePicked2Time.minute, - ); - }); - } - setState(() { - _model.textController2?.text = - dateTimeFormat( - 'd/M/y H:mm:ss', - _model.datePicked2, - locale: - FFLocalizations.of(context) - .languageCode, - ); - _model.textController2 - ?.selection = - TextSelection.collapsed( - offset: _model - .textController2! - .text - .length); - }); - }, - child: Container( - width: double.infinity, - height: 39.0, - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(8.0), - ), - ), - ), - ), - ], - ), - ), - ), - ), - ], - ), - ].divide(const SizedBox(height: 10.0)), - ), - Column( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 24.0, 0.0, 24.0), - child: Text( - FFLocalizations.of(context).getText( - '0meymh6u' /* Quais são os motivos da visita... */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: Container( - width: 100.0, - height: 40.0, - decoration: const BoxDecoration(), - child: FutureBuilder( - future: PhpGroup.getDadosCall.call( - devUUID: FFAppState().devUUID, - userUUID: FFAppState().userUUID, - cliUUID: FFAppState().cliUUID, - atividade: 'getDados', - ), - builder: (context, snapshot) { - // Customize what your widget looks like when it's loading. - if (!snapshot.hasData) { - return Center( - child: SizedBox( - width: 50.0, - height: 50.0, - child: SpinKitCircle( - color: - FlutterFlowTheme.of(context) - .primary, - size: 50.0, - ), - ), - ); - } - final dropDownGetDadosResponse = - snapshot.data!; - return FlutterFlowDropDown( - controller: - _model.dropDownValueController1 ??= - FormFieldController( - _model.dropDownValue1 ??= '', - ), - options: List.from( - PhpGroup.getDadosCall - .reasonsJsonList( - dropDownGetDadosResponse - .jsonBody, - )! - .map((e) => e.toString()) - .toList()), - optionLabels: PhpGroup.getDadosCall - .reasonsMotDescStrList( - dropDownGetDadosResponse.jsonBody, - )!, - onChanged: (val) => setState( - () => _model.dropDownValue1 = val), - width: double.infinity, - height: double.infinity, - textStyle: FlutterFlowTheme.of(context) - .bodyMedium + .primary, + headerForegroundColor: + FlutterFlowTheme.of(context).info, + headerTextStyle: FlutterFlowTheme.of( + context) + .headlineLarge .override( fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, + .headlineLargeFamily, + fontSize: 32.0, letterSpacing: 0.0, + fontWeight: FontWeight.w600, useGoogleFonts: GoogleFonts .asMap() .containsKey( FlutterFlowTheme.of( context) - .bodyMediumFamily), + .headlineLargeFamily), ), - hintText: - FFLocalizations.of(context).getText( - '6p3e0bzr' /* Escolha um motivo aqui */, - ), - icon: Icon( - Icons.keyboard_arrow_down_rounded, - color: FlutterFlowTheme.of(context) - .accent1, - size: 24.0, - ), - elevation: 2.0, - borderColor: + pickerBackgroundColor: FlutterFlowTheme.of(context) - .accent4, - borderWidth: 0.5, - borderRadius: 10.0, - margin: const EdgeInsetsDirectional - .fromSTEB(16.0, 0.0, 16.0, 0.0), - hidesUnderline: true, - isOverButton: true, - isSearchable: false, - isMultiSelect: false, + .primaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of(context) + .primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of(context).info, + actionButtonForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + iconSize: 24.0, ); }, - ), + ); + } + + if (datePicked1Date != null && + datePicked1Time != null) { + safeSetState(() { + _model.datePicked1 = DateTime( + datePicked1Date.year, + datePicked1Date.month, + datePicked1Date.day, + datePicked1Time!.hour, + datePicked1Time.minute, + ); + }); + } + setState(() { + _model.textController1?.text = dateTimeFormat( + 'd/M/y H:mm:ss', + _model.datePicked1, + locale: FFLocalizations.of(context) + .languageCode, + ); + _model.textController1?.selection = + TextSelection.collapsed( + offset: _model + .textController1!.text.length); + }); + }, + child: Container( + width: double.infinity, + height: 80.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), ), ), ), - ], - ), - Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: Container( - width: 100.0, - height: 40.0, - decoration: const BoxDecoration(), - child: FutureBuilder( - future: PhpGroup.getDadosCall.call( - devUUID: FFAppState().devUUID, - userUUID: FFAppState().userUUID, - cliUUID: FFAppState().cliUUID, - atividade: 'getDados', - ), - builder: (context, snapshot) { - // Customize what your widget looks like when it's loading. - if (!snapshot.hasData) { - return Center( - child: SizedBox( - width: 50.0, - height: 50.0, - child: SpinKitCircle( - color: - FlutterFlowTheme.of(context) - .primary, - size: 50.0, - ), - ), - ); - } - final dropDownGetDadosResponse = - snapshot.data!; - return FlutterFlowDropDown( - controller: - _model.dropDownValueController2 ??= - FormFieldController( - _model.dropDownValue2 ??= '', - ), - options: List.from( - PhpGroup.getDadosCall - .levelJsonList( - dropDownGetDadosResponse - .jsonBody, - )! - .map((e) => e.toString()) - .toList()), - optionLabels: PhpGroup.getDadosCall - .levelNACDescricaoStrList( - dropDownGetDadosResponse.jsonBody, - )!, - onChanged: (val) => setState( - () => _model.dropDownValue2 = val), - width: double.infinity, - height: double.infinity, - textStyle: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts - .asMap() - .containsKey( - FlutterFlowTheme.of( - context) - .bodyMediumFamily), - ), - hintText: - FFLocalizations.of(context).getText( - '2wun8p6c' /* Escolha um nível de acesso aqu... */, - ), - icon: Icon( - Icons.keyboard_arrow_down_rounded, - color: FlutterFlowTheme.of(context) - .accent1, - size: 24.0, - ), - elevation: 2.0, - borderColor: - FlutterFlowTheme.of(context) - .accent4, - borderWidth: 0.5, - borderRadius: 10.0, - margin: const EdgeInsetsDirectional - .fromSTEB(16.0, 0.0, 16.0, 0.0), - hidesUnderline: true, - isOverButton: true, - isSearchable: false, - isMultiSelect: false, - ); - }, - ), - ), - ), - ), - ], - ), - ].divide(const SizedBox(height: 10.0)), + ), + ], + ), ), - Column( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( + ], + ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width, + height: 60.0, + // decoration: const BoxDecoration(), + child: Stack( + children: [ + Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 24.0, 0.0, 24.0), - child: Text( - FFLocalizations.of(context).getText( - '8rk26eg1' /* Visita se encerra após o prime... */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 30.0, 0.0, 30.0, 20.0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Flexible( - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 130.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - 'lgv0q5ht' /* Visita única */, - ), - 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), - ), - ), - ), - ), - Switch.adaptive( - value: _model.switchValue!, - onChanged: (newValue) async { - setState(() => _model.switchValue = newValue); - }, - applyCupertinoTheme: false, - focusColor: - FlutterFlowTheme.of(context).primary, - trackColor: WidgetStateProperty.resolveWith( - (states) { - if (states.contains(WidgetState.disabled)) { - return FlutterFlowTheme.of(context) - .alternate; - } - return FlutterFlowTheme.of(context) - .alternate; - }, - ), - hoverColor: FlutterFlowTheme.of(context) - .primaryBackground, - // thumbColor: WidgetStateColor.resolveWith( - // (states) { - // if (states.contains(WidgetState.disabled)) { - // return FlutterFlowTheme.of(context) - // .alternate; - // } - // return FlutterFlowTheme.of(context) - // .alternate; - // }, - // ), - overlayColor: WidgetStateProperty.resolveWith( - (states) { - if (states.contains(WidgetState.disabled)) { - return FlutterFlowTheme.of(context) - .accent4; - } - return FlutterFlowTheme.of(context) - .primaryBackground; - }, - ), - trackOutlineColor: - WidgetStateProperty.resolveWith( - (states) { - if (states.contains(WidgetState.disabled)) { - return FlutterFlowTheme.of(context) - .accent4; - } - return FlutterFlowTheme.of(context) - .primaryBackground; - }, - ), - activeColor: - FlutterFlowTheme.of(context).success, - activeTrackColor: FlutterFlowTheme.of(context) - .primaryBackground, - inactiveTrackColor: FlutterFlowTheme.of(context) - .primaryBackground, - inactiveThumbColor: - FlutterFlowTheme.of(context).error, - ), - ], - ), - ), - ], - ), - Column( - mainAxisSize: MainAxisSize.max, - children: [ - Align( - alignment: const AlignmentDirectional(-1.0, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 0.0, 0.0, 24.0), - child: Text( - FFLocalizations.of(context).getText( - 'eftcs67c' /* Você tem alguma observação sob... */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.w600, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.0, 0.0), - child: SizedBox( - width: double.infinity, + 24.0, 0.0, 24.0, 0.0), child: TextFormField( - controller: _model.textController3, - focusNode: _model.textFieldFocusNode3, + readOnly: true, + controller: _model.textController2, + focusNode: _model.textFieldFocusNode2, + autovalidateMode: + AutovalidateMode.onUserInteraction, autofocus: false, - textInputAction: TextInputAction.next, obscureText: false, decoration: InputDecoration( isDense: true, - labelText: FFLocalizations.of(context).getText( - 't0q2vuup' /* Observações da Visita */, - ), labelStyle: FlutterFlowTheme.of(context) .labelMedium .override( @@ -1668,7 +864,7 @@ Widget scheduleVisit( .labelMediumFamily), ), hintText: FFLocalizations.of(context).getText( - 'w18iztdm' /* Escreva as suas observações aq... */, + 'xpgc5e8d' /* Quando a visita terminá? */, ), hintStyle: FlutterFlowTheme.of(context) .labelMedium @@ -1682,37 +878,38 @@ Widget scheduleVisit( .containsKey( FlutterFlowTheme.of(context) .labelMediumFamily), + lineHeight: 1.0, ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: FlutterFlowTheme.of(context).accent4, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: BorderRadius.circular(8.0), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( color: FlutterFlowTheme.of(context).primary, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: BorderRadius.circular(8.0), ), errorBorder: OutlineInputBorder( borderSide: BorderSide( color: FlutterFlowTheme.of(context).error, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: BorderRadius.circular(8.0), ), focusedErrorBorder: OutlineInputBorder( borderSide: BorderSide( color: FlutterFlowTheme.of(context).error, width: 0.5, ), - borderRadius: BorderRadius.circular(10.0), + borderRadius: BorderRadius.circular(8.0), ), suffixIcon: Icon( - Icons.text_fields, + Icons.date_range, color: FlutterFlowTheme.of(context).accent1, ), ), @@ -1721,117 +918,736 @@ Widget scheduleVisit( .override( fontFamily: FlutterFlowTheme.of(context) .bodyMediumFamily, - color: FlutterFlowTheme.of(context) - .primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + lineHeight: 1.8, + ), + textAlign: TextAlign.center, + validator: _model.textController2Validator + .asValidator(context), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + final datePicked2Date = await showDatePicker( + context: context, + initialDate: getCurrentTimestamp, + firstDate: getCurrentTimestamp, + lastDate: DateTime(2050), + builder: (context, child) { + return wrapInMaterialDatePickerTheme( + context, + child!, + headerBackgroundColor: + FlutterFlowTheme.of(context).primary, + headerForegroundColor: + FlutterFlowTheme.of(context).info, + headerTextStyle: FlutterFlowTheme.of( + context) + .headlineLarge + .override( + fontFamily: + FlutterFlowTheme.of(context) + .headlineLargeFamily, + fontSize: 32.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .headlineLargeFamily), + ), + pickerBackgroundColor: + FlutterFlowTheme.of(context) + .primaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of(context).primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of(context).info, + actionButtonForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + iconSize: 24.0, + ); + }, + ); + + TimeOfDay? datePicked2Time; + if (datePicked2Date != null) { + datePicked2Time = await showTimePicker( + context: context, + initialTime: TimeOfDay.fromDateTime( + getCurrentTimestamp), + builder: (context, child) { + return wrapInMaterialTimePickerTheme( + context, + child!, + headerBackgroundColor: + FlutterFlowTheme.of(context) + .primary, + headerForegroundColor: + FlutterFlowTheme.of(context).info, + headerTextStyle: FlutterFlowTheme.of( + context) + .headlineLarge + .override( + fontFamily: + FlutterFlowTheme.of(context) + .headlineLargeFamily, + fontSize: 32.0, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts + .asMap() + .containsKey( + FlutterFlowTheme.of( + context) + .headlineLargeFamily), + ), + pickerBackgroundColor: + FlutterFlowTheme.of(context) + .primaryBackground, + pickerForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + selectedDateTimeBackgroundColor: + FlutterFlowTheme.of(context) + .primary, + selectedDateTimeForegroundColor: + FlutterFlowTheme.of(context).info, + actionButtonForegroundColor: + FlutterFlowTheme.of(context) + .primaryText, + iconSize: 24.0, + ); + }, + ); + } + + if (datePicked2Date != null && + datePicked2Time != null) { + safeSetState(() { + _model.datePicked2 = DateTime( + datePicked2Date.year, + datePicked2Date.month, + datePicked2Date.day, + datePicked2Time!.hour, + datePicked2Time.minute, + ); + }); + } + setState(() { + _model.textController2?.text = dateTimeFormat( + 'd/M/y H:mm:ss', + _model.datePicked2, + locale: FFLocalizations.of(context) + .languageCode, + ); + _model.textController2?.selection = + TextSelection.collapsed( + offset: _model + .textController2!.text.length); + }); + }, + child: Container( + width: double.infinity, + height: 80.0, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.0), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ] + // .divide(const SizedBox(height: 0.0)), + ), + Column( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 24.0, 0.0, 24.0), + child: Text( + FFLocalizations.of(context).getText( + '0meymh6u' /* Quais são os motivos da visita... */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + Column( + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: Container( + width: 100.0, + height: 45.0, + decoration: const BoxDecoration(), + child: FutureBuilder( + future: PhpGroup.getDadosCall.call( + devUUID: FFAppState().devUUID, + userUUID: FFAppState().userUUID, + cliUUID: FFAppState().cliUUID, + atividade: 'getDados', + ), + builder: (context, snapshot) { + // Customize what your widget looks like when it's loading. + if (!snapshot.hasData) { + return Center( + child: SizedBox( + width: 50.0, + height: 50.0, + child: SpinKitCircle( + color: FlutterFlowTheme.of(context) + .primary, + size: 50.0, + ), + ), + ); + } + final dropDownGetDadosResponse = + snapshot.data!; + final reasonsJsonList = + PhpGroup.getDadosCall.reasonsJsonList( + dropDownGetDadosResponse.jsonBody, + ); + return FlutterFlowDropDown( + controller: + _model.dropDownValueController1 ??= + FormFieldController( + _model.dropDownValue1 ??= '', + ), + options: reasonsJsonList != null && + reasonsJsonList != [] + ? List.from( + PhpGroup.getDadosCall + .reasonsJsonList( + dropDownGetDadosResponse + .jsonBody, + )! + .map((e) => e.toString()) + .toList()) + : [], + optionLabels: PhpGroup.getDadosCall + .reasonsMotDescStrList( + dropDownGetDadosResponse.jsonBody, + ), + onChanged: (val) => setState( + () => _model.dropDownValue1 = val), + width: double.infinity, + height: double.infinity, + textStyle: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + hintText: + FFLocalizations.of(context).getText( + '6p3e0bzr' /* Escolha um motivo aqui */, + ), + icon: Icon( + Icons.keyboard_arrow_down_rounded, + color: FlutterFlowTheme.of(context) + .accent1, + size: 24.0, + ), + elevation: 2.0, + borderColor: + FlutterFlowTheme.of(context).accent4, + borderWidth: 0.5, + borderRadius: 10.0, + margin: + const EdgeInsetsDirectional.fromSTEB( + 16.0, 0.0, 16.0, 0.0), + hidesUnderline: true, + isOverButton: true, + isSearchable: false, + isMultiSelect: false, + ); + }, + ), + ), + ), + ), + ], + ), + if (_model.dropDownValue1 == '') + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 30.0, vertical: 5.0), + child: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Field is Required', + ptText: 'Campo Obrigatório', + ), + style: TextStyle( + color: FlutterFlowTheme.of(context) + .customColor6, + fontSize: 12.0)), + ), + ], + ), + ], + ), + Column( + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: Container( + width: 100.0, + height: 45.0, + decoration: const BoxDecoration(), + child: FutureBuilder( + future: PhpGroup.getDadosCall.call( + devUUID: FFAppState().devUUID, + userUUID: FFAppState().userUUID, + cliUUID: FFAppState().cliUUID, + atividade: 'getDados', + ), + builder: (context, snapshot) { + // Customize what your widget looks like when it's loading. + if (!snapshot.hasData) { + return Center( + child: SizedBox( + width: 50.0, + height: 50.0, + child: SpinKitCircle( + color: FlutterFlowTheme.of(context) + .primary, + size: 50.0, + ), + ), + ); + } + final dropDownGetDadosResponse = + snapshot.data!; + final lavelList = + PhpGroup.getDadosCall.levelJsonList( + dropDownGetDadosResponse.jsonBody, + ); + return FlutterFlowDropDown( + controller: + _model.dropDownValueController2 ??= + FormFieldController( + _model.dropDownValue2 ??= '', + ), + options: + lavelList != null && lavelList != [] + ? List.from(lavelList! + .map((e) => e.toString()) + .toList()) + : [], + optionLabels: PhpGroup.getDadosCall + .levelNACDescricaoStrList( + dropDownGetDadosResponse.jsonBody, + ), + onChanged: (val) => setState( + () => _model.dropDownValue2 = val), + width: double.infinity, + height: double.infinity, + textStyle: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + hintText: + FFLocalizations.of(context).getText( + '2wun8p6c' /* Escolha um nível de acesso aqu... */, + ), + icon: Icon( + Icons.keyboard_arrow_down_rounded, + color: FlutterFlowTheme.of(context) + .accent1, + size: 24.0, + ), + elevation: 2.0, + borderColor: + FlutterFlowTheme.of(context).accent4, + borderWidth: 0.5, + borderRadius: 10.0, + margin: + const EdgeInsetsDirectional.fromSTEB( + 16.0, 0.0, 16.0, 0.0), + hidesUnderline: true, + isOverButton: true, + isSearchable: false, + isMultiSelect: false, + ); + }, + ), + ), + ), + ), + ], + ), + if (_model.dropDownValue1 == '') + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 30.0, vertical: 5.0), + child: Text( + FFLocalizations.of(context).getVariableText( + enText: 'Field is Required', + ptText: 'Campo Obrigatório', + ), + style: TextStyle( + color: FlutterFlowTheme.of(context) + .customColor6, + fontSize: 12.0)), + ), + ], + ), + ], + ), + ].divide(const SizedBox(height: 10.0)), + ), + Column( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 24.0, 0.0, 24.0), + child: Text( + FFLocalizations.of(context).getText( + '8rk26eg1' /* Visita se encerra após o prime... */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 30.0, 0.0, 30.0, 20.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Flexible( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 130.0, 0.0), + child: Text( + FFLocalizations.of(context).getText( + 'lgv0q5ht' /* Visita única */, + ), + 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), ), - textAlign: TextAlign.start, - maxLines: null, - maxLength: 80, - validator: _model.textController3Validator - .asValidator(context), ), ), ), + Switch.adaptive( + value: _model.switchValue!, + onChanged: (newValue) async { + setState(() => _model.switchValue = newValue); + }, + applyCupertinoTheme: false, + focusColor: FlutterFlowTheme.of(context).primary, + trackColor: WidgetStateProperty.resolveWith( + (states) { + if (states.contains(WidgetState.disabled)) { + return FlutterFlowTheme.of(context).alternate; + } + return FlutterFlowTheme.of(context).alternate; + }, + ), + hoverColor: + FlutterFlowTheme.of(context).primaryBackground, + // thumbColor: WidgetStateColor.resolveWith( + // (states) { + // if (states.contains(WidgetState.disabled)) { + // return FlutterFlowTheme.of(context) + // .alternate; + // } + // return FlutterFlowTheme.of(context) + // .alternate; + // }, + // ), + overlayColor: WidgetStateProperty.resolveWith( + (states) { + if (states.contains(WidgetState.disabled)) { + return FlutterFlowTheme.of(context).accent4; + } + return FlutterFlowTheme.of(context) + .primaryBackground; + }, + ), + trackOutlineColor: WidgetStateProperty.resolveWith( + (states) { + if (states.contains(WidgetState.disabled)) { + return FlutterFlowTheme.of(context).accent4; + } + return FlutterFlowTheme.of(context) + .primaryBackground; + }, + ), + activeColor: FlutterFlowTheme.of(context).success, + activeTrackColor: + FlutterFlowTheme.of(context).primaryBackground, + inactiveTrackColor: + FlutterFlowTheme.of(context).primaryBackground, + inactiveThumbColor: + FlutterFlowTheme.of(context).error, + ), ], ), - Container( - width: 100.0, - height: 54.0, - decoration: const BoxDecoration(), - ), - ], - ), + ), + ], ), - ), - ], - ), - InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - if ((_model.textController1.text != '') && - (_model.textController2.text != '') && - (_model.dropDownValue1 != null && - _model.dropDownValue1 != '') && - (_model.dropDownValue2 != null && - _model.dropDownValue2 != '')) { - 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(), + Column( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( - padding: MediaQuery.viewInsetsOf(context), - child: VisitDetailsModalTemplateComponentWidget( - visitStartDateStr: _model.textController1.text, - visitEndDateStr: _model.textController2.text, - visitReasonStr: _model.dropDownValue1, - visitLevelStr: _model.dropDownValue2, - visitTempStr: - _model.switchValue == true ? 'Sim' : 'Não', - visitObsStr: _model.textController3.text, - visitorStrList: _model.visitorStrList, - visitorJsonList: _model.visitorJsonList, - updateToggleIdx: () async {}, - repeatVisitSchedule: () async {}, + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 0.0, 0.0, 24.0), + child: Text( + FFLocalizations.of(context).getText( + 'eftcs67c' /* Você tem alguma observação sob... */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.w600, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), ), ), - ); - }, - ).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: 'Campos obrigatórios imcompletos.', + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 0.0), + child: SizedBox( + width: double.infinity, + child: TextFormField( + controller: _model.textController3, + focusNode: _model.textFieldFocusNode3, + autofocus: false, + textInputAction: TextInputAction.next, + obscureText: false, + decoration: InputDecoration( + isDense: false, + labelText: FFLocalizations.of(context).getText( + 't0q2vuup' /* Observações da Visita */, + ), + 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), + ), + hintText: FFLocalizations.of(context).getText( + 'w18iztdm' /* Escreva as suas observações aq... */, + ), + 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).accent4, + 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.text_fields, + color: FlutterFlowTheme.of(context).accent1, + ), + ), + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + textAlign: TextAlign.start, + maxLines: null, + maxLength: 80, + validator: _model.textController3Validator + .asValidator(context), ), ), - ); - }, - ).then((value) => safeSetState(() {})); - } - }, - child: Container( - width: MediaQuery.sizeOf(context).width * 0.5, - height: 40.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primary, - borderRadius: BorderRadius.circular(10.0), - ), - alignment: const AlignmentDirectional(0.0, 1.0), - child: Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Text(FFLocalizations.of(context).getVariableText( - enText: 'Schedule', - ptText: 'Agendar', - )), - ), + ), + ], + ), + Container( + width: 100.0, + height: 54.0, + decoration: const BoxDecoration(), + ), + ], ), ), + FFButtonWidget( + text: 'Schedule', + onPressed: _model.isValid() + ? () async { + await showDialog( + // 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: Dialog( + alignment: Alignment.topCenter, + child: SizedBox( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.5, + child: VisitDetailsModalTemplateComponentWidget( + visitStartDateStr: _model.textController1.text, + visitEndDateStr: _model.textController2.text, + visitReasonStr: _model.dropDownValue1, + visitLevelStr: _model.dropDownValue2, + visitTempStr: + _model.switchValue == true ? 'Sim' : 'Não', + visitObsStr: _model.textController3.text, + visitorStrList: _model.visitorStrList, + visitorJsonList: _model.visitorJsonList, + updateToggleIdx: () async {}, + repeatVisitSchedule: () async {}, + ), + ), + ), + ); + }, + ).then((value) => safeSetState(() {})); + } + : null, + options: FFButtonOptions( + height: MediaQuery.of(context).size.height * 0.05, + width: MediaQuery.of(context).size.height * 0.2, + color: FlutterFlowTheme.of(context).primary, + disabledColor: FlutterFlowTheme.of(context).customColor5), + showLoadingIndicator: true, + ), ].addToEnd(const SizedBox(height: 30.0)), ), ); @@ -2367,10 +2183,10 @@ Widget visitHistory( fadeOutDuration: const Duration(milliseconds: 500), imageUrl: valueOrDefault( - 'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( visitaWrapItem, r'''$.VTE_DOCUMENTO''', - ).toString()}&tipo=E', + ).toString()}&tipo=E", 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', ), fit: BoxFit.cover, From 57bfbe33d9af2d502706158e15bdfb778a16b63a Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Wed, 31 Jul 2024 17:43:51 -0300 Subject: [PATCH 04/10] fix: ScheduleCompleteVisitPageModel => ScheduleCompleteVisit --- .../visitor_not_found_component_widget.dart | 256 ++- .../schedule_visit_detail_model.dart | 36 +- .../schedule_visit_detail_widget.dart | 1504 ++++++++--------- ...iter_vistor_template_component_widget.dart | 10 +- ...tails_modal_template_component_widget.dart | 90 +- ...earch_modal_template_component_widget.dart | 20 +- lib/flutter_flow/upload_data.dart | 54 +- .../schedule_complete_visit_page_model.dart | 12 + .../schedule_complete_visit_page_widget.dart | 600 +++---- 9 files changed, 1245 insertions(+), 1337 deletions(-) diff --git a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart index 783d3801..9ffcdc37 100644 --- a/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart +++ b/lib/components/molecular_components/visitor_not_found_component/visitor_not_found_component_widget.dart @@ -41,146 +41,138 @@ class _VisitorNotFoundComponentWidgetState @override Widget build(BuildContext context) { - return Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: Container( - width: 350.0, - height: 350.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(25.0), - bottomRight: Radius.circular(25.0), - topLeft: Radius.circular(25.0), - topRight: Radius.circular(25.0), + return Container( + width: MediaQuery.of(context).size.height * 0.5, + height: MediaQuery.of(context).size.height * 0.4, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(25.0), + bottomRight: Radius.circular(25.0), + topLeft: Radius.circular(25.0), + topRight: Radius.circular(25.0), + ), + ), + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Align( + alignment: const AlignmentDirectional(1.0, -1.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 5.0, 0.0), + child: FlutterFlowIconButton( + borderRadius: 20.0, + borderWidth: 1.0, + buttonSize: 40.0, + icon: Icon( + Icons.close, + color: FlutterFlowTheme.of(context).accent1, + size: 24.0, + ), + onPressed: () async { + Navigator.pop(context); + }, + ), + ), ), - ), - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Align( - alignment: const AlignmentDirectional(1.0, -1.0), - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 5.0, 5.0, 0.0), - child: FlutterFlowIconButton( - borderRadius: 20.0, - borderWidth: 1.0, - buttonSize: 40.0, - icon: Icon( - Icons.close, - color: FlutterFlowTheme.of(context).accent1, - size: 24.0, + Icon( + Icons.notifications_none, + color: FlutterFlowTheme.of(context).accent1, + size: 72.0, + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0), + child: Text( + FFLocalizations.of(context).getText( + '1p9mykbj' /* Usuário não encontrado */, + ), + style: FlutterFlowTheme.of(context).headlineMedium.override( + fontFamily: + FlutterFlowTheme.of(context).headlineMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).headlineMediumFamily), ), - onPressed: () async { - Navigator.pop(context); - }, - ), + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB(20.0, 4.0, 20.0, 0.0), + child: Text( + FFLocalizations.of(context).getText( + 'kt937sp6' /* O documento inserido não corre... */, ), - ), - Icon( - Icons.notifications_none, - color: FlutterFlowTheme.of(context).accent1, - size: 72.0, - ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 16.0, 0.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - '1p9mykbj' /* Usuário não encontrado */, - ), - style: FlutterFlowTheme.of(context).headlineMedium.override( - fontFamily: - FlutterFlowTheme.of(context).headlineMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).headlineMediumFamily), - ), - ), - ), - Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(10.0, 4.0, 10.0, 0.0), - child: Text( - FFLocalizations.of(context).getText( - 'kt937sp6' /* O documento inserido não corre... */, - ), - style: FlutterFlowTheme.of(context).labelMedium.override( - fontFamily: - FlutterFlowTheme.of(context).labelMediumFamily, - color: FlutterFlowTheme.of(context).primaryText, - fontSize: 14.0, - letterSpacing: 0.0, - fontStyle: FontStyle.italic, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).labelMediumFamily), - ), - ), - ), - Expanded( - child: Align( - alignment: const AlignmentDirectional(0.0, 1.0), - child: FFButtonWidget( - onPressed: () async { - Navigator.pop(context); - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: true, - useSafeArea: true, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: SizedBox( - width: double.infinity, - height: MediaQuery.of(context).size.height * 0.9, - child: - const RegisiterVistorTemplateComponentWidget( - source: 'VisitorNotFoundComponent', - )), - ); - }, - ).then((value) => safeSetState(() {})); - }, - text: FFLocalizations.of(context).getText( - 'y2x4nfcn' /* Adicionar */, + style: FlutterFlowTheme.of(context).labelMedium.override( + fontFamily: FlutterFlowTheme.of(context).labelMediumFamily, + color: FlutterFlowTheme.of(context).primaryText, + fontSize: 14.0, + letterSpacing: 0.0, + fontStyle: FontStyle.italic, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).labelMediumFamily), ), - options: FFButtonOptions( - width: double.infinity, - height: 30.0, - padding: const EdgeInsetsDirectional.fromSTEB( - 24.0, 0.0, 24.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: Colors.white, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context).titleSmallFamily), - ), - elevation: 3.0, - borderSide: const BorderSide( - color: Colors.transparent, - width: 1.0, - ), - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(25.0), - bottomRight: Radius.circular(25.0), - topLeft: Radius.circular(15.0), - topRight: Radius.circular(15.0), - ), + ), + ), + Expanded( + child: Align( + alignment: const AlignmentDirectional(0.0, 1.0), + child: FFButtonWidget( + onPressed: () async { + Navigator.pop(context); + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + enableDrag: true, + useSafeArea: true, + isDismissible: true, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: SizedBox( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.9, + child: const RegisiterVistorTemplateComponentWidget( + source: 'VisitorNotFoundComponent', + )), + ); + }, + ).then((value) => safeSetState(() {})); + }, + text: FFLocalizations.of(context) + .getVariableText(enText: 'Add', ptText: 'Adicionar'), + options: FFButtonOptions( + width: double.infinity, + height: 30.0, + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.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: Colors.white, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context).titleSmallFamily), + ), + elevation: 3.0, + borderSide: const BorderSide( + color: Colors.transparent, + width: 1.0, + ), + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(25.0), + bottomRight: Radius.circular(25.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), ), ), ), ), - ], - ), + ), + ], ), ); } diff --git a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart index 39705ca6..d4df4084 100644 --- a/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart +++ b/lib/components/organism_components/schedule_visit_detail/schedule_visit_detail_model.dart @@ -1,9 +1,11 @@ -import 'package:hub/backend/api_requests/api_manager.dart'; +import 'dart:developer'; +import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:flutter/material.dart'; import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; +import 'package:intl/intl.dart'; class ScheduleVisitDetailModel extends FlutterFlowModel { @@ -36,6 +38,36 @@ class ScheduleVisitDetailModel // Stores action output result for [Backend Call - API (postScheduleVisit)] action in Icon widget. ApiCallResponse? postScheduleVisit; + String convertDateFormat(String dateStr) { + try { + log('Received date string: $dateStr'); + + // Formato original + DateFormat originalFormat = DateFormat('d/M/y H:mm:ss'); + // Novo formato + DateFormat newFormat = DateFormat('y-M-d H:mm:ss'); + + // Validate the input string format + if (!RegExp(r'^\d{1,2}/\d{1,2}/\d{4} \d{1,2}:\d{2}:\d{2}$') + .hasMatch(dateStr)) { + log('Invalid date format: $dateStr'); + return 'Invalid date format'; + } + + // Converte a string para DateTime + DateTime dateTime = originalFormat.parse(dateStr); + + // Converte DateTime para a nova string formatada + String formattedDate = newFormat.format(dateTime); + log('Formatted date: $formattedDate'); + return formattedDate; + } catch (e) { + // Handle the exception by returning an error message or a default value + log('Error parsing date: $e'); + return 'Invalid date format'; + } + } + @override void initState(BuildContext context) {} @@ -59,4 +91,4 @@ class ScheduleVisitDetailModel textFieldFocusNode6?.dispose(); textController6?.dispose(); } -} \ No newline at end of file +} 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 ad430d41..150dd715 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 @@ -13,6 +13,7 @@ import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_util.dart'; +import 'package:hub/flutter_flow/flutter_flow_widgets.dart'; import 'package:provider/provider.dart'; class ScheduleVisitDetailWidget extends StatefulWidget { @@ -46,6 +47,7 @@ class ScheduleVisitDetailWidget extends StatefulWidget { class _ScheduleVisitDetailWidgetState extends State { late ScheduleVisitDetailModel _model; + late FocusNode _focusNode; @override void setState(VoidCallback callback) { @@ -56,6 +58,7 @@ class _ScheduleVisitDetailWidgetState extends State { @override void initState() { super.initState(); + _focusNode = FocusNode(); _model = createModel(context, () => ScheduleVisitDetailModel()); _model.textController1 ??= TextEditingController(text: widget.visitTempStr); @@ -83,39 +86,51 @@ class _ScheduleVisitDetailWidgetState extends State { @override void dispose() { _model.maybeDispose(); + _focusNode.dispose(); super.dispose(); } + void _requestFocus() { + if (mounted) { + _focusNode.requestFocus(); + } + } + @override Widget build(BuildContext context) { context.watch(); + final visitorsData = widget.visitorJsonList!.toList().take(2).toList(); + final visitorsDataItem = visitorsData[0]; return Padding( - padding: const EdgeInsetsDirectional.fromSTEB(0.0, 35.0, 0.0, 0.0), - child: Container( - width: double.infinity, - height: double.infinity, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primaryBackground, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(25.0), - bottomRight: Radius.circular(25.0), - topLeft: Radius.circular(25.0), - topRight: Radius.circular(25.0), + padding: const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0), + child: GestureDetector( + onTap: () { + _requestFocus(); + }, + child: Container( + // color: FlutterFlowTheme.of(context).primaryBackground, + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.6, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context).primaryBackground, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(25.0), + bottomRight: Radius.circular(25.0), + topLeft: Radius.circular(25.0), + topRight: Radius.circular(25.0), + ), ), - ), - child: Column( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Align( - alignment: const AlignmentDirectional(0.0, -1.0), - child: Container( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( width: double.infinity, height: 35.0, decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primary, + color: FlutterFlowTheme.of(context).primaryBackground, borderRadius: const BorderRadius.only( bottomLeft: Radius.circular(0.0), bottomRight: Radius.circular(0.0), @@ -137,7 +152,7 @@ class _ScheduleVisitDetailWidgetState extends State { buttonSize: 40.0, icon: Icon( Icons.keyboard_return, - color: FlutterFlowTheme.of(context).primaryBackground, + color: FlutterFlowTheme.of(context).accent1, size: 24.0, ), onPressed: () async { @@ -148,842 +163,681 @@ class _ScheduleVisitDetailWidgetState extends State { ), ), ), - ), - Container( - decoration: const BoxDecoration( - shape: BoxShape.rectangle, - ), - child: Stack( + Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.end, children: [ + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 5.0, 0.0, 5.0, 20.0), + child: SizedBox( + width: 100.0, + child: ClipRRect( + borderRadius: BorderRadius.circular(100.0), + child: CachedNetworkImage( + fadeInDuration: const Duration(milliseconds: 500), + fadeOutDuration: const Duration(milliseconds: 500), + imageUrl: valueOrDefault( + "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + visitorsDataItem, + r'''$.VTE_DOCUMENTO''', + ).toString()}&tipo=E", + 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', + ), + width: 100.0, + height: 100.0, + fit: BoxFit.cover, + ), + ), + ), + ), Column( mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.end, children: [ - Align( - alignment: const AlignmentDirectional(0.0, -1.0), + Container( + decoration: const BoxDecoration(), child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 5.0, 0.0, 5.0, 20.0), - child: Container( - width: 100.0, - decoration: const BoxDecoration(), - child: Builder( - builder: (context) { - final visitorsData = widget.visitorJsonList! - .toList() - .take(1) - .toList(); - - return SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: List.generate(visitorsData.length, - (visitorsDataIndex) { - final visitorsDataItem = - visitorsData[visitorsDataIndex]; - return Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(100.0), - ), - child: Align( - alignment: const AlignmentDirectional( - 1.0, -1.0), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - // Navigator.pop(context); - // await showModalBottomSheet( - // isScrollControlled: true, - // backgroundColor: - // Colors.transparent, - // useSafeArea: true, - // context: context, - // builder: (context) { - // return Padding( - // padding: - // MediaQuery.viewInsetsOf( - // context), - // child: - // VisitorDetailsModalTemplateComponentWidget( - // visitorImageURL: '', - // visitorEmail: '', - // visitorName: '', - // visitorPhone: '', - // visitorType: '', - // ), - // ); - // }, - // ).then((value) => - // safeSetState(() {})); - }, - child: ClipRRect( - borderRadius: - BorderRadius.circular(100.0), - child: CachedNetworkImage( - fadeInDuration: const Duration( - milliseconds: 500), - fadeOutDuration: const Duration( - milliseconds: 500), - imageUrl: - valueOrDefault( - "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( - visitorsDataItem, - r'''$.VTE_DOCUMENTO''', - ).toString()}&tipo=E", - 'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg', - ), - width: 100.0, - height: 100.0, - fit: BoxFit.cover, - ), - ), - ), - ), - ); - }), + 8.0, 0.0, 8.0, 10.0), + child: TextFormField( + controller: _model.textController1, + focusNode: _model.textFieldFocusNode1, + autofocus: false, + readOnly: true, + obscureText: false, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + '7w4fohoa' /* Encerramento da Visita */, + ), + 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(8.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + validator: _model.textController1Validator + .asValidator(context), ), ), ), - Column( - mainAxisSize: MainAxisSize.min, - children: [ - Container( - decoration: const BoxDecoration(), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 10.0), - child: TextFormField( - controller: _model.textController1, - focusNode: _model.textFieldFocusNode1, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - isDense: false, - labelText: - FFLocalizations.of(context).getText( - '7w4fohoa' /* Encerramento da Visita */, - ), - 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, + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 10.0), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), + child: TextFormField( + controller: _model.textController2, + focusNode: _model.textFieldFocusNode2, + autofocus: false, + obscureText: false, + readOnly: true, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context) + .getVariableText( + enText: 'Start', + ptText: 'Início', ), - borderRadius: BorderRadius.circular(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(8.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(8.0), - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( + 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) + .labelMediumFamily), + ), + hintText: + FFLocalizations.of(context).getText( + '0cp1e31d' /* dd/mm/yyyy */, ), - validator: _model.textController1Validator - .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(8.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + fontSize: 12, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + textAlign: TextAlign.center, + validator: _model.textController2Validator + .asValidator(context), + ), ), ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 10.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), - child: TextFormField( - controller: _model.textController2, - focusNode: _model.textFieldFocusNode2, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - labelText: - FFLocalizations.of(context).getText( - 'snah4iet' /* Início */, - ), - 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), - ), - hintText: - FFLocalizations.of(context).getText( - '0cp1e31d' /* dd/mm/yyyy */, - ), - 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(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - textAlign: TextAlign.center, - validator: _model.textController2Validator - .asValidator(context), + Expanded( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), + child: TextFormField( + controller: _model.textController3, + focusNode: _model.textFieldFocusNode3, + autofocus: false, + obscureText: false, + readOnly: true, + decoration: InputDecoration( + isDense: true, + labelText: + FFLocalizations.of(context).getText( + 'abppdgz3' /* Término */, ), - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), - child: TextFormField( - controller: _model.textController3, - focusNode: _model.textFieldFocusNode3, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - labelText: - FFLocalizations.of(context).getText( - 'abppdgz3' /* Término */, - ), - 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), - ), - hintText: - FFLocalizations.of(context).getText( - 'kqralft4' /* dd/mm/yyyy */, - ), - 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(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - textAlign: TextAlign.center, - validator: _model.textController3Validator - .asValidator(context), - ), - ), - ), - ], - ), - ), - Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 10.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), - child: TextFormField( - controller: _model.textController4, - focusNode: _model.textFieldFocusNode4, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - labelText: - FFLocalizations.of(context).getText( - 'xjxhzqqm' /* Motivo da Visita */, - ), - 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), - ), - hintText: - FFLocalizations.of(context).getText( - '47oezdm6' /* Motivo */, - ), - 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(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - textAlign: TextAlign.center, - validator: _model.textController4Validator - .asValidator(context), - ), - ), - ), - Expanded( - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), - child: TextFormField( - controller: _model.textController5, - focusNode: _model.textFieldFocusNode5, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - labelText: - FFLocalizations.of(context).getText( - '2ujg7u18' /* Nível de Acesso */, - ), - 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), - ), - hintText: - FFLocalizations.of(context).getText( - '3emmbbfv' /* Nível de Acesso */, - ), - 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(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .primary, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context) - .error, - width: 0.5, - ), - borderRadius: - BorderRadius.circular(8.0), - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - textAlign: TextAlign.center, - validator: _model.textController5Validator - .asValidator(context), - ), - ), - ), - ], - ), - ), - Container( - decoration: const BoxDecoration(), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 8.0, 0.0, 8.0, 0.0), - child: TextFormField( - controller: _model.textController6, - focusNode: _model.textFieldFocusNode6, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - labelText: - FFLocalizations.of(context).getText( - 'ritce5uw' /* Observações da Visita */, - ), - 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(8.0), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - FlutterFlowTheme.of(context).primary, - width: 0.5, - ), - borderRadius: BorderRadius.circular(8.0), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(8.0), - ), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: FlutterFlowTheme.of(context).error, - width: 0.5, - ), - borderRadius: BorderRadius.circular(8.0), - ), - ), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( + 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) + .labelMediumFamily), + ), + hintText: + FFLocalizations.of(context).getText( + 'kqralft4' /* dd/mm/yyyy */, ), - validator: _model.textController6Validator - .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(8.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + fontSize: 12, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + textAlign: TextAlign.center, + validator: _model.textController3Validator + .asValidator(context), + ), ), ), - ), - ], + ], + ), + ), + Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 10.0), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), + child: TextFormField( + controller: _model.textController4, + focusNode: _model.textFieldFocusNode4, + autofocus: false, + obscureText: false, + readOnly: true, + decoration: InputDecoration( + isDense: true, + labelText: + FFLocalizations.of(context).getText( + 'xjxhzqqm' /* Motivo da Visita */, + ), + 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), + ), + hintText: + FFLocalizations.of(context).getText( + '47oezdm6' /* Motivo */, + ), + 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(8.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + textAlign: TextAlign.center, + validator: _model.textController4Validator + .asValidator(context), + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), + child: TextFormField( + controller: _model.textController5, + focusNode: _model.textFieldFocusNode5, + autofocus: false, + obscureText: false, + readOnly: true, + decoration: InputDecoration( + isDense: true, + labelText: + FFLocalizations.of(context).getText( + '2ujg7u18' /* Nível de Acesso */, + ), + 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), + ), + hintText: + FFLocalizations.of(context).getText( + '3emmbbfv' /* Nível de Acesso */, + ), + 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(8.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context) + .primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + textAlign: TextAlign.center, + validator: _model.textController5Validator + .asValidator(context), + ), + ), + ), + ], + ), ), Container( - width: double.infinity, - height: 22.0, - decoration: BoxDecoration( - color: - FlutterFlowTheme.of(context).secondaryBackground, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(25.0), - bottomRight: Radius.circular(25.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), + decoration: const BoxDecoration(), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 8.0, 0.0, 8.0, 0.0), + child: TextFormField( + controller: _model.textController6, + focusNode: _model.textFieldFocusNode6, + autofocus: false, + obscureText: false, + readOnly: true, + decoration: InputDecoration( + isDense: true, + labelText: FFLocalizations.of(context).getText( + 'ritce5uw' /* Observações da Visita */, + ), + 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(8.0), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).primary, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: FlutterFlowTheme.of(context).error, + width: 0.5, + ), + borderRadius: BorderRadius.circular(8.0), + ), + ), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey(FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + validator: _model.textController6Validator + .asValidator(context), ), ), ), - ] - .divide(const SizedBox(height: 30.0)) - .addToStart(const SizedBox(height: 100.0)), + ], ), - ], + ].divide(const SizedBox(height: 0.0)), ), - ), - Align( - alignment: const AlignmentDirectional(0.0, 1.0), - child: Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 6.0, 0.0, 0.0), - child: Container( - width: double.infinity, - height: 35.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context).primary, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(0.0), - bottomRight: Radius.circular(0.0), - topLeft: Radius.circular(0.0), - topRight: Radius.circular(0.0), - ), - ), - child: InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - _model.postScheduleVisit = - await PhpGroup.postScheduleVisitCall.call( - devUUID: FFAppState().devUUID, - userUUID: FFAppState().userUUID, - atividade: 'putVisita', - devDesc: widget.visitObsStr, - idVisitante: widget.visitorStrList, - dtInicio: widget.visitStartDate, - dtFim: widget.visitEndDate, - unica: widget.visitTempStr, - idMotivo: extractIdToStr(widget.visitResonStr!), - idNAC: extractIdToStr(widget.visitLevelStr!), - obs: widget.visitObsStr, - cliID: FFAppState().cliUUID, - ); + IconButton( + onPressed: () async { + _model.postScheduleVisit = + await PhpGroup.postScheduleVisitCall.call( + devUUID: FFAppState().devUUID, + userUUID: FFAppState().userUUID, + atividade: 'putVisita', + devDesc: widget.visitObsStr, + idVisitante: widget.visitorStrList, + dtInicio: + _model.convertDateFormat(widget.visitStartDate ?? ''), + dtFim: _model.convertDateFormat(widget.visitEndDate ?? ''), + unica: widget.visitTempStr, + idMotivo: extractIdToStr(widget.visitResonStr!), + idNAC: extractIdToStr(widget.visitLevelStr!), + obs: widget.visitObsStr, + cliID: FFAppState().cliUUID, + ); - if (PhpGroup.postScheduleVisitCall.error( - (_model.postScheduleVisit?.jsonBody ?? ''), - ) == - false) { - Navigator.pop(context); - } else { - await showModalBottomSheet( - isScrollControlled: true, - backgroundColor: Colors.transparent, - enableDrag: false, - context: context, - builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: ThrowExceptionWidget( - msg: PhpGroup.postScheduleVisitCall.errorMsg( - (_model.postScheduleVisit?.jsonBody ?? ''), - )!, - ), - ); - }, - ).then((value) => safeSetState(() {})); - } + if (PhpGroup.postScheduleVisitCall.error( + (_model.postScheduleVisit?.jsonBody ?? ''), + ) == + false) { + Navigator.pop(context); + } else { + await showModalBottomSheet( + isScrollControlled: true, + backgroundColor: Colors.transparent, + enableDrag: false, + context: context, + builder: (context) { + return Padding( + padding: MediaQuery.viewInsetsOf(context), + child: ThrowExceptionWidget( + msg: PhpGroup.postScheduleVisitCall.errorMsg( + (_model.postScheduleVisit?.jsonBody ?? ''), + )!, + ), + ); + }, + ).then((value) => safeSetState(() {})); + } - setState(() {}); - }, - child: Icon( - Icons.save_alt, - color: FlutterFlowTheme.of(context).secondaryText, - size: 24.0, - ), - ), + setState(() {}); + }, + icon: Icon( + Icons.check, + color: FlutterFlowTheme.of(context).primary, + size: 15.0, ), ), - ), - ], + ], + ), ), ), ); 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 b47c79ee..9e187e31 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 @@ -485,9 +485,9 @@ class _RegisiterVistorTemplateComponentWidgetState final selectedMedia = await selectMediaWithSourceBottomSheet( context: context, - maxWidth: 300.00, - maxHeight: 300.00, - imageQuality: 0, + // maxWidth: 300.00, + // maxHeight: 300.00, + imageQuality: 100, allowPhoto: true, includeDimensions: true, ); @@ -567,7 +567,7 @@ class _RegisiterVistorTemplateComponentWidgetState ), borderSide: BorderSide( color: FlutterFlowTheme.of(context).accent1, - width: 0.5, + width: 0.2, ), borderRadius: BorderRadius.circular(8.0), ), @@ -915,7 +915,7 @@ class _RegisiterVistorTemplateComponentWidgetState options: FFButtonOptions( width: 250.0, height: 36.0, - disabledColor: FlutterFlowTheme.of(context).customColor6, + disabledColor: FlutterFlowTheme.of(context).customColor5, padding: const EdgeInsetsDirectional.fromSTEB( 80.0, 0.0, 80.0, 0.0), iconPadding: const EdgeInsetsDirectional.fromSTEB( diff --git a/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart b/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart index 8a9309f9..a5e922e8 100644 --- a/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart +++ b/lib/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart @@ -1,6 +1,3 @@ - - - import 'package:flutter/material.dart'; import 'package:hub/components/organism_components/schedule_visit_detail/schedule_visit_detail_widget.dart'; import 'package:hub/components/templates_components/view_visit_detail/view_visit_detail_widget.dart'; @@ -74,50 +71,47 @@ class _VisitDetailsModalTemplateComponentWidgetState @override Widget build(BuildContext context) { - return Align( - alignment: const AlignmentDirectional(0.0, 1.0), - child: Builder( - builder: (context) { - if (widget.visitStatusStr != null && widget.visitStatusStr != '') { - return wrapWithModel( - model: _model.viewVisitDetailModel, - updateCallback: () => setState(() {}), - updateOnChange: true, - child: ViewVisitDetailWidget( - visitorImgPath: widget.visitorImgPath, - visitStartDate: widget.visitStartDateStr!, - visitEndDate: widget.visitEndDateStr!, - visitReasonStr: widget.visitReasonStr!, - visitLevelStr: widget.visitLevelStr!, - visitTempStr: widget.visitTempStr!, - visitObsStr: widget.visitObsStr!, - visitStatusStr: widget.visitStatusStr!, - visitorStrList: widget.visitorStrList!, - visitorJsonList: widget.visitorJsonList, - visitIdStr: widget.visitIdStr!, - visitStatusColor: widget.visitStatusColor!, - ), - ); - } else { - return wrapWithModel( - model: _model.scheduleVisitDetailModel, - updateCallback: () => setState(() {}), - updateOnChange: true, - child: ScheduleVisitDetailWidget( - visitorStrList: widget.visitorStrList!, - visitorImgPath: widget.visitorImgPath, - visitStartDate: widget.visitStartDateStr!, - visitEndDate: widget.visitEndDateStr!, - visitResonStr: widget.visitReasonStr!, - visitLevelStr: widget.visitLevelStr!, - visitTempStr: widget.visitTempStr!, - visitObsStr: widget.visitObsStr!, - visitorJsonList: widget.visitorJsonList!, - ), - ); - } - }, - ), + return Builder( + builder: (context) { + if (widget.visitStatusStr != null && widget.visitStatusStr != '') { + return wrapWithModel( + model: _model.viewVisitDetailModel, + updateCallback: () => setState(() {}), + updateOnChange: true, + child: ViewVisitDetailWidget( + visitorImgPath: widget.visitorImgPath, + visitStartDate: widget.visitStartDateStr!, + visitEndDate: widget.visitEndDateStr!, + visitReasonStr: widget.visitReasonStr!, + visitLevelStr: widget.visitLevelStr!, + visitTempStr: widget.visitTempStr!, + visitObsStr: widget.visitObsStr!, + visitStatusStr: widget.visitStatusStr!, + visitorStrList: widget.visitorStrList!, + visitorJsonList: widget.visitorJsonList, + visitIdStr: widget.visitIdStr!, + visitStatusColor: widget.visitStatusColor!, + ), + ); + } else { + return wrapWithModel( + model: _model.scheduleVisitDetailModel, + updateCallback: () => setState(() {}), + updateOnChange: true, + child: ScheduleVisitDetailWidget( + visitorStrList: widget.visitorStrList!, + visitorImgPath: widget.visitorImgPath, + visitStartDate: widget.visitStartDateStr!, + visitEndDate: widget.visitEndDateStr!, + visitResonStr: widget.visitReasonStr!, + visitLevelStr: widget.visitLevelStr!, + visitTempStr: widget.visitTempStr!, + visitObsStr: widget.visitObsStr!, + visitorJsonList: widget.visitorJsonList!, + ), + ); + } + }, ); } -} \ No newline at end of file +} 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 35b21ac6..963676a9 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 @@ -109,16 +109,20 @@ class _VisitorSearchModalTemplateComponentWidgetState _model.addToDocs(_model.textController.text); setState(() {}); } else { - await showModalBottomSheet( - isScrollControlled: true, - enableDrag: true, - isDismissible: true, - backgroundColor: Colors.transparent, + await showAdaptiveDialog( + useSafeArea: true, context: context, builder: (context) { - return Padding( - padding: MediaQuery.viewInsetsOf(context), - child: const VisitorNotFoundComponentWidget(), + return Dialog( + child: Padding( + padding: MediaQuery.viewInsetsOf(context), + child: Container( + color: Colors.transparent, + // width: MediaQuery.of(context).size.height * 0.1, + // height: + // MediaQuery.of(context).size.height * 0.4, + child: const VisitorNotFoundComponentWidget()), + ), ); }, ).then((value) => safeSetState(() {})); diff --git a/lib/flutter_flow/upload_data.dart b/lib/flutter_flow/upload_data.dart index 917034cd..c7c4c597 100644 --- a/lib/flutter_flow/upload_data.dart +++ b/lib/flutter_flow/upload_data.dart @@ -58,23 +58,23 @@ Future?> selectMediaWithSourceBottomSheet({ bool includeBlurHash = false, }) async { createUploadMediaListTile(String label, MediaSource mediaSource) => ListTile( - title: Text( - label, - textAlign: TextAlign.center, - style: GoogleFonts.getFont( - pickerFontFamily, - color: FlutterFlowTheme.of(context).primaryText, - fontWeight: FontWeight.w600, - fontSize: 20, - ), - ), - tileColor: FlutterFlowTheme.of(context).primaryBackground, - dense: false, - onTap: () => Navigator.pop( - context, - mediaSource, - ), - ); + title: Text( + label, + textAlign: TextAlign.center, + style: GoogleFonts.getFont( + pickerFontFamily, + color: FlutterFlowTheme.of(context).primaryText, + fontWeight: FontWeight.w600, + fontSize: 20, + ), + ), + tileColor: FlutterFlowTheme.of(context).primaryBackground, + dense: false, + onTap: () => Navigator.pop( + context, + mediaSource, + ), + ); final mediaSource = await showModalBottomSheet( context: context, backgroundColor: FlutterFlowTheme.of(context).primaryBackground, @@ -91,7 +91,9 @@ Future?> selectMediaWithSourceBottomSheet({ textAlign: TextAlign.center, style: GoogleFonts.getFont( pickerFontFamily, - color: FlutterFlowTheme.of(context).primaryText.withOpacity(0.65), + color: FlutterFlowTheme.of(context) + .primaryText + .withOpacity(0.65), fontWeight: FontWeight.w500, fontSize: 20, ), @@ -360,18 +362,26 @@ void showUploadMessage( child: CircularProgressIndicator( valueColor: Theme.of(context).brightness == Brightness.dark ? AlwaysStoppedAnimation( - FlutterFlowTheme.of(context).accent4) + FlutterFlowTheme.of(context).info) : null, ), ), - Text(message), + Text(message, style: FlutterFlowTheme.of(context).bodyMedium), ], ), - duration: showLoading ? const Duration(days: 1) : const Duration(seconds: 4), + backgroundColor: FlutterFlowTheme.of(context).primary, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(15), + topRight: Radius.circular(15), + ), + ), + duration: + showLoading ? const Duration(days: 1) : const Duration(seconds: 4), ), ); } String? _removeTrailingSlash(String? path) => path != null && path.endsWith('/') ? path.substring(0, path.length - 1) - : path; \ No newline at end of file + : path; diff --git a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart index d1ea6e19..23a7f0d0 100644 --- a/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart +++ b/lib/pages/schedule_complete_visit_page/schedule_complete_visit_page_model.dart @@ -83,6 +83,12 @@ class ScheduleCompleteVisitPageModel enText: 'Start date must be before end date.', ); } + if (startDate.isBefore(DateTime.now())) { + return FFLocalizations.of(context).getVariableText( + enText: 'Start date must be after current date.', + ptText: 'A data de início deve ser posterior à data atual.', + ); + } } catch (e) { return '$e'; } @@ -113,6 +119,12 @@ class ScheduleCompleteVisitPageModel ptText: 'A data de término deve ser posterior à data de início.', ); } + if (endDate.isBefore(DateTime.now())) { + return FFLocalizations.of(context).getVariableText( + enText: 'End date must be after current date.', + ptText: 'A data de término deve ser posterior à data atual.', + ); + } } catch (e) { return '$e'; } 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 868ba7a8..20874759 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 @@ -269,300 +269,12 @@ Widget scheduleVisit( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Column( - mainAxisSize: MainAxisSize.max, - children: [ - 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( - 'u0jocx7e' /* Quais visitantes você deseja c... */, - ), - textAlign: TextAlign.start, - style: FlutterFlowTheme.of(context).bodyMedium.override( - fontFamily: - FlutterFlowTheme.of(context).bodyMediumFamily, - letterSpacing: 0.0, - fontWeight: FontWeight.bold, - useGoogleFonts: GoogleFonts.asMap().containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - ), - ), - if (_model.visitorJsonList.isNotEmpty) - Builder( - builder: (context) { - final visitorListView = - _model.visitorJsonList.map((e) => e).toList(); - return ListView.separated( - padding: const EdgeInsets.fromLTRB( - 0, - 0, - 20, - 20, - ), - shrinkWrap: true, - scrollDirection: Axis.vertical, - itemCount: visitorListView.length, - separatorBuilder: (_, __) => - const SizedBox(height: 5.0), - itemBuilder: (context, visitorListViewIndex) { - final visitorListViewItem = - visitorListView[visitorListViewIndex]; - return InkWell( - splashColor: Colors.transparent, - focusColor: Colors.transparent, - hoverColor: Colors.transparent, - highlightColor: Colors.transparent, - onTap: () async { - // 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: - // const VisitorDetailsModalTemplateComponentWidget( - // visitorImageURL: '', - // visitorEmail: '', - // visitorName: '', - // visitorPhone: '', - // visitorType: '', - // ), - // ), - // ); - // }, - // ).then((value) => safeSetState(() {})); - }, - onLongPress: () async { - // _model.removeFromVisitorJsonList( - // visitorListViewItem); - // setState(() {}); - }, - child: Container( - width: MediaQuery.of(context).size.width, - height: 70.0, - decoration: BoxDecoration( - color: FlutterFlowTheme.of(context) - .primaryBackground, - ), - 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: CachedNetworkImage( - fadeInDuration: - const Duration(milliseconds: 500), - fadeOutDuration: - const Duration(milliseconds: 500), - imageUrl: - "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( - visitorListViewItem, - r'''$.VTE_DOCUMENTO''', - ).toString()}&tipo=E", - fit: BoxFit.cover, - ), - ), - Text( - getJsonField( - visitorListViewItem, - r'''$.VTE_NOME''', - ).toString(), - style: FlutterFlowTheme.of(context) - .bodyMedium - .override( - fontFamily: - FlutterFlowTheme.of(context) - .bodyMediumFamily, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodyMediumFamily), - ), - ), - Expanded( - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: - MainAxisAlignment.end, - children: [ - IconButton( - onPressed: () async { - _model - .removeFromVisitorJsonList( - visitorListViewItem); - setState(() {}); - }, - icon: const Icon(Icons.close)), - ], - ), - ), - ] - .divide(const SizedBox(width: 30.0)) - .addToStart(const SizedBox(width: 30.0)), - ), - ), - ); - }, - ); - }, - ), - Stack( - children: [ - Align( - alignment: const AlignmentDirectional(0.01, 0.0), - child: Padding( - padding: const EdgeInsetsDirectional.fromSTEB( - 0.0, 0.0, 0.0, 20.0), - child: FFButtonWidget( - onPressed: () async { - await showModalBottomSheet( - isScrollControlled: true, - isDismissible: true, - backgroundColor: FlutterFlowTheme.of(context) - .primaryBackground, - enableDrag: true, - context: context, - builder: (context) { - return GestureDetector( - onTap: () => _model - .unfocusNode.canRequestFocus - ? FocusScope.of(context) - .requestFocus(_model.unfocusNode) - : FocusScope.of(context).unfocus(), - child: SizedBox( - height: - MediaQuery.of(context).size.height * - 0.9, - width: MediaQuery.of(context).size.width, - child: Padding( - padding: - MediaQuery.viewInsetsOf(context), - child: - VisitorSearchModalTemplateComponentWidget( - getVisitors: (visitorsParam) async { - _model.visitorJsonList = - visitorsParam! - .toList() - .cast(); - setState(() {}); - }, - getDocs: (docsParam) async { - _model.visitorStrList = - strListToStr( - docsParam!.toList()); - setState(() {}); - }, - ), - ), - ), - ); - }, - ).then((value) => safeSetState(() {})); - }, - text: '', - icon: Icon( - Icons.add, - color: FlutterFlowTheme.of(context).primary, - size: 30.0, - ), - options: FFButtonOptions( - width: MediaQuery.sizeOf(context).width * 0.8, - 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).accent4, - width: 1.0, - ), - 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: Container( - width: MediaQuery.sizeOf(context).width * 0.8, - height: 20.0, - decoration: const BoxDecoration(), - child: Align( - alignment: const AlignmentDirectional(0.0, 0.0), - child: AutoSizeText( - FFLocalizations.of(context).getText( - 'r8soavtz' /* Clique para adicionar um visit... */, - ), - 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), - ), - ), - ), - ), - ), - ), - ], - ), - ], - ), Column(mainAxisSize: MainAxisSize.max, children: [ Align( alignment: const AlignmentDirectional(-1.0, 0.0), child: Padding( padding: const EdgeInsetsDirectional.fromSTEB( - 20.0, 24.0, 0.0, 24.0), + 20.0, 30.0, 0.0, 24.0), child: Text( FFLocalizations.of(context).getText( '98evnbbe' /* Qual o período de validade da ... */, @@ -1079,6 +791,294 @@ Widget scheduleVisit( ] // .divide(const SizedBox(height: 0.0)), ), + Column( + mainAxisSize: MainAxisSize.max, + children: [ + Align( + alignment: const AlignmentDirectional(-1.0, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 20.0, 24.0, 0.0, 30.0), + child: Text( + FFLocalizations.of(context).getText( + 'u0jocx7e' /* Quais visitantes você deseja c... */, + ), + textAlign: TextAlign.start, + style: FlutterFlowTheme.of(context).bodyMedium.override( + fontFamily: + FlutterFlowTheme.of(context).bodyMediumFamily, + letterSpacing: 0.0, + fontWeight: FontWeight.bold, + useGoogleFonts: GoogleFonts.asMap().containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + ), + ), + if (_model.visitorJsonList.isNotEmpty) + Builder( + builder: (context) { + final visitorListView = + _model.visitorJsonList.map((e) => e).toList(); + return ListView.separated( + padding: const EdgeInsets.fromLTRB( + 0, + 0, + 20, + 20, + ), + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: visitorListView.length, + separatorBuilder: (_, __) => + const SizedBox(height: 5.0), + itemBuilder: (context, visitorListViewIndex) { + final visitorListViewItem = + visitorListView[visitorListViewIndex]; + return InkWell( + splashColor: Colors.transparent, + focusColor: Colors.transparent, + hoverColor: Colors.transparent, + highlightColor: Colors.transparent, + onTap: () async { + // 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: + // const VisitorDetailsModalTemplateComponentWidget( + // visitorImageURL: '', + // visitorEmail: '', + // visitorName: '', + // visitorPhone: '', + // visitorType: '', + // ), + // ), + // ); + // }, + // ).then((value) => safeSetState(() {})); + }, + onLongPress: () async { + // _model.removeFromVisitorJsonList( + // visitorListViewItem); + // setState(() {}); + }, + child: Container( + width: MediaQuery.of(context).size.width, + height: 70.0, + decoration: BoxDecoration( + color: FlutterFlowTheme.of(context) + .primaryBackground, + ), + 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: CachedNetworkImage( + fadeInDuration: + const Duration(milliseconds: 500), + fadeOutDuration: + const Duration(milliseconds: 500), + imageUrl: + "https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField( + visitorListViewItem, + r'''$.VTE_DOCUMENTO''', + ).toString()}&tipo=E", + fit: BoxFit.cover, + ), + ), + Text( + getJsonField( + visitorListViewItem, + r'''$.VTE_NOME''', + ).toString(), + style: FlutterFlowTheme.of(context) + .bodyMedium + .override( + fontFamily: + FlutterFlowTheme.of(context) + .bodyMediumFamily, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodyMediumFamily), + ), + ), + Expanded( + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + IconButton( + onPressed: () async { + _model + .removeFromVisitorJsonList( + visitorListViewItem); + setState(() {}); + }, + icon: const Icon(Icons.close)), + ], + ), + ), + ] + .divide(const SizedBox(width: 30.0)) + .addToStart(const SizedBox(width: 30.0)), + ), + ), + ); + }, + ); + }, + ), + Stack( + children: [ + Align( + alignment: const AlignmentDirectional(0.01, 0.0), + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0.0, 0.0, 0.0, 20.0), + child: FFButtonWidget( + onPressed: () async { + await showModalBottomSheet( + isScrollControlled: true, + isDismissible: true, + backgroundColor: FlutterFlowTheme.of(context) + .primaryBackground, + enableDrag: true, + context: context, + builder: (context) { + return GestureDetector( + onTap: () => _model + .unfocusNode.canRequestFocus + ? FocusScope.of(context) + .requestFocus(_model.unfocusNode) + : FocusScope.of(context).unfocus(), + child: SizedBox( + height: + MediaQuery.of(context).size.height * + 0.7, + width: MediaQuery.of(context).size.width, + child: Padding( + padding: + MediaQuery.viewInsetsOf(context), + child: + VisitorSearchModalTemplateComponentWidget( + getVisitors: (visitorsParam) async { + _model.visitorJsonList = + visitorsParam! + .toList() + .cast(); + setState(() {}); + }, + getDocs: (docsParam) async { + _model.visitorStrList = + strListToStr( + docsParam!.toList()); + setState(() {}); + }, + ), + ), + ), + ); + }, + ).then((value) => safeSetState(() {})); + }, + text: '', + icon: Icon( + Icons.add, + color: FlutterFlowTheme.of(context).primary, + size: 30.0, + ), + options: FFButtonOptions( + width: MediaQuery.sizeOf(context).width * 0.8, + 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).accent4, + width: 1.0, + ), + 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: Container( + width: MediaQuery.sizeOf(context).width * 0.8, + height: 20.0, + decoration: const BoxDecoration(), + child: Align( + alignment: const AlignmentDirectional(0.0, 0.0), + child: AutoSizeText( + FFLocalizations.of(context).getText( + 'r8soavtz' /* Clique para adicionar um visit... */, + ), + 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), + ), + ), + ), + ), + ), + ), + ], + ), + ], + ), Column( mainAxisSize: MainAxisSize.max, children: [ @@ -1146,6 +1146,8 @@ Widget scheduleVisit( dropDownGetDadosResponse.jsonBody, ); return FlutterFlowDropDown( + fillColor: FlutterFlowTheme.of(context) + .primaryBackground, controller: _model.dropDownValueController1 ??= FormFieldController( @@ -1326,6 +1328,8 @@ Widget scheduleVisit( const EdgeInsetsDirectional.fromSTEB( 16.0, 0.0, 16.0, 0.0), hidesUnderline: true, + fillColor: FlutterFlowTheme.of(context) + .primaryBackground, isOverButton: true, isSearchable: false, isMultiSelect: false, @@ -1602,13 +1606,13 @@ Widget scheduleVisit( ), ), FFButtonWidget( - text: 'Schedule', + text: FFLocalizations.of(context).getVariableText( + enText: 'Schedule', + ptText: 'Agendar', + ), onPressed: _model.isValid() ? () async { await showDialog( - // isScrollControlled: true, - // backgroundColor: Colors.transparent, - // enableDrag: false, context: context, builder: (context) { return GestureDetector( @@ -1619,8 +1623,8 @@ Widget scheduleVisit( child: Dialog( alignment: Alignment.topCenter, child: SizedBox( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height * 0.5, + // width: MediaQuery.of(context).size.width, + // height: MediaQuery.of(context).size.height * 0.7, child: VisitDetailsModalTemplateComponentWidget( visitStartDateStr: _model.textController1.text, visitEndDateStr: _model.textController2.text, @@ -1645,6 +1649,12 @@ Widget scheduleVisit( height: MediaQuery.of(context).size.height * 0.05, width: MediaQuery.of(context).size.height * 0.2, color: FlutterFlowTheme.of(context).primary, + borderRadius: const BorderRadius.only( + bottomLeft: Radius.circular(15.0), + bottomRight: Radius.circular(15.0), + topLeft: Radius.circular(15.0), + topRight: Radius.circular(15.0), + ), disabledColor: FlutterFlowTheme.of(context).customColor5), showLoadingIndicator: true, ), From 3b6170bc09d82b99ecdb4d479fbe9fd9797952b9 Mon Sep 17 00:00:00 2001 From: Flavio Escobar Date: Fri, 2 Aug 2024 10:24:39 -0300 Subject: [PATCH 05/10] fix: image upload --- ios/Runner.xcodeproj/project.pbxproj | 4 ++-- ios/Runner/Base.lproj/Main.storyboard | 13 ++++++++----- .../regisiter_vistor_template_component_widget.dart | 9 +++++---- lib/flutter_flow/upload_data.dart | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 93d93c55..4a0cc75e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -41,6 +41,8 @@ 4C588A6A63D12FBFE8C3D586 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 4C7A2C30DCF835BA60FAD235 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 50BE974D08F66282C0031620 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 6436409127A31CDB00820AF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 6436409227A31CD800820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -51,8 +53,6 @@ 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 = ""; }; - 6436409227A31CD800820AF7 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = ""; }; - 6436409127A31CDB00820AF7 /* 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 = ""; }; C1B4A503715BC7B0F8826983 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index f3c28516..0fb20ec6 100644 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -14,13 +16,14 @@ - + - + + 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 9e187e31..2632a536 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 @@ -491,10 +491,11 @@ class _RegisiterVistorTemplateComponentWidgetState allowPhoto: true, includeDimensions: true, ); - if (selectedMedia != null && - selectedMedia.every((m) => - validateFileFormat( - m.storagePath, context))) { + if (selectedMedia != null){ + // && + // selectedMedia.every((m) => + // validateFileFormat( + // m.storagePath, context))) { setState(() => _model.isDataUploading = true); var selectedUploadedFiles = []; diff --git a/lib/flutter_flow/upload_data.dart b/lib/flutter_flow/upload_data.dart index c7c4c597..d0d24a0c 100644 --- a/lib/flutter_flow/upload_data.dart +++ b/lib/flutter_flow/upload_data.dart @@ -11,7 +11,7 @@ import 'package:video_player/video_player.dart'; import 'flutter_flow_theme.dart'; import 'flutter_flow_util.dart'; -const allowedFormats = {'image/png', 'image/jpeg', 'video/mp4', 'image/gif'}; +const allowedFormats = {'image/png', 'image/jpeg'}; class SelectedFile { const SelectedFile({ From 518e4140c4b37712d4ec86245561d69d4c9f9426 Mon Sep 17 00:00:00 2001 From: Flavio Escobar Date: Fri, 2 Aug 2024 10:43:48 -0300 Subject: [PATCH 06/10] WIP --- ...iter_vistor_template_component_widget.dart | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) 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 2632a536..1ab51600 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 @@ -335,7 +335,7 @@ class _RegisiterVistorTemplateComponentWidgetState ), Padding( padding: - const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 10.0), + const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 10.0), child: Container( width: MediaQuery.sizeOf(context).width * 0.95, decoration: const BoxDecoration(), @@ -345,26 +345,7 @@ class _RegisiterVistorTemplateComponentWidgetState 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), From 08e072e183678cd83aab1c2aab21cd510b6dc0ff Mon Sep 17 00:00:00 2001 From: Ivan Antunes Date: Fri, 2 Aug 2024 11:18:09 -0300 Subject: [PATCH 07/10] WIP --- ...siter_vistor_template_component_model.dart | 2 + ...iter_vistor_template_component_widget.dart | 37 ++++++++++++++++--- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart index 6e812792..3e518237 100644 --- a/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart +++ b/lib/components/templates_components/regisiter_vistor_template_component/regisiter_vistor_template_component_model.dart @@ -37,6 +37,7 @@ class RegisiterVistorTemplateComponentModel Future getVisitanteByDocument( String document, BuildContext context) async { + final response = await PhpGroup.getVisitorByDocCall.call( devUUID: FFAppState().devUUID, userUUID: FFAppState().userUUID, @@ -44,6 +45,7 @@ class RegisiterVistorTemplateComponentModel atividade: 'getVisitante', documento: document, ); + log('${response.jsonBody}'); if (response.jsonBody['visitante']['VTE_ID'] != '0' && response.jsonBody['error'] != 'false') { 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 1ab51600..e18779eb 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 @@ -38,6 +38,8 @@ class _RegisiterVistorTemplateComponentWidgetState final scaffoldKey = GlobalKey(); + bool _isVisitorRegistered = false; + @override void initState() { super.initState(); @@ -71,6 +73,32 @@ class _RegisiterVistorTemplateComponentWidgetState setState(() {}); } + bool _isFormValid(BuildContext context) { + + if (_model.uploadedLocalFile.bytes?.isEmpty ?? true) { + return false; + } + + if (_model.textController1.text.isEmpty || _model.textController1.text == '') { + return false; + } + + if (_model.dropDownValue == null || _model.dropDownValue!.isEmpty || _model.dropDownValue == '') { + return false; + } + + if (_model.textController2.text.isEmpty || _model.textController2.text == '') { + return false; + } + + log("Visitante Já Cadastrado $_isVisitorRegistered"); + if (_isVisitorRegistered) { + return false; + } + + return true; + } + @override Widget build(BuildContext context) { BehaviorSubject visitorAlreadyRegistered = BehaviorSubject(); @@ -216,9 +244,11 @@ class _RegisiterVistorTemplateComponentWidgetState } else if (snapshot.hasError || snapshot.data == null || snapshot.data == '') { + _isVisitorRegistered = false; visitorAlreadyRegistered.add(true); return const SizedBox(); } else { + _isVisitorRegistered = true; visitorAlreadyRegistered.add(false); return _model.textController2.text.isEmpty ? const SizedBox() @@ -775,12 +805,7 @@ class _RegisiterVistorTemplateComponentWidgetState padding: const EdgeInsetsDirectional.fromSTEB(0.0, 65.0, 0.0, 0.0), child: FFButtonWidget( - onPressed: (((_model.uploadedLocalFile.bytes?.isNotEmpty ?? - false)) && - (_model.textController1.text != '') && - (_model.dropDownValue != null && - _model.dropDownValue != '') && - (_model.textController2.text != '')) + onPressed: _isFormValid(context) ? () async { log(visitorAlreadyRegistered.value.toString()); if (visitorAlreadyRegistered.value == true) { From 561a128943abd8c1220bd97798c575381de90ffa Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Fri, 2 Aug 2024 11:22:31 -0300 Subject: [PATCH 08/10] feat: Improve image upload functionality The code changes include fixes for image upload, renaming of a class, and improvements to message well, visitor register, and preferences pages. These changes aim to enhance the image upload functionality and ensure a smoother user experience. --- ...iter_vistor_template_component_widget.dart | 175 ++++++++---------- 1 file changed, 77 insertions(+), 98 deletions(-) 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 e18779eb..1f06484d 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 @@ -364,100 +364,79 @@ class _RegisiterVistorTemplateComponentWidgetState ), ), Padding( - padding: - const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 10.0), - child: Container( - width: MediaQuery.sizeOf(context).width * 0.95, - decoration: const BoxDecoration(), - child: Column( - children: [ - Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - - 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).customColor6, - 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)), - ), - if (_model.dropDownValue == null || - _model.dropDownValue == '') - Align( - alignment: const AlignmentDirectional(0.4, 0), - child: Text( - FFLocalizations.of(context).getVariableText( - enText: 'This field is required', - ptText: 'Este campo é obrigatório', - ), - style: FlutterFlowTheme.of(context) - .bodySmall - .override( - fontFamily: FlutterFlowTheme.of(context) - .bodySmallFamily, - color: FlutterFlowTheme.of(context) - .customColor6, - letterSpacing: 0.0, - useGoogleFonts: GoogleFonts.asMap() - .containsKey( - FlutterFlowTheme.of(context) - .bodySmallFamily), - )), + padding: const EdgeInsetsDirectional.fromSTEB( + 24.0, 0.0, 24.0, 10.0), + child: Column( + children: [ + 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: MediaQuery.sizeOf(context).width * 0.9, + // 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).customColor6, + 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, + ), + if (_model.dropDownValue == null || + _model.dropDownValue == '') + Align( + alignment: const AlignmentDirectional(0.4, 0), + child: Text( + FFLocalizations.of(context).getVariableText( + enText: 'This field is required', + ptText: 'Este campo é obrigatório', + ), + style: FlutterFlowTheme.of(context) + .bodySmall + .override( + fontFamily: FlutterFlowTheme.of(context) + .bodySmallFamily, + color: FlutterFlowTheme.of(context) + .customColor6, + letterSpacing: 0.0, + useGoogleFonts: GoogleFonts.asMap() + .containsKey( + FlutterFlowTheme.of(context) + .bodySmallFamily), + )), + ), + ], ), ), Builder( @@ -502,11 +481,11 @@ class _RegisiterVistorTemplateComponentWidgetState allowPhoto: true, includeDimensions: true, ); - if (selectedMedia != null){ - // && - // selectedMedia.every((m) => - // validateFileFormat( - // m.storagePath, context))) { + if (selectedMedia != null) { + // && + // selectedMedia.every((m) => + // validateFileFormat( + // m.storagePath, context))) { setState(() => _model.isDataUploading = true); var selectedUploadedFiles = []; From 03bd74705025a9c052d628522fb14c729daf9a8a Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Fri, 2 Aug 2024 12:15:15 -0300 Subject: [PATCH 09/10] WIP --- ...regisiter_vistor_template_component_widget.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 1f06484d..5ea36575 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 @@ -74,20 +74,23 @@ class _RegisiterVistorTemplateComponentWidgetState } bool _isFormValid(BuildContext context) { - if (_model.uploadedLocalFile.bytes?.isEmpty ?? true) { return false; } - if (_model.textController1.text.isEmpty || _model.textController1.text == '') { + if (_model.textController1.text.isEmpty || + _model.textController1.text == '') { return false; } - if (_model.dropDownValue == null || _model.dropDownValue!.isEmpty || _model.dropDownValue == '') { + if (_model.dropDownValue == null || + _model.dropDownValue!.isEmpty || + _model.dropDownValue == '') { return false; } - if (_model.textController2.text.isEmpty || _model.textController2.text == '') { + if (_model.textController2.text.isEmpty || + _model.textController2.text == '') { return false; } @@ -244,11 +247,12 @@ class _RegisiterVistorTemplateComponentWidgetState } else if (snapshot.hasError || snapshot.data == null || snapshot.data == '') { + safeSetState(() => _isVisitorRegistered = false); _isVisitorRegistered = false; visitorAlreadyRegistered.add(true); return const SizedBox(); } else { - _isVisitorRegistered = true; + safeSetState(() => _isVisitorRegistered = true); visitorAlreadyRegistered.add(false); return _model.textController2.text.isEmpty ? const SizedBox() From 823b02ade6d3acc7f9eede4e734d5b7ac70adc29 Mon Sep 17 00:00:00 2001 From: jantunesmesias Date: Fri, 2 Aug 2024 13:58:05 -0300 Subject: [PATCH 10/10] WIP --- .../regisiter_vistor_template_component_widget.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 5ea36575..3440eb7b 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 @@ -247,12 +247,12 @@ class _RegisiterVistorTemplateComponentWidgetState } else if (snapshot.hasError || snapshot.data == null || snapshot.data == '') { - safeSetState(() => _isVisitorRegistered = false); + // safeSetState(() => _isVisitorRegistered = false); _isVisitorRegistered = false; visitorAlreadyRegistered.add(true); return const SizedBox(); } else { - safeSetState(() => _isVisitorRegistered = true); + _isVisitorRegistered = true; visitorAlreadyRegistered.add(false); return _model.textController2.text.isEmpty ? const SizedBox()