589 lines
27 KiB
Dart
589 lines
27 KiB
Dart
import '/flutter_flow/flutter_flow_icon_button.dart';
|
|
import '/flutter_flow/flutter_flow_theme.dart';
|
|
import '/flutter_flow/flutter_flow_util.dart';
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'details_component_model.dart';
|
|
export 'details_component_model.dart';
|
|
|
|
class DetailsComponentWidget extends StatefulWidget {
|
|
const DetailsComponentWidget({
|
|
super.key,
|
|
required this.vteName,
|
|
required this.vteReason,
|
|
required this.vteMsg,
|
|
this.vteDocument,
|
|
this.cliUUID,
|
|
this.vteUUID,
|
|
this.vawName,
|
|
this.msgUUID,
|
|
this.vawRef,
|
|
this.vawUUID,
|
|
this.vawDestino,
|
|
required this.vawStatus,
|
|
this.vawDate,
|
|
});
|
|
|
|
final String? vteName;
|
|
final String? vteReason;
|
|
final String? vteMsg;
|
|
final String? vteDocument;
|
|
final String? cliUUID;
|
|
final String? vteUUID;
|
|
final String? vawName;
|
|
final String? msgUUID;
|
|
final String? vawRef;
|
|
final String? vawUUID;
|
|
final String? vawDestino;
|
|
final String? vawStatus;
|
|
final String? vawDate;
|
|
|
|
@override
|
|
State<DetailsComponentWidget> createState() => _DetailsComponentWidgetState();
|
|
}
|
|
|
|
class _DetailsComponentWidgetState extends State<DetailsComponentWidget> {
|
|
late DetailsComponentModel _model;
|
|
|
|
@override
|
|
void setState(VoidCallback callback) {
|
|
super.setState(callback);
|
|
_model.onUpdate();
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_model = createModel(context, () => DetailsComponentModel());
|
|
|
|
_model.textController1 ??= TextEditingController(text: widget.vteName);
|
|
_model.textFieldFocusNode1 ??= FocusNode();
|
|
|
|
_model.textController2 ??= TextEditingController(text: widget.vteReason);
|
|
_model.textFieldFocusNode2 ??= FocusNode();
|
|
|
|
_model.textController3 ??= TextEditingController(text: widget.vteMsg);
|
|
_model.textFieldFocusNode3 ??= FocusNode();
|
|
|
|
_model.textController4 ??= TextEditingController(text: widget.vawDate);
|
|
_model.textFieldFocusNode4 ??= FocusNode();
|
|
|
|
_model.textController5 ??= TextEditingController();
|
|
_model.textFieldFocusNode5 ??= FocusNode();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_model.maybeDispose();
|
|
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
context.watch<FFAppState>();
|
|
|
|
return Align(
|
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(10.0, 0.0, 10.0, 0.0),
|
|
child: Container(
|
|
width: MediaQuery.sizeOf(context).width * 0.9,
|
|
decoration: BoxDecoration(
|
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
borderRadius: const BorderRadius.only(
|
|
bottomLeft: Radius.circular(25.0),
|
|
bottomRight: Radius.circular(25.0),
|
|
topLeft: Radius.circular(25.0),
|
|
topRight: Radius.circular(25.0),
|
|
),
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Container(
|
|
width: 150.0,
|
|
height: 150.0,
|
|
clipBehavior: Clip.antiAlias,
|
|
decoration: const BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: CachedNetworkImage(
|
|
fadeInDuration: const Duration(milliseconds: 100),
|
|
fadeOutDuration: const Duration(milliseconds: 100),
|
|
imageUrl: valueOrDefault<String>(
|
|
'https://freaccess.com.br/freaccess/getImage.php?devUUID=${FFAppState().devUUID}&userUUID=${FFAppState().userUUID}&cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.vteDocument}&tipo=E',
|
|
'https://storage.googleapis.com/flutterflow-io-6f20.appspot.com/projects/flutter-freaccess-hub-0xgz9q/assets/7ftdetkzc3s0/360_F_64676383_LdbmhiNM6Ypzb3FM4PPuFP9rHe7ri8Ju.jpg',
|
|
),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
Container(
|
|
width: 153.0,
|
|
height: 25.0,
|
|
decoration: BoxDecoration(
|
|
color: () {
|
|
if (widget.vawStatus == 'L') {
|
|
return FlutterFlowTheme.of(context).primary;
|
|
} else if (widget.vawStatus == 'B') {
|
|
return FlutterFlowTheme.of(context).error;
|
|
} else if (widget.vawStatus == 'S') {
|
|
return FlutterFlowTheme.of(context).warning;
|
|
} else {
|
|
return FlutterFlowTheme.of(context).warning;
|
|
}
|
|
}(),
|
|
borderRadius: BorderRadius.circular(16.0),
|
|
),
|
|
child: Align(
|
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
|
child: Text(
|
|
() {
|
|
if (widget.vawStatus == 'L') {
|
|
return FFLocalizations.of(context)
|
|
.getVariableText(
|
|
ptText: 'Ativo',
|
|
enText: 'Active',
|
|
);
|
|
} else if (widget.vawStatus == 'B') {
|
|
return FFLocalizations.of(context)
|
|
.getVariableText(
|
|
ptText: 'Bloqueado',
|
|
enText: 'Blocked',
|
|
);
|
|
} else {
|
|
return FFLocalizations.of(context)
|
|
.getVariableText(
|
|
ptText: 'Pendente',
|
|
enText: 'Pending',
|
|
);
|
|
}
|
|
}(),
|
|
style: FlutterFlowTheme.of(context)
|
|
.bodyMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap()
|
|
.containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.bodyMediumFamily),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
].divide(const SizedBox(height: 5.0)),
|
|
),
|
|
]
|
|
.addToStart(const SizedBox(width: 10.0))
|
|
.addToEnd(const SizedBox(width: 10.0)),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController1,
|
|
focusNode: _model.textFieldFocusNode1,
|
|
autofocus: false,
|
|
textInputAction: TextInputAction.next,
|
|
readOnly: true,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'ivfw4j04' /* 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: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedErrorBorder: InputBorder.none,
|
|
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),
|
|
),
|
|
textAlign: TextAlign.start,
|
|
maxLines: null,
|
|
keyboardType: TextInputType.name,
|
|
validator:
|
|
_model.textController1Validator.asValidator(context),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController2,
|
|
focusNode: _model.textFieldFocusNode2,
|
|
autofocus: false,
|
|
textInputAction: TextInputAction.next,
|
|
readOnly: true,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'ndzkqehm' /* Motivo */,
|
|
),
|
|
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: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedErrorBorder: InputBorder.none,
|
|
suffixIcon: Icon(
|
|
Icons.history_edu,
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
),
|
|
textAlign: TextAlign.start,
|
|
maxLines: null,
|
|
keyboardType: TextInputType.name,
|
|
validator:
|
|
_model.textController2Validator.asValidator(context),
|
|
),
|
|
),
|
|
if (widget.vawStatus != 'S')
|
|
Padding(
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController3,
|
|
focusNode: _model.textFieldFocusNode3,
|
|
autofocus: false,
|
|
textCapitalization: TextCapitalization.none,
|
|
textInputAction: TextInputAction.next,
|
|
readOnly: true,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'kt87omsz' /* Mensagem */,
|
|
),
|
|
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: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedErrorBorder: InputBorder.none,
|
|
suffixIcon: Icon(
|
|
Icons.message,
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
),
|
|
textAlign: TextAlign.start,
|
|
validator:
|
|
_model.textController3Validator.asValidator(context),
|
|
),
|
|
),
|
|
if (widget.vawStatus != 'S')
|
|
Padding(
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(24.0, 0.0, 24.0, 0.0),
|
|
child: TextFormField(
|
|
controller: _model.textController4,
|
|
focusNode: _model.textFieldFocusNode4,
|
|
autofocus: false,
|
|
textCapitalization: TextCapitalization.none,
|
|
textInputAction: TextInputAction.next,
|
|
readOnly: true,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'yyni99pe' /* Data */,
|
|
),
|
|
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: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedErrorBorder: InputBorder.none,
|
|
suffixIcon: Icon(
|
|
Icons.date_range,
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
),
|
|
),
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily:
|
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
),
|
|
textAlign: TextAlign.start,
|
|
validator:
|
|
_model.textController4Validator.asValidator(context),
|
|
),
|
|
),
|
|
if (widget.vawStatus == 'S')
|
|
Padding(
|
|
padding:
|
|
const EdgeInsetsDirectional.fromSTEB(24.0, 20.0, 24.0, 20.0),
|
|
child: TextFormField(
|
|
controller: _model.textController5,
|
|
focusNode: _model.textFieldFocusNode5,
|
|
autofocus: false,
|
|
textInputAction: TextInputAction.next,
|
|
obscureText: false,
|
|
decoration: InputDecoration(
|
|
isDense: true,
|
|
labelText: FFLocalizations.of(context).getText(
|
|
'ssz899es' /* Pergunta */,
|
|
),
|
|
labelStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
hintStyle: FlutterFlowTheme.of(context)
|
|
.labelMedium
|
|
.override(
|
|
fontFamily: FlutterFlowTheme.of(context)
|
|
.labelMediumFamily,
|
|
color: FlutterFlowTheme.of(context).primaryText,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context)
|
|
.labelMediumFamily),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).accent1,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).primary,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(
|
|
color: FlutterFlowTheme.of(context).error,
|
|
width: 0.5,
|
|
),
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
),
|
|
suffixIcon: Icon(
|
|
Icons.question_answer,
|
|
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.textController5Validator.asValidator(context),
|
|
),
|
|
),
|
|
if (widget.vawStatus == 'S')
|
|
Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
FlutterFlowIconButton(
|
|
borderRadius: 20.0,
|
|
borderWidth: 1.0,
|
|
buttonSize: 40.0,
|
|
fillColor: FlutterFlowTheme.of(context).error,
|
|
icon: Icon(
|
|
Icons.close,
|
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
size: 24.0,
|
|
),
|
|
onPressed: () async {
|
|
var shouldSetState = false;
|
|
_model.blockVisitRequest =
|
|
await _model.visitRequestComponentAction(
|
|
context,
|
|
actionValue: 'B',
|
|
refUUID: widget.vawRef,
|
|
responseValue: _model.textController5.text,
|
|
vteUUID: widget.vteUUID,
|
|
);
|
|
shouldSetState = true;
|
|
if (_model.blockVisitRequest == true) {
|
|
Navigator.pop(context);
|
|
} else {
|
|
if (shouldSetState) setState(() {});
|
|
return;
|
|
}
|
|
|
|
if (shouldSetState) setState(() {});
|
|
},
|
|
),
|
|
FlutterFlowIconButton(
|
|
borderRadius: 20.0,
|
|
borderWidth: 1.0,
|
|
buttonSize: 40.0,
|
|
fillColor: FlutterFlowTheme.of(context).success,
|
|
icon: Icon(
|
|
Icons.done,
|
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
|
size: 24.0,
|
|
),
|
|
onPressed: () async {
|
|
var shouldSetState = false;
|
|
_model.approveVisitRequest =
|
|
await _model.visitRequestComponentAction(
|
|
context,
|
|
actionValue: 'L',
|
|
refUUID: widget.vawRef,
|
|
responseValue: _model.textController5.text,
|
|
vteUUID: widget.vteUUID,
|
|
);
|
|
shouldSetState = true;
|
|
if (_model.approveVisitRequest == true) {
|
|
Navigator.pop(context);
|
|
} else {
|
|
if (shouldSetState) setState(() {});
|
|
return;
|
|
}
|
|
|
|
if (shouldSetState) setState(() {});
|
|
},
|
|
),
|
|
].divide(const SizedBox(width: 20.0)),
|
|
),
|
|
]
|
|
.divide(const SizedBox(height: 10.0))
|
|
.addToStart(const SizedBox(height: 20.0))
|
|
.addToEnd(const SizedBox(height: 20.0)),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|