958 lines
46 KiB
Dart
958 lines
46 KiB
Dart
import 'dart:convert';
|
|
import 'dart:developer';
|
|
|
|
import '/backend/api_requests/api_calls.dart';
|
|
import '/components/molecular_components/throw_exception/throw_exception_widget.dart';
|
|
import '/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart';
|
|
import '/flutter_flow/flutter_flow_icon_button.dart';
|
|
import '/flutter_flow/flutter_flow_theme.dart';
|
|
import '/flutter_flow/flutter_flow_util.dart';
|
|
import '/actions/actions.dart' as action_blocks;
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:share_plus/share_plus.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/scheduler.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'view_visit_detail_model.dart';
|
|
export 'view_visit_detail_model.dart';
|
|
|
|
class ViewVisitDetailWidget extends StatefulWidget {
|
|
const ViewVisitDetailWidget({
|
|
super.key,
|
|
this.visitorImgPath,
|
|
required this.visitStartDate,
|
|
required this.visitEndDate,
|
|
required this.visitReasonStr,
|
|
required this.visitLevelStr,
|
|
required this.visitTempStr,
|
|
required this.visitObsStr,
|
|
required this.visitStatusStr,
|
|
required this.visitorStrList,
|
|
this.visitorJsonList,
|
|
required this.visitIdStr,
|
|
required this.visitStatusColor,
|
|
});
|
|
|
|
final String? visitorImgPath;
|
|
final String? visitStartDate;
|
|
final String? visitEndDate;
|
|
final String? visitReasonStr;
|
|
final String? visitLevelStr;
|
|
final String? visitTempStr;
|
|
final String? visitObsStr;
|
|
final String? visitStatusStr;
|
|
final String? visitorStrList;
|
|
final List<dynamic>? visitorJsonList;
|
|
final String? visitIdStr;
|
|
final Color? visitStatusColor;
|
|
|
|
@override
|
|
State<ViewVisitDetailWidget> createState() => _ViewVisitDetailWidgetState();
|
|
}
|
|
|
|
List<dynamic>? findVisitorById(List<dynamic>? jsonList, String? id) {
|
|
if (jsonList == null || id == null) return null;
|
|
try {
|
|
var foundItem = jsonList.firstWhere(
|
|
(item) => item["VAW_ID"] == id,
|
|
orElse: () => null,
|
|
);
|
|
return foundItem != null ? [foundItem] : null;
|
|
} catch (e) {
|
|
log("Error searching item: $e");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
class _ViewVisitDetailWidgetState extends State<ViewVisitDetailWidget> {
|
|
late ViewVisitDetailModel _model;
|
|
bool isLoading = true;
|
|
|
|
@override
|
|
void setState(VoidCallback callback) {
|
|
super.setState(callback);
|
|
_model.onUpdate();
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_model = createModel(context, () => ViewVisitDetailModel());
|
|
|
|
// On component load action.
|
|
// SchedulerBinding.instance.addPostFrameCallback((_) async {
|
|
// if (widget.visitStatusStr != null) {
|
|
// _model.visitStatusColor = await action_blocks.manageStatusColorAction(
|
|
// context,
|
|
// visitStatusStr: widget.visitStatusStr!,
|
|
// );
|
|
// }
|
|
// });
|
|
|
|
_model.textController1 = TextEditingController(
|
|
text: widget.visitTempStr == 'null' ? '' : widget.visitTempStr ?? '');
|
|
_model.textFieldFocusNode1 ??= FocusNode();
|
|
|
|
_model.textController2 ??=
|
|
TextEditingController(text: widget.visitStartDate);
|
|
_model.textFieldFocusNode2 ??= FocusNode();
|
|
|
|
_model.textController3 ??=
|
|
TextEditingController(text: widget.visitEndDate);
|
|
_model.textFieldFocusNode3 ??= FocusNode();
|
|
|
|
_model.textController4 ??=
|
|
TextEditingController(text: widget.visitReasonStr);
|
|
_model.textFieldFocusNode4 ??= FocusNode();
|
|
|
|
_model.textController5 ??=
|
|
TextEditingController(text: widget.visitLevelStr);
|
|
_model.textFieldFocusNode5 ??= FocusNode();
|
|
|
|
_model.textController6 ??= TextEditingController(text: widget.visitObsStr);
|
|
_model.textFieldFocusNode6 ??= FocusNode();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_model.maybeDispose();
|
|
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var filteredVisitorJsonList =
|
|
findVisitorById(widget.visitorJsonList, widget.visitIdStr) ?? 'null';
|
|
|
|
context.watch<FFAppState>();
|
|
|
|
return Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(0.0, 35.0, 0.0, 0.0),
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
borderRadius: const BorderRadius.only(
|
|
bottomLeft: Radius.circular(25.0),
|
|
bottomRight: Radius.circular(25.0),
|
|
topLeft: Radius.circular(25.0),
|
|
topRight: Radius.circular(25.0),
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Align(
|
|
alignment: const AlignmentDirectional(0.0, -1.0),
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 35.0,
|
|
decoration: const BoxDecoration(
|
|
borderRadius: BorderRadius.only(
|
|
bottomLeft: Radius.circular(0.0),
|
|
bottomRight: Radius.circular(0.0),
|
|
topLeft: Radius.circular(25.0),
|
|
topRight: Radius.circular(25.0),
|
|
),
|
|
),
|
|
child: Align(
|
|
alignment: const AlignmentDirectional(1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
15.0, 0.0, 15.0, 0.0),
|
|
child: FlutterFlowIconButton(
|
|
borderRadius: 20.0,
|
|
borderWidth: 1.0,
|
|
buttonSize: 40.0,
|
|
icon: Icon(
|
|
Icons.close,
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
size: 24.0,
|
|
),
|
|
onPressed: () async {
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
decoration: const BoxDecoration(
|
|
shape: BoxShape.rectangle,
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
Align(
|
|
alignment: const AlignmentDirectional(1.0, -1.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
0.0, 0.0, 20.0, 20.0),
|
|
child: Container(
|
|
width: 100.0,
|
|
decoration: const BoxDecoration(),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100.0),
|
|
),
|
|
child: Align(
|
|
alignment: const AlignmentDirectional(1.0, -1.0),
|
|
child: InkWell(
|
|
splashColor: Colors.transparent,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
highlightColor: Colors.transparent,
|
|
onTap: () async {
|
|
Navigator.pop(context);
|
|
await showModalBottomSheet(
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
useSafeArea: true,
|
|
context: context,
|
|
builder: (context) {
|
|
return Padding(
|
|
padding: MediaQuery.viewInsetsOf(context),
|
|
child:
|
|
const VisitorDetailsModalTemplateComponentWidget(),
|
|
);
|
|
},
|
|
).then((value) => safeSetState(() {}));
|
|
},
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(100.0),
|
|
child: CachedNetworkImage(
|
|
fadeInDuration:
|
|
const Duration(milliseconds: 500),
|
|
fadeOutDuration:
|
|
const Duration(milliseconds: 500),
|
|
imageUrl: valueOrDefault<String>(
|
|
widget.visitorImgPath,
|
|
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
|
),
|
|
width: 100.0,
|
|
height: 100.0,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
decoration: const BoxDecoration(),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
8.0, 0.0, 8.0, 10.0),
|
|
child: TextFormField(
|
|
controller: _model.textController1,
|
|
focusNode: _model.textFieldFocusNode1,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'9yu35pzg' /* Encerramento da Visita */,
|
|
),
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
validator: _model.textController1Validator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
0.0, 0.0, 0.0, 10.0),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
8.0, 0.0, 8.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController2,
|
|
focusNode: _model.textFieldFocusNode2,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'aj6scczp' /* Início */,
|
|
),
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
hintText: FFLocalizations.of(context).getText(
|
|
'ub084nhy' /* dd/mm/yyyy */,
|
|
),
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
validator: _model.textController2Validator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
8.0, 0.0, 8.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController3,
|
|
focusNode: _model.textFieldFocusNode3,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'rvi5z7wg' /* Término */,
|
|
),
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
hintText: FFLocalizations.of(context).getText(
|
|
'ixs67mrz' /* dd/mm/yyyy */,
|
|
),
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
validator: _model.textController3Validator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
0.0, 0.0, 0.0, 10.0),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
8.0, 0.0, 8.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController4,
|
|
focusNode: _model.textFieldFocusNode4,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'yxilg7ek' /* Motivo da Visita */,
|
|
),
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
hintText: FFLocalizations.of(context).getText(
|
|
'ypeydbem' /* Motivo */,
|
|
),
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
validator: _model.textController4Validator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
8.0, 0.0, 8.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController5,
|
|
focusNode: _model.textFieldFocusNode5,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'dgr3pk3a' /* Nível de Acesso */,
|
|
),
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
hintText: FFLocalizations.of(context).getText(
|
|
'rs3d4gb8' /* Nível de Acesso */,
|
|
),
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
validator: _model.textController5Validator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
decoration: const BoxDecoration(),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
8.0, 0.0, 8.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController6,
|
|
focusNode: _model.textFieldFocusNode6,
|
|
autofocus: false,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'lppn9rxa' /* Observações da Visita */,
|
|
),
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
validator: _model.textController6Validator
|
|
.asValidator(context),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Align(
|
|
alignment: const AlignmentDirectional(0.0, 1.0),
|
|
child: Padding(
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(0.0, 6.0, 0.0, 0.0),
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 35.0,
|
|
decoration: BoxDecoration(
|
|
color: widget.visitStatusColor,
|
|
borderRadius: const BorderRadius.only(
|
|
bottomLeft: Radius.circular(0.0),
|
|
bottomRight: Radius.circular(0.0),
|
|
topLeft: Radius.circular(0.0),
|
|
topRight: Radius.circular(0.0),
|
|
),
|
|
),
|
|
child: Builder(
|
|
builder: (context) {
|
|
if (widget.visitStatusStr == 'A') {
|
|
return Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
FlutterFlowIconButton(
|
|
borderRadius: 20.0,
|
|
borderWidth: 1.0,
|
|
buttonSize: 40.0,
|
|
icon: Icon(
|
|
Icons.block_sharp,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryBackground,
|
|
size: 24.0,
|
|
),
|
|
onPressed: () async {
|
|
_model.deleteVisit =
|
|
await PhpGroup.deleteVisitCall.call(
|
|
devUUID: FFAppState().devUUID,
|
|
userUUID: FFAppState().userUUID,
|
|
cliID: FFAppState().cliUUID,
|
|
atividade: 'cancelaVisita',
|
|
idVisita: widget.visitIdStr,
|
|
);
|
|
|
|
if (PhpGroup.deleteVisitCall.error(
|
|
(_model.deleteVisit?.jsonBody ?? ''),
|
|
) ==
|
|
false) {
|
|
Navigator.pop(context);
|
|
} else {
|
|
await showModalBottomSheet(
|
|
isScrollControlled: true,
|
|
backgroundColor: Colors.transparent,
|
|
enableDrag: false,
|
|
context: context,
|
|
builder: (context) {
|
|
return Padding(
|
|
padding:
|
|
MediaQuery.viewInsetsOf(context),
|
|
child: ThrowExceptionWidget(
|
|
msg: PhpGroup.deleteVisitCall.msg(
|
|
(_model.deleteVisit?.jsonBody ??
|
|
''),
|
|
)!,
|
|
),
|
|
);
|
|
},
|
|
).then((value) => safeSetState(() {}));
|
|
}
|
|
|
|
setState(() {});
|
|
},
|
|
),
|
|
FlutterFlowIconButton(
|
|
borderColor: Colors.transparent,
|
|
borderRadius: 20.0,
|
|
borderWidth: 1.0,
|
|
buttonSize: 40.0,
|
|
icon: Icon(
|
|
Icons.share,
|
|
color: FlutterFlowTheme.of(context)
|
|
.primaryBackground,
|
|
size: 24.0,
|
|
),
|
|
onPressed: () {
|
|
log('IconButton pressed ...');
|
|
// Implement share functionality here
|
|
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}.',
|
|
);
|
|
|
|
},
|
|
),
|
|
],
|
|
);
|
|
} else if ((widget.visitStatusStr == 'C') ||
|
|
(widget.visitStatusStr == 'F') ||
|
|
(widget.visitStatusStr == 'B') ||
|
|
(widget.visitStatusStr == 'I')) {
|
|
return InkWell(
|
|
splashColor: Colors.transparent,
|
|
focusColor: Colors.transparent,
|
|
hoverColor: Colors.transparent,
|
|
highlightColor: Colors.transparent,
|
|
onTap: () async {
|
|
Navigator.pop(context);
|
|
|
|
context.pushNamed(
|
|
'scheduleCompleteVisitPage',
|
|
queryParameters: {
|
|
'visitStartDateStr': serializeParam(
|
|
dateTimeFormat(
|
|
'd/M/y H:mm:ss',
|
|
getCurrentTimestamp,
|
|
locale: FFLocalizations.of(context)
|
|
.languageCode,
|
|
),
|
|
ParamType.String,
|
|
),
|
|
'visitEndDateStr': serializeParam(
|
|
'',
|
|
ParamType.String,
|
|
),
|
|
'visitReasonStr': serializeParam(
|
|
widget.visitReasonStr,
|
|
ParamType.String,
|
|
),
|
|
'visitLevelStr': serializeParam(
|
|
widget.visitLevelStr,
|
|
ParamType.String,
|
|
),
|
|
'visitTempBol': serializeParam(
|
|
widget.visitTempStr == 'Sim' ? true : false,
|
|
ParamType.bool,
|
|
),
|
|
'visitObsStr': serializeParam(
|
|
widget.visitObsStr,
|
|
ParamType.String,
|
|
),
|
|
'visitorStrList': serializeParam(
|
|
widget.visitorStrList,
|
|
ParamType.String,
|
|
),
|
|
'visitorJsonList': serializeParam(
|
|
filteredVisitorJsonList,
|
|
ParamType.JSON,
|
|
isList: true,
|
|
),
|
|
}.withoutNulls,
|
|
);
|
|
},
|
|
child: Icon(
|
|
Icons.repeat,
|
|
color: FlutterFlowTheme.of(context).secondaryText,
|
|
size: 24.0,
|
|
),
|
|
);
|
|
} else {
|
|
return Container(
|
|
width: 100.0,
|
|
height: 100.0,
|
|
decoration: BoxDecoration(
|
|
color: FlutterFlowTheme.of(context)
|
|
.secondaryBackground,
|
|
),
|
|
);
|
|
}
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|