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,