fix message well, visitor register and preferences pages
This commit is contained in:
parent
ee8591f41d
commit
14d2c2f19e
|
@ -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<ScheduleVisitDetailWidget> {
|
|||
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<ScheduleVisitDetailWidget> {
|
|||
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<ScheduleVisitDetailWidget> {
|
|||
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<String>(
|
||||
"https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${getJsonField(
|
||||
|
@ -352,7 +355,8 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
|||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(
|
||||
8.0, 0.0, 8.0, 0.0),
|
||||
child: TextFormField(
|
||||
controller: _model.textController2,
|
||||
|
@ -459,7 +463,8 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
|||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(
|
||||
8.0, 0.0, 8.0, 0.0),
|
||||
child: TextFormField(
|
||||
controller: _model.textController3,
|
||||
|
@ -576,7 +581,8 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
|||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(
|
||||
8.0, 0.0, 8.0, 0.0),
|
||||
child: TextFormField(
|
||||
controller: _model.textController4,
|
||||
|
@ -683,7 +689,8 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
|||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(
|
||||
8.0, 0.0, 8.0, 0.0),
|
||||
child: TextFormField(
|
||||
controller: _model.textController5,
|
||||
|
@ -905,7 +912,8 @@ class _ScheduleVisitDetailWidgetState extends State<ScheduleVisitDetailWidget> {
|
|||
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<ScheduleVisitDetailWidget> {
|
|||
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,
|
||||
|
|
|
@ -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<bool?> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<bool> visitorAlreadyRegistered = BehaviorSubject<bool>();
|
||||
context.watch<FFAppState>();
|
||||
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<String>(
|
||||
controller: _model.dropDownValueController ??=
|
||||
FormFieldController<String>(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<String>(
|
||||
controller: _model.dropDownValueController ??=
|
||||
FormFieldController<String>(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,13 +793,15 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(0.0, 65.0, 0.0, 0.0),
|
||||
child: FFButtonWidget(
|
||||
onPressed: () async {
|
||||
if (((_model.uploadedLocalFile.bytes?.isNotEmpty ??
|
||||
onPressed: (((_model.uploadedLocalFile.bytes?.isNotEmpty ??
|
||||
false)) &&
|
||||
(_model.textController1.text != '') &&
|
||||
(_model.dropDownValue != null &&
|
||||
_model.dropDownValue != '') &&
|
||||
(_model.textController2.text != '')) {
|
||||
(_model.textController2.text != ''))
|
||||
? () async {
|
||||
log(visitorAlreadyRegistered.value.toString());
|
||||
if (visitorAlreadyRegistered.value == true) {
|
||||
_model.imgBase64 =
|
||||
await actions.convertImageFileToBase64(
|
||||
_model.uploadedLocalFile,
|
||||
|
@ -770,7 +830,8 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
return GestureDetector(
|
||||
onTap: () => Navigator.pop(context),
|
||||
child: Padding(
|
||||
padding: MediaQuery.viewInsetsOf(context),
|
||||
padding:
|
||||
MediaQuery.viewInsetsOf(context),
|
||||
child: Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: ThrowExceptionWidget(
|
||||
|
@ -788,16 +849,15 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
},
|
||||
);
|
||||
});
|
||||
|
||||
if (PhpGroup.postScheduleVisitorCall.error(
|
||||
(_model.scheduleVisitor?.jsonBody ?? ''),
|
||||
) ==
|
||||
false) {
|
||||
setState(() {
|
||||
_model.textController1?.clearComposing();
|
||||
_model.textController2?.clearComposing();
|
||||
_model.textController3?.clearComposing();
|
||||
_model.textController4?.clearComposing();
|
||||
_model.textController1?.clear();
|
||||
_model.textController2?.clear();
|
||||
_model.textController3?.clear();
|
||||
_model.textController4?.clear();
|
||||
_model.dropDownValueController?.reset();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
|
@ -809,81 +869,53 @@ class _RegisiterVistorTemplateComponentWidgetState
|
|||
'Visitor successfully registered.'),
|
||||
style: TextStyle(
|
||||
color:
|
||||
FlutterFlowTheme.of(context).info)),
|
||||
FlutterFlowTheme.of(context)
|
||||
.info)),
|
||||
backgroundColor:
|
||||
FlutterFlowTheme.of(context).primary,
|
||||
duration: const Duration(seconds: 3),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(15),
|
||||
topRight: Radius.circular(15),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (widget.source == 'VisitorNotFoundComponent') {
|
||||
if (widget.source ==
|
||||
'VisitorNotFoundComponent') {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
await showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return GestureDetector(
|
||||
onTap: () => _model.unfocusNode.canRequestFocus
|
||||
? FocusScope.of(context)
|
||||
.requestFocus(_model.unfocusNode)
|
||||
: FocusScope.of(context).unfocus(),
|
||||
child: Padding(
|
||||
padding: MediaQuery.viewInsetsOf(context),
|
||||
child: Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: ThrowExceptionWidget(
|
||||
msg: PhpGroup.postScheduleVisitorCall
|
||||
.errorMsg(_model
|
||||
.scheduleVisitor?.jsonBody)
|
||||
.toString()),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
).then((value) => safeSetState(() {}));
|
||||
return DialogUtil.error(
|
||||
context,
|
||||
PhpGroup.postScheduleVisitorCall
|
||||
.errorMsg(
|
||||
_model.scheduleVisitor?.jsonBody)
|
||||
.toString());
|
||||
}
|
||||
} 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(
|
||||
DialogUtil.error(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
ptText:
|
||||
'Você esqueceu de adicionar algum dado obrigatório. Verifique se a imagem, nome, tipo e documento foram preenchidos corretamente.',
|
||||
'Visitante já cadastrado. Verifique se o documento foi preenchido corretamente.',
|
||||
enText:
|
||||
'You forgot to add some required data. Check if the image, name, type and document were filled in correctly.',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
).then((value) => safeSetState(() {}));
|
||||
'Visitor already registered. Check if the document was filled in correctly.',
|
||||
));
|
||||
}
|
||||
|
||||
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(
|
||||
|
|
|
@ -101,8 +101,7 @@ class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
|||
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<ViewVisitDetailWidget> {
|
|||
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<ViewVisitDetailWidget> {
|
|||
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}.',
|
||||
);
|
||||
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -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<VisitorDetailsModalTemplateComponentWidget> createState() =>
|
||||
|
@ -50,11 +62,10 @@ 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(
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 34.0,
|
||||
decoration: BoxDecoration(
|
||||
|
@ -62,8 +73,29 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(0.0),
|
||||
bottomRight: Radius.circular(0.0),
|
||||
topLeft: Radius.circular(0.0),
|
||||
topRight: 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,21 +103,21 @@ 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(
|
||||
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,
|
||||
|
@ -94,7 +126,7 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
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',
|
||||
widget.visitorImageURL!,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
|
@ -104,15 +136,12 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
20.0, 0.0, 20.0, 0.0),
|
||||
child: Text(
|
||||
FFLocalizations.of(context).getText(
|
||||
'kqzf7nx2' /* Nome do Visitante */,
|
||||
),
|
||||
widget.visitorName ?? '',
|
||||
textAlign: TextAlign.start,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context)
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.bodyMediumFamily,
|
||||
fontSize: 24.0,
|
||||
letterSpacing: 0.0,
|
||||
|
@ -138,8 +167,7 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context)
|
||||
fontFamily: FlutterFlowTheme.of(context)
|
||||
.bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
@ -160,7 +188,8 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
size: 24.0,
|
||||
),
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||
alignment:
|
||||
const AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
20.0, 0.0, 20.0, 0.0),
|
||||
|
@ -177,11 +206,9 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
.bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
useGoogleFonts: GoogleFonts
|
||||
.asMap()
|
||||
useGoogleFonts: GoogleFonts.asMap()
|
||||
.containsKey(
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
FlutterFlowTheme.of(context)
|
||||
.bodyMediumFamily),
|
||||
),
|
||||
),
|
||||
|
@ -198,7 +225,8 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
size: 24.0,
|
||||
),
|
||||
Align(
|
||||
alignment: const AlignmentDirectional(-1.0, 0.0),
|
||||
alignment:
|
||||
const AlignmentDirectional(-1.0, 0.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||
20.0, 0.0, 20.0, 0.0),
|
||||
|
@ -215,11 +243,9 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
.bodyMediumFamily,
|
||||
letterSpacing: 0.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
useGoogleFonts: GoogleFonts
|
||||
.asMap()
|
||||
useGoogleFonts: GoogleFonts.asMap()
|
||||
.containsKey(
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
FlutterFlowTheme.of(context)
|
||||
.bodyMediumFamily),
|
||||
),
|
||||
),
|
||||
|
@ -230,49 +256,25 @@ class _VisitorDetailsModalTemplateComponentWidgetState
|
|||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 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),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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<String>(
|
||||
_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<String>(
|
||||
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",
|
||||
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
||||
),
|
||||
width: 60.0,
|
||||
height: 60.0,
|
||||
fit: BoxFit.cover,
|
||||
|
@ -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,13 +411,17 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
|||
width: 100.0,
|
||||
height: 100.0,
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context).secondaryBackground,
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
FFButtonWidget(
|
||||
onPressed: () async {
|
||||
await widget.getVisitors?.call(
|
||||
|
@ -487,19 +432,21 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
|||
);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
text: FFLocalizations.of(context).getText(
|
||||
'ug6qzyla' /* Adicionar */,
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'Add',
|
||||
ptText: 'Adicionar',
|
||||
),
|
||||
options: FFButtonOptions(
|
||||
width: double.infinity,
|
||||
height: 30.0,
|
||||
padding:
|
||||
const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
||||
iconPadding:
|
||||
const EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),
|
||||
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,
|
||||
fontFamily:
|
||||
FlutterFlowTheme.of(context).titleSmallFamily,
|
||||
color: Colors.white,
|
||||
letterSpacing: 0.0,
|
||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||
|
@ -511,15 +458,20 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
|||
width: 1.0,
|
||||
),
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(0.0),
|
||||
bottomRight: Radius.circular(0.0),
|
||||
topLeft: Radius.circular(0.0),
|
||||
topRight: Radius.circular(0.0),
|
||||
bottomLeft: Radius.circular(15),
|
||||
bottomRight: Radius.circular(15),
|
||||
topLeft: Radius.circular(15),
|
||||
topRight: Radius.circular(15),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10.0,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
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<MessageHistoryPageWidget> {
|
||||
class MessageHistoryPageModel
|
||||
extends FlutterFlowModel<MessageHistoryPageWidget> {
|
||||
/// State fields for stateful widgets in this page.
|
||||
///
|
||||
|
||||
|
@ -49,7 +50,6 @@ class MessageHistoryPageModel extends FlutterFlowModel<MessageHistoryPageWidget>
|
|||
textController?.dispose();
|
||||
tabBarController?.dispose();
|
||||
|
||||
|
||||
/// Dispose query cache managers for this widget.
|
||||
|
||||
clearGetLiberationsCache();
|
||||
|
|
|
@ -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<MessageHistoryPageWidget> with TickerProviderStateMixin {
|
||||
class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
|
||||
with TickerProviderStateMixin {
|
||||
late MessageHistoryPageModel _model;
|
||||
|
||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
@ -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: [
|
||||
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<ApiCallResponse>(
|
||||
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),
|
||||
|
@ -249,6 +248,10 @@ Widget messageHistoryItem(
|
|||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 15.0),
|
||||
|
@ -256,49 +259,50 @@ Widget messageHistoryItem(
|
|||
jsonBody['MSG_DATE'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: FlutterFlowTheme.of(context).primary,
|
||||
fontSize: 10,
|
||||
color: FlutterFlowTheme.of(context).customColor6,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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).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,
|
||||
),
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(jsonBody['MSG_TEXTO'].toString(),),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
jsonBody['MSG_TEXTO'].toString(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
}
|
|
@ -51,42 +51,9 @@ 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),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void toggleNotify(BuildContext context) {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<ScheduleCompleteVisitPageWidget> {
|
||||
|
@ -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<String>? dropDownValueController1;
|
||||
|
||||
// State field(s) for DropDown widget.
|
||||
String? dropDownValue2;
|
||||
FormFieldController<String>? 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() {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue