fix handtap qrcode for async setState

This commit is contained in:
jantunesmesias 2024-08-06 09:21:18 -03:00
parent 6f3b98ed69
commit 330d86c102
10 changed files with 1191 additions and 744 deletions

View File

@ -14,8 +14,10 @@ import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/api_requests/api_manager.dart'; import 'package:hub/backend/api_requests/api_manager.dart';
import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/access_notification_modal_template_component/access_notification_modal_template_component_widget.dart';
import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart'; import 'package:hub/components/templates_components/message_notificaion_modal_template_component/message_notification_widget.dart';
import 'package:hub/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart'; import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart'; import 'package:hub/flutter_flow/internationalization.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
@ -446,9 +448,20 @@ class NotificationHandler {
vteUUID: message['idVisitante'].toString(), vteUUID: message['idVisitante'].toString(),
vawRef: message['referencia'].toString(), vawRef: message['referencia'].toString(),
vawStatus: 'S', vawStatus: 'S',
buttons: [],
labelsHashMap: Map<String, String>.from({ labelsHashMap: Map<String, String>.from({
'key': message['documento'], FFLocalizations.of(context).getVariableText(
'value': 'E', enText: 'Visitor',
ptText: 'Visitante',
): message['nomevisita'],
FFLocalizations.of(context).getVariableText(
enText: 'Reason',
ptText: 'Motivo',
): message['motivo'],
FFLocalizations.of(context).getVariableText(
enText: 'Message',
ptText: 'Mensagem',
): message['mensagem'],
}), }),
imageHashMap: Map<String, String>.from({ imageHashMap: Map<String, String>.from({
'key': message['documento'], 'key': message['documento'],
@ -459,7 +472,7 @@ class NotificationHandler {
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
enText: 'Pending', enText: 'Pending',
ptText: 'Pendente', ptText: 'Pendente',
): FlutterFlowTheme.of(context).primary, ): FlutterFlowTheme.of(context).warning,
}, },
], ],
changeStatusAction: changeStatusAction, changeStatusAction: changeStatusAction,

View File

@ -0,0 +1,415 @@
import 'package:flutter/material.dart';
import 'package:hub/app_state.dart';
import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:rxdart/rxdart.dart';
import 'package:share_plus/share_plus.dart';
bool? getStatus(dynamic data) {
return data == 'A'
? true
: data == 'F' || data == 'B' || data == 'C' || data == 'I'
? false
: null;
}
Widget buildDetails(
dynamic visitaWrapItem,
BuildContext context,
Future<dynamic> Function(BuildContext, String, String, String, String)?
changeStatusAction) {
return VisitRequestTemplateComponentWidget(
vteName: 'Lorem Ipsus',
vteReason: 'Lorem Ipsus',
vawDate: 'Lorem Ipsus',
vawStatus: 'Lorem Ipsus',
vteMsg: 'Lorem Ipsus',
vteUUID: 'Lorem Ipsus',
cliUUID: FFAppState().cliUUID,
msgUUID: 'Lorem Ipsus',
vawDestino: 'Lorem Ipsus',
vawUUID: 'Lorem Ipsus',
vawName: 'Lorem Ipsus',
vawRef: 'Lorem Ipsus',
changeStatusAction: changeStatusAction,
buttons: [
if (getStatus(visitaWrapItem['VAW_STATUS']) == null) // ACCEPT ACTION
FlutterFlowIconButton(
icon: const Icon(Icons.done),
onPressed: () async {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Aprovar Visita',
enText: 'Approve Visit',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja aprovar essa visita?',
enText: 'Are you sure you want to approve this visit?',
),
),
backgroundColor:
FlutterFlowTheme.of(context).primaryBackground,
actions: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: 100,
height: 40,
color:
FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
onPressed: () async {
await changeStatusAction?.call(
context,
'L',
visitaWrapItem['VAW_REF'] ?? '',
'Mensagem',
visitaWrapItem['VTE_ID'] ?? '',
);
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
);
});
},
),
if (getStatus(visitaWrapItem['VAW_STATUS']) == null) // REJECT ACTION
FlutterFlowIconButton(
icon: const Icon(Icons.close),
onPressed: () async {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Bloquear Visita',
enText: 'Block Visit',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja bloquear essa visita?',
enText: 'Are you sure you want to block this visit?',
),
),
backgroundColor:
FlutterFlowTheme.of(context).primaryBackground,
actions: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: 100,
height: 40,
color:
FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
onPressed: () async {
// await changeStatusAction?.call(
// context,
// 'B',
// visitaWrapItem['VAW_REF'] ?? '',
// 'Mensagem',
// visitaWrapItem['VTE_ID'] ?? '',
// );
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
);
});
},
),
if (getStatus(visitaWrapItem['VAW_STATUS']) == false) // RECALL ACTION
FlutterFlowIconButton(
icon: const Icon(Icons.refresh),
onPressed: () async {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
FFLocalizations.of(context).getVariableText(
ptText: 'Bloquear Visita',
enText: 'Block Visit',
),
),
content: Text(
FFLocalizations.of(context).getVariableText(
ptText:
'Você tem certeza que deseja bloquear essa visita?',
enText: 'Are you sure you want to block this visit?',
),
),
backgroundColor:
FlutterFlowTheme.of(context).primaryBackground,
actions: [
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'No',
ptText: 'Não',
),
onPressed: () {
Navigator.pop(context);
},
options: FFButtonOptions(
width: 100,
height: 40,
color:
FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10)),
),
FFButtonWidget(
text: FFLocalizations.of(context).getVariableText(
enText: 'Yes',
ptText: 'Sim',
),
onPressed: () async {
// await changeStatusAction?.call(
// context,
// 'B',
// visitaWrapItem['VAW_REF'] ?? '',
// 'Mensagem',
// visitaWrapItem['VTE_ID'] ?? '',
// );
},
options: FFButtonOptions(
width: 100,
height: 40,
color: FlutterFlowTheme.of(context).primaryBackground,
textStyle: TextStyle(
color: FlutterFlowTheme.of(context).primaryText,
),
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context).primaryBackground,
width: 1,
),
borderRadius: BorderRadius.circular(10),
),
),
],
);
});
},
),
if (getStatus(visitaWrapItem['VAW_STATUS']) == false) // SHARE ACTION
FlutterFlowIconButton(
icon: const Icon(Icons.share),
onPressed: () async {
Share.share(r'''
Olá ${visitaWrapItem['VTE_NOME']}
Você foi convidado para ${visitaWrapItem['NAC_DESCRICAO']}
Validade do Convite:
visitaWrapItem['VAW_DTINICIO']
visitaWrapItem['VAW_DTFIM']
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
''');
},
),
// if (getStatus(visitaWrapItem['VAW_STATUS']) == null) // SEND ACTION
// FlutterFlowIconButton(
// icon: const Icon(Icons.send),
// onPressed: () async {
// showDialog(
// context: context,
// builder: (context) {
// return AlertDialog(
// title: Text(
// FFLocalizations.of(context).getVariableText(
// ptText: 'Bloquear Visita',
// enText: 'Block Visit',
// ),
// ),
// content: Text(
// FFLocalizations.of(context).getVariableText(
// ptText:
// 'Você tem certeza que deseja bloquear essa visita?',
// enText: 'Are you sure you want to block this visit?',
// ),
// ),
// backgroundColor:
// FlutterFlowTheme.of(context).primaryBackground,
// actions: [
// FFButtonWidget(
// text: FFLocalizations.of(context).getVariableText(
// enText: 'No',
// ptText: 'Não',
// ),
// onPressed: () {
// Navigator.pop(context);
// },
// options: FFButtonOptions(
// width: 100,
// height: 40,
// color:
// FlutterFlowTheme.of(context).primaryBackground,
// textStyle: TextStyle(
// color: FlutterFlowTheme.of(context).primaryText,
// ),
// borderSide: BorderSide(
// color: FlutterFlowTheme.of(context)
// .primaryBackground,
// width: 1,
// ),
// borderRadius: BorderRadius.circular(10)),
// ),
// FFButtonWidget(
// text: FFLocalizations.of(context).getVariableText(
// enText: 'Yes',
// ptText: 'Sim',
// ),
// onPressed: () async {
// // await changeStatusAction?.call(
// // context,
// // 'B',
// // visitaWrapItem['VAW_REF'] ?? '',
// // 'Mensagem',
// // visitaWrapItem['VTE_ID'] ?? '',
// // );
// },
// options: FFButtonOptions(
// width: 100,
// height: 40,
// color: FlutterFlowTheme.of(context).primaryBackground,
// textStyle: TextStyle(
// color: FlutterFlowTheme.of(context).primaryText,
// ),
// borderSide: BorderSide(
// color:
// FlutterFlowTheme.of(context).primaryBackground,
// width: 1,
// ),
// borderRadius: BorderRadius.circular(10),
// ),
// ),
// ],
// );
// });
// },
// ),
],
labelsHashMap: Map<String, String>.from({
'Nome': visitaWrapItem['VTE_NOME'] ?? '',
'Inicio': visitaWrapItem['VAW_DTINICIO'] ?? '',
'Fim': visitaWrapItem['VAW_DTFIM'] ?? '',
}),
imageHashMap: Map<String, String>.from({
'key': visitaWrapItem['VTE_DOCUMENTO'] ?? '',
'value': 'E',
}),
statusHashMap: [
getStatus(visitaWrapItem['VAW_STATUS']) == true
? Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Ativo',
enText: 'Active',
): FlutterFlowTheme.of(context).success,
})
: getStatus(visitaWrapItem['VAW_STATUS']) == null
? Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Pendente',
enText: 'Pending',
): FlutterFlowTheme.of(context).warning,
})
: Map<String, Color>.from({
FFLocalizations.of(context).getVariableText(
ptText: 'Cancelado',
enText: 'Canceled',
): FlutterFlowTheme.of(context).error,
}),
],
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
);
}

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hub/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart'; import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/flutter_flow_model.dart'; import 'package:hub/flutter_flow/flutter_flow_model.dart';
class VisitRequestTemplateComponentModel class VisitRequestTemplateComponentModel

View File

@ -0,0 +1,357 @@
import 'dart:collection';
import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/details_component/details_component_model.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:provider/provider.dart';
class VisitRequestTemplateComponentWidget extends StatefulWidget {
const VisitRequestTemplateComponentWidget({
Key? 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,
this.changeStatusAction,
required this.labelsHashMap,
required this.statusHashMap,
required this.imageHashMap,
this.onTapCardItemAction,
required this.buttons,
});
final Map<String, String> labelsHashMap;
final List<Map<String, Color>?> statusHashMap;
final Map<String, String> imageHashMap;
final Future Function()? onTapCardItemAction;
final List<Widget> buttons;
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;
final Future Function(
BuildContext context,
String status,
String vawREF,
String msg,
String vteUUID,
)? changeStatusAction;
@override
State<VisitRequestTemplateComponentWidget> createState() =>
_VisitRequestTemplateComponentWidgetState();
}
class _VisitRequestTemplateComponentWidgetState
extends State<VisitRequestTemplateComponentWidget> {
late VisitRequestTemplateComponentModel _model;
LinkedHashMap<String, String> get labelsLinkedHashMap =>
LinkedHashMap.from(widget.labelsHashMap ?? {});
List<LinkedHashMap<String, Color>> get statusLinkedHashMap =>
widget.statusHashMap
.map((map) => LinkedHashMap<String, Color>.from(map ?? {}))
.toList();
@override
void setState(VoidCallback callback) {
super.setState(callback);
_model.onUpdate();
}
@override
void initState() {
super.initState();
_model = createModel(context, () => VisitRequestTemplateComponentModel());
_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();
_model.textControllerStatus ??=
TextEditingController(text: widget.vawStatus);
_model.textFieldFocusNodeStatus ??= FocusNode();
}
@override
void dispose() {
_model.maybeDispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
log('VAW_STATUS: ${statusLinkedHashMap}');
context.watch<FFAppState>();
bool isLoaded = false;
final pending = FFLocalizations.of(context).getVariableText(
enText: 'Pending',
ptText: 'Pendente',
);
final active = FFLocalizations.of(context).getVariableText(
enText: 'Ativo',
ptText: 'Ativo',
);
final canceled = FFLocalizations.of(context).getVariableText(
enText: 'Canceled',
ptText: 'Cancelado',
);
return LayoutBuilder(
builder: (context, constraints) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
width: constraints.maxWidth,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.all(Radius.circular(25.0)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
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:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.imageHashMap['key']}&tipo=${widget.imageHashMap['value']}',
fit: BoxFit.cover,
),
),
Row(
children: statusLinkedHashMap.expand((linkedHashMap) {
return linkedHashMap.entries
.map((MapEntry<String, Color> item) {
return Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: TextFormField(
// controller: _model.textControllerStatus,
// focusNode: _model.textFieldFocusNodeStatus,
autofocus: false,
canRequestFocus: false,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: item.value,
),
),
filled: true,
fillColor: item.value,
labelText: item.key,
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.labelMediumFamily,
color: FlutterFlowTheme.of(context).info,
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).info,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(
FlutterFlowTheme.of(context)
.labelMediumFamily),
),
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.info,
color: FlutterFlowTheme.of(context).accent1,
),
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
color: FlutterFlowTheme.of(context).info,
letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap()
.containsKey(FlutterFlowTheme.of(context)
.bodyMediumFamily),
),
textAlign: TextAlign.start,
maxLines: null,
keyboardType: TextInputType.name,
validator: _model.textController1Validator
.asValidator(context),
),
),
);
}).toList();
}).toList(),
),
ListView.builder(
shrinkWrap: true,
itemCount: labelsLinkedHashMap.length,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
String key = labelsLinkedHashMap.keys.elementAt(index);
String value = labelsLinkedHashMap[key]!;
// return Text('key: $key, value: $value');
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10.0, vertical: 3.0),
child: TextFormField(
readOnly: true,
initialValue: '$value',
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,
),
),
decoration: InputDecoration(
labelText: key,
filled: true,
fillColor:
FlutterFlowTheme.of(context).primaryBackground,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
),
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(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.primaryBackground, // Change border color here
),
),
),
),
);
},
),
if (widget.buttons.isNotEmpty)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: widget.buttons,
),
),
]
.divide(const SizedBox(height: 20.0))
.addToEnd(const SizedBox(height: 20.0))
.addToStart(const SizedBox(height: 20.0)),
),
),
);
},
);
}
}

View File

@ -1,279 +0,0 @@
import 'dart:collection';
import 'dart:developer';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hub/components/templates_components/visit_request_template_component/visit_request_template_component_model.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
import 'package:hub/flutter_flow/flutter_flow_util.dart';
import 'package:hub/flutter_flow/internationalization.dart';
import 'package:provider/provider.dart';
class VisitRequestTemplateComponentWidget extends StatefulWidget {
const VisitRequestTemplateComponentWidget({
Key? 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,
this.changeStatusAction,
required this.labelsHashMap,
required this.statusHashMap,
required this.imageHashMap,
this.onTapCardItemAction,
});
final Map<String, String> labelsHashMap;
final List<Map<String, Color>?> statusHashMap;
final Map<String, String> imageHashMap;
final Future Function()? onTapCardItemAction;
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;
final Future Function(
BuildContext context,
String status,
String vawREF,
String msg,
String vteUUID,
)? changeStatusAction;
@override
State<VisitRequestTemplateComponentWidget> createState() =>
_VisitRequestTemplateComponentWidgetState();
}
class _VisitRequestTemplateComponentWidgetState
extends State<VisitRequestTemplateComponentWidget> {
late VisitRequestTemplateComponentModel _model;
LinkedHashMap<String, String> get labelsLinkedHashMap =>
LinkedHashMap.from(widget.labelsHashMap ?? {});
List<LinkedHashMap<String, Color>> get statusLinkedHashMap =>
widget.statusHashMap
.map((map) => LinkedHashMap<String, Color>.from(map ?? {}))
.toList();
@override
void setState(VoidCallback callback) {
super.setState(callback);
_model.onUpdate();
}
@override
void initState() {
super.initState();
_model = createModel(context, () => VisitRequestTemplateComponentModel());
_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();
_model.textControllerStatus ??=
TextEditingController(text: widget.vawStatus);
_model.textFieldFocusNodeStatus ??= FocusNode();
}
@override
void dispose() {
_model.maybeDispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
context.watch<FFAppState>();
bool isLoaded = false;
log('------------------ VisitRequestTemplateComponentWidget ------------------');
log('vteName: ${widget.imageHashMap}');
log('Teste: ${statusLinkedHashMap.expand((linkedHashMap) {
return [
linkedHashMap.entries
.map((MapEntry<String, Color> item) => item.key)
.first
];
}).first}');
log('-------------------------------------------------------------------------');
final pending = FFLocalizations.of(context).getVariableText(
enText: 'Pending',
ptText: 'Pendente',
);
final active = FFLocalizations.of(context).getVariableText(
enText: 'Ativo',
ptText: 'Ativo',
);
final canceled = FFLocalizations.of(context).getVariableText(
enText: 'Canceled',
ptText: 'Cancelado',
);
return LayoutBuilder(
builder: (context, constraints) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
width: constraints.maxWidth,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).primaryBackground,
borderRadius: const BorderRadius.all(Radius.circular(25.0)),
),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox(height: 20.0),
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:
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${widget.imageHashMap['key']}&tipo=${widget.imageHashMap['value']}',
fit: BoxFit.cover,
),
),
const SizedBox(height: 10.0),
Row(
children: statusLinkedHashMap.expand((linkedHashMap) {
return linkedHashMap.entries
.map((MapEntry<String, Color> item) {
return Expanded(
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 24.0),
child: TextFormField(
// controller: _model.textControllerStatus,
// focusNode: _model.textFieldFocusNodeStatus,
autofocus: false,
canRequestFocus: false,
readOnly: true,
obscureText: false,
decoration: InputDecoration(
isDense: true,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
),
filled: true,
fillColor: item.value,
labelText: item.key,
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),
),
focusedBorder: InputBorder.none,
errorBorder: InputBorder.none,
focusedErrorBorder: InputBorder.none,
suffixIcon: Icon(
Icons.info,
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),
),
),
);
}).toList();
}).toList(),
),
const SizedBox(height: 10.0),
// ListView.builder(
// shrinkWrap: true,
// itemCount: labelsLinkedHashMap.length,
// physics: const NeverScrollableScrollPhysics(),
// itemBuilder: (context, index) {
// String key = labelsLinkedHashMap.keys.elementAt(index);
// String value = labelsLinkedHashMap[key]!;
// return Text('key: $key, value: $value');
// },
// ),
const SizedBox(height: 20.0),
],
),
),
),
);
},
);
}
}

View File

@ -7,7 +7,7 @@ import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/backend/push_notification/pushNotificationService.dart'; import 'package:hub/backend/push_notification/pushNotificationService.dart';
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
import 'package:hub/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart'; import 'package:hub/components/templates_components/details_component/details_component_widget.dart';
import 'package:hub/flutter_flow/custom_functions.dart'; import 'package:hub/flutter_flow/custom_functions.dart';
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart';
@ -358,6 +358,7 @@ Widget liberationHistoryItemCard(
'Mensagem:': liberationHistoryItem['NOT_MSGENVIO'], 'Mensagem:': liberationHistoryItem['NOT_MSGENVIO'],
// 'Resposta:': liberationHistoryItem['NOT_MSGRESPOSTA'], // 'Resposta:': liberationHistoryItem['NOT_MSGRESPOSTA'],
}), }),
buttons: [],
statusHashMap: [ statusHashMap: [
liberationHistoryItem['NOT_STATUS'] == 'L' liberationHistoryItem['NOT_STATUS'] == 'L'
? Map<String, Color>.from({ ? Map<String, Color>.from({

View File

@ -5,7 +5,6 @@ import 'dart:developer';
import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:hub/app_state.dart'; import 'package:hub/app_state.dart';
import 'package:hub/backend/api_requests/api_calls.dart'; 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_icon_button.dart'; import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
import 'package:hub/flutter_flow/flutter_flow_theme.dart'; import 'package:hub/flutter_flow/flutter_flow_theme.dart';
@ -16,6 +15,7 @@ import 'package:hub/pages/message_history_page/message_history_page_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:hub/shared/utils/log_util.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class MessageHistoryPageWidget extends StatefulWidget { class MessageHistoryPageWidget extends StatefulWidget {
@ -31,6 +31,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
late MessageHistoryPageModel _model; late MessageHistoryPageModel _model;
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
int currentPage = 0;
int totalPage = 0;
@override @override
void initState() { void initState() {
@ -65,13 +67,13 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
return Scaffold( return Scaffold(
key: scaffoldKey, key: scaffoldKey,
backgroundColor: FlutterFlowTheme.of(context).primaryBackground, backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
appBar: appBarMessage(context), appBar: buildAppBar(context),
body: bodyMessage(context, _model), body: buildBody(context, _model),
); );
} }
} }
PreferredSizeWidget appBarMessage(BuildContext context) { PreferredSizeWidget buildAppBar(BuildContext context) {
return AppBar( return AppBar(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground, backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
@ -107,7 +109,7 @@ PreferredSizeWidget appBarMessage(BuildContext context) {
); );
} }
Widget bodyMessage(BuildContext context, MessageHistoryPageModel _model) { Widget buildBody(BuildContext context, MessageHistoryPageModel _model) {
return SafeArea( return SafeArea(
top: true, top: true,
child: Column( child: Column(
@ -157,16 +159,16 @@ Widget bodyMessage(BuildContext context, MessageHistoryPageModel _model) {
), ),
Expanded( Expanded(
child: TabBarView(controller: _model.tabBarController, children: [ child: TabBarView(controller: _model.tabBarController, children: [
liberationDynamicListView(context, _model, 'P'), buildListView(context, _model, 'P'),
liberationDynamicListView(context, _model, 'A'), buildListView(context, _model, 'A'),
liberationDynamicListView(context, _model, 'T'), buildListView(context, _model, 'T'),
])), ])),
].addToStart(const SizedBox(height: 0)), ].addToStart(const SizedBox(height: 0)),
), ),
); );
} }
Widget liberationDynamicListView( Widget buildListView(
BuildContext context, MessageHistoryPageModel _model, String DestIndex) { BuildContext context, MessageHistoryPageModel _model, String DestIndex) {
return Container( return Container(
width: double.infinity, width: double.infinity,
@ -174,19 +176,29 @@ Widget liberationDynamicListView(
decoration: const BoxDecoration(), decoration: const BoxDecoration(),
child: FutureBuilder<dynamic>( child: FutureBuilder<dynamic>(
future: Future(() async { future: Future(() async {
var body = {
'devUUID': FFAppState().devUUID.toString(),
'userUUID': FFAppState().userUUID.toString(),
'cliID': FFAppState().cliUUID.toString(),
'atividade': 'getMensagens',
'pageSize': '100',
'pageNumber': '1',
'tipoDestino': DestIndex.toString(),
};
try { try {
var response = await PhpGroup.getMessagesCall.call( var response = await PhpGroup.getMessagesCall.call(
devUUID: FFAppState().devUUID.toString(), devUUID: body['devUUID'],
userUUID: FFAppState().userUUID.toString(), userUUID: body['userUUID'],
cliID: FFAppState().cliUUID.toString(), cliID: body['cliID'],
atividade: 'getMensagens', atividade: body['atividade'],
pageSize: '100', pageSize: body['pageSize'],
pageNumber: '1', pageNumber: body['pageNumber'],
tipoDestino: DestIndex, tipoDestino: DestIndex,
); );
return response.jsonBody; return response.jsonBody;
} catch (error) { } catch (error, stack) {
log('Error: ${error.toString()}'); LogUtil.requestAPIFailed('processRequest.php', jsonEncode(body),
'Mensagens não Encontradas', error, stack);
return {'mensagens': [], 'total_rows': 0}; return {'mensagens': [], 'total_rows': 0};
} }
}), }),
@ -226,7 +238,7 @@ Widget liberationDynamicListView(
addRepaintBoundaries: true, addRepaintBoundaries: true,
cacheExtent: 1000.0, cacheExtent: 1000.0,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return messageHistoryItem( return buildListItem(
context, context,
snapshot.data!['mensagens'][index], snapshot.data!['mensagens'][index],
); );
@ -237,7 +249,7 @@ Widget liberationDynamicListView(
); );
} }
Widget messageHistoryItem(BuildContext context, dynamic jsonBody) { Widget buildListItem(BuildContext context, dynamic jsonBody) {
log(jsonBody.toString()); log(jsonBody.toString());
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 15), padding: const EdgeInsets.symmetric(horizontal: 15),
@ -329,24 +341,6 @@ Widget messageHistoryItem(BuildContext context, dynamic jsonBody) {
].divide(const SizedBox(height: 4)), ].divide(const SizedBox(height: 4)),
), ),
), ),
// Row(
// children: [
// Icon(
// Icons.message,
// color: FlutterFlowTheme.of(context).customColor6,
// size: 15,
// ),
// Expanded(
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Text(
// jsonBody['MSG_TEXTO'].toString(),
// ),
// ),
// ),
// ]
// .addToStart(const SizedBox(width: 8))
// .addToEnd(const SizedBox(width: 8))),
].divide( ].divide(
const SizedBox(height: 8), const SizedBox(height: 8),
), ),

View File

@ -91,7 +91,7 @@ class PreferencesPageModel with ChangeNotifier {
Share.share( Share.share(
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
ptText: ptText:
'Este é o meu identificador de acesse: ${FFAppState().userDevUUID}', 'Este é o meu identificador de acesso: ${FFAppState().userDevUUID}',
enText: 'This is my access identifier: ${FFAppState().userDevUUID}', enText: 'This is my access identifier: ${FFAppState().userDevUUID}',
), ),
); );

View File

@ -16,7 +16,6 @@ import 'package:hub/flutter_flow/nav/nav.dart';
import 'package:hub/pages/qr_code_page/qr_code_page_model.dart'; import 'package:hub/pages/qr_code_page/qr_code_page_model.dart';
import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:percent_indicator/circular_percent_indicator.dart';
import 'dart:async'; import 'dart:async';
// import 'package:barcode_widget/barcode_widget.dart'; // import 'package:barcode_widget/barcode_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -27,30 +26,23 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
class QrCodePageWidget extends StatefulWidget { class QrCodePageWidget extends StatefulWidget {
const QrCodePageWidget({super.key}); const QrCodePageWidget({super.key});
@override @override
State<QrCodePageWidget> createState() => _QrCodePageWidgetState(); State<QrCodePageWidget> createState() => _QrCodePageWidgetState();
} }
class _QrCodePageWidgetState extends State<QrCodePageWidget> class _QrCodePageWidgetState extends State<QrCodePageWidget>
with TickerProviderStateMixin { with TickerProviderStateMixin {
late QrCodePageModel _model; late QrCodePageModel _model;
final scaffoldKey = GlobalKey<ScaffoldState>(); final scaffoldKey = GlobalKey<ScaffoldState>();
final animationsMap = <String, AnimationInfo>{}; final animationsMap = <String, AnimationInfo>{};
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_model = createModel(context, () => QrCodePageModel()); _model = createModel(context, () => QrCodePageModel());
@ -91,17 +83,19 @@ void initState() {
// animationsMap['barcodeOnActionTriggerAnimation']!.controller.forward(); // animationsMap['barcodeOnActionTriggerAnimation']!.controller.forward();
// } // }
// }); // });
} }
@override @override
void dispose() { void dispose() {
// Removendo o ouvinte antes de chamar super.dispose para evitar vazamentos de memória // Removendo o ouvinte antes de chamar super.dispose para evitar vazamentos de memória
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
animationsMap['barcodeOnActionTriggerAnimation']!.controller.removeStatusListener((status) {}); animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.removeStatusListener((status) {});
} }
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -116,7 +110,8 @@ void dispose() {
Widget buildBody(BuildContext context) { Widget buildBody(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width; double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height; double screenHeight = MediaQuery.of(context).size.height;
double smallerDimension = screenWidth < screenHeight ? screenWidth : screenHeight; double smallerDimension =
screenWidth < screenHeight ? screenWidth : screenHeight;
double dimension = smallerDimension * 0.75; double dimension = smallerDimension * 0.75;
double totalTimeInSeconds = 100.0; double totalTimeInSeconds = 100.0;
return SafeArea( return SafeArea(
@ -132,8 +127,7 @@ void dispose() {
enText: 'Use this QR Code for access', enText: 'Use this QR Code for access',
), ),
style: FlutterFlowTheme.of(context).bodyMedium.override( style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
FlutterFlowTheme.of(context).bodyMediumFamily,
fontSize: 20.0, fontSize: 20.0,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -147,13 +141,13 @@ void dispose() {
Align( Align(
alignment: const AlignmentDirectional(0.0, 0.0), alignment: const AlignmentDirectional(0.0, 0.0),
child: InkWell( child: InkWell(
onTap: () { onTap: () async {
safeSetState(() async { safeSetState(() async {
_resetAnimationAndToggleAccess(); _resetAnimationAndToggleAccess();
FFAppState().fingerprint ? await _showBiometricsAuth(context) : await _showQrCodeBottomSheet(context);
}); });
FFAppState().fingerprint
? await _showBiometricsAuth(context)
: await _showQrCodeBottomSheet(context);
}, },
child: buildQrCode( child: buildQrCode(
dimension: dimension, dimension: dimension,
@ -164,7 +158,7 @@ void dispose() {
), ),
), ),
), ),
if(_model.isAccess == false && _model.key == null) if (_model.isAccess == false && _model.key == null)
Align( Align(
alignment: const AlignmentDirectional(0, 0), alignment: const AlignmentDirectional(0, 0),
child: BarcodeWidget( child: BarcodeWidget(
@ -206,7 +200,9 @@ void dispose() {
alignment: const AlignmentDirectional(0.0, 0.0), alignment: const AlignmentDirectional(0.0, 0.0),
child: FFButtonWidget( child: FFButtonWidget(
onPressed: () async { onPressed: () async {
FFAppState().fingerprint ? await _showBiometricsAuth(context) : await _showQrCodeBottomSheet(context); FFAppState().fingerprint
? await _showBiometricsAuth(context)
: await _showQrCodeBottomSheet(context);
}, },
text: FFLocalizations.of(context).getVariableText( text: FFLocalizations.of(context).getVariableText(
ptText: 'Gerar QR Code', ptText: 'Gerar QR Code',
@ -227,8 +223,7 @@ void dispose() {
color: Colors.white, color: Colors.white,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap()
.containsKey( .containsKey(FlutterFlowTheme.of(context)
FlutterFlowTheme.of(context)
.titleSmallFamily), .titleSmallFamily),
), ),
elevation: 3.0, elevation: 3.0,
@ -253,7 +248,8 @@ void dispose() {
visible: _model.isAccess == true, visible: _model.isAccess == true,
child: Text( child: Text(
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
ptText: 'Certifique-se de que o QRCode está visivel para o leitor', ptText:
'Certifique-se de que o QRCode está visivel para o leitor',
enText: 'Make sure the QRCode is visible to the reader', enText: 'Make sure the QRCode is visible to the reader',
// '6z6kvmhl' /* Certifique-se de que o QRCode ... */, // '6z6kvmhl' /* Certifique-se de que o QRCode ... */,
), ),
@ -291,15 +287,13 @@ void dispose() {
// 'wkjkxd2e' /* Trocando QR code em */, // 'wkjkxd2e' /* Trocando QR code em */,
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: FlutterFlowTheme.of(context) style: FlutterFlowTheme.of(context).bodyMedium.override(
.bodyMedium fontFamily:
.override( FlutterFlowTheme.of(context).bodyMediumFamily,
fontFamily: FlutterFlowTheme.of(context)
.bodyMediumFamily,
letterSpacing: 0.0, letterSpacing: 0.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
useGoogleFonts: GoogleFonts.asMap() useGoogleFonts: GoogleFonts.asMap().containsKey(
.containsKey(FlutterFlowTheme.of(context) FlutterFlowTheme.of(context)
.bodyMediumFamily), .bodyMediumFamily),
), ),
), ),
@ -313,7 +307,8 @@ void dispose() {
child: StreamBuilder<double>( child: StreamBuilder<double>(
stream: getProgressValue(), stream: getProgressValue(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState ==
ConnectionState.waiting) {
return CircularProgressIndicator(); return CircularProgressIndicator();
} else if (snapshot.hasError) { } else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}');
@ -332,16 +327,23 @@ void dispose() {
onAnimationEnd: () { onAnimationEnd: () {
_resetAnimationAndToggleAccess(); _resetAnimationAndToggleAccess();
}, },
progressColor: FlutterFlowTheme.of(context).primary, progressColor:
backgroundColor: FlutterFlowTheme.of(context).primaryText, FlutterFlowTheme.of(context).primary,
backgroundColor:
FlutterFlowTheme.of(context).primaryText,
center: Text( center: Text(
'${(progress * totalTimeInSeconds / 5).toStringAsFixed(1)}s', '${(progress * totalTimeInSeconds / 5).toStringAsFixed(1)}s',
style: FlutterFlowTheme.of(context).headlineSmall.override( style: FlutterFlowTheme.of(context)
fontFamily: FlutterFlowTheme.of(context).headlineSmallFamily, .headlineSmall
.override(
fontFamily: FlutterFlowTheme.of(context)
.headlineSmallFamily,
fontSize: 14.0, fontSize: 14.0,
letterSpacing: 0.0, letterSpacing: 0.0,
useGoogleFonts: GoogleFonts.asMap().containsKey( useGoogleFonts: GoogleFonts.asMap()
FlutterFlowTheme.of(context).headlineSmallFamily), .containsKey(
FlutterFlowTheme.of(context)
.headlineSmallFamily),
), ),
), ),
startAngle: 20.0, startAngle: 20.0,
@ -359,25 +361,26 @@ void dispose() {
); );
} }
Future<void> _showBiometricsAuth(BuildContext context) async { Future<void> _showBiometricsAuth(BuildContext context) async {
FFAppState().checkBiometrics() FFAppState()
.then((value) => FFAppState().authenticateBiometric() .checkBiometrics()
.then( (value) { .then((value) => FFAppState().authenticateBiometric().then((value) {
safeSetState(() { safeSetState(() {
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); animationsMap['barcodeOnActionTriggerAnimation']!
animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); .controller
.stop();
animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.reverse();
} }
_model.isAccess = !_model.isAccess; _model.isAccess = !_model.isAccess;
_model.key = FFAppState().fingerprintPass; _model.key = FFAppState().fingerprintPass;
}); });
} )) }))
.onError((error, StackTrace) { .onError((error, StackTrace) {
_showQrCodeBottomSheet(context); _showQrCodeBottomSheet(context);
}); });
} }
Future<void> _showQrCodeBottomSheet(BuildContext context) async { Future<void> _showQrCodeBottomSheet(BuildContext context) async {
@ -388,22 +391,23 @@ void dispose() {
context: context, context: context,
builder: (context) { builder: (context) {
return GestureDetector( return GestureDetector(
onTap: () => _model onTap: () => _model.unfocusNode.canRequestFocus
.unfocusNode.canRequestFocus ? FocusScope.of(context).requestFocus(_model.unfocusNode)
? FocusScope.of(context)
.requestFocus(_model.unfocusNode)
: FocusScope.of(context).unfocus(), : FocusScope.of(context).unfocus(),
child: Padding( child: Padding(
padding: padding: MediaQuery.viewInsetsOf(context),
MediaQuery.viewInsetsOf(context), child: QrCodePassKeyTemplateComponentWidget(
child:
QrCodePassKeyTemplateComponentWidget(
toggleActionStatus: (key) async { toggleActionStatus: (key) async {
log('Key: $key'); log('Key: $key');
safeSetState(() { safeSetState(() {
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) { if (animationsMap['barcodeOnActionTriggerAnimation'] !=
animationsMap['barcodeOnActionTriggerAnimation']!.controller.stop(); null) {
animationsMap['barcodeOnActionTriggerAnimation']!.controller.reverse(); animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.stop();
animationsMap['barcodeOnActionTriggerAnimation']!
.controller
.reverse();
} }
_model.isAccess = !_model.isAccess; _model.isAccess = !_model.isAccess;
_model.key = key; _model.key = key;
@ -413,9 +417,7 @@ void dispose() {
), ),
); );
}, },
) ).catchError((error) => safeSetState(() {
.catchError((error) => safeSetState((){
log('Error: $error'); log('Error: $error');
_resetAnimationAndToggleAccess(); _resetAnimationAndToggleAccess();
})); }));
@ -439,7 +441,7 @@ void dispose() {
_model.isAccess = !_model.isAccess; _model.isAccess = !_model.isAccess;
_model.key = null; _model.key = null;
}); });
} }
AppBar buildAppBar(BuildContext context) { AppBar buildAppBar(BuildContext context) {
return AppBar( return AppBar(

View File

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -9,9 +7,8 @@ import 'package:google_fonts/google_fonts.dart';
import 'package:hub/actions/actions.dart'; import 'package:hub/actions/actions.dart';
import 'package:hub/backend/api_requests/api_calls.dart'; import 'package:hub/backend/api_requests/api_calls.dart';
import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart'; import 'package:hub/components/templates_components/card_item_template_component/card_item_template_component_widget.dart';
import 'package:hub/components/templates_components/details_component/details_component_action.dart';
import 'package:hub/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/visit_details_modal_template_component/visit_details_modal_template_component_widget.dart';
import 'package:hub/components/templates_components/visit_request_template_component/visit_request_template_component_widget.dart';
import 'package:hub/components/templates_components/visitor_details_modal_template_component/visitor_details_modal_template_component_widget.dart';
import 'package:hub/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart'; import 'package:hub/components/templates_components/visitor_search_modal_template_component/visitor_search_modal_template_component_widget.dart';
import 'package:hub/flutter_flow/custom_functions.dart'; import 'package:hub/flutter_flow/custom_functions.dart';
import 'package:hub/flutter_flow/flutter_flow_drop_down.dart'; import 'package:hub/flutter_flow/flutter_flow_drop_down.dart';
@ -163,6 +160,14 @@ class _ScheduleCompleteVisitPageWidgetState
} }
} }
bool? getStatus(dynamic data) {
return data == 'A'
? true
: data == 'F' || data == 'B' || data == 'C' || data == 'I'
? null
: false;
}
PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) { PreferredSizeWidget appBarScheduleCompleteVisit(BuildContext context) {
return AppBar( return AppBar(
backgroundColor: FlutterFlowTheme.of(context).primaryBackground, backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
@ -1734,17 +1739,14 @@ Widget visitHistory(
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '', 'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
}), }),
statusHashMap: [ statusHashMap: [
visitaWrapItem['VAW_STATUS'] == 'A' getStatus(visitaWrapItem['VAW_STATUS']) == true
? Map<String, Color>.from({ ? Map<String, Color>.from({
FFLocalizations.of(context).getVariableText( FFLocalizations.of(context).getVariableText(
ptText: 'Ativo', ptText: 'Ativo',
enText: 'Active', enText: 'Active',
): FlutterFlowTheme.of(context).success, ): FlutterFlowTheme.of(context).success,
}) })
: visitaWrapItem['VAW_STATUS'] == 'F' || : getStatus(visitaWrapItem['VAW_STATUS']) == null
visitaWrapItem['VAW_STATUS'] == 'B' ||
visitaWrapItem['VAW_STATUS'] == 'C' ||
visitaWrapItem['VAW_STATUS'] == 'I'
? Map<String, Color>.from({ ? Map<String, Color>.from({
FFLocalizations.of(context) FFLocalizations.of(context)
.getVariableText( .getVariableText(
@ -1768,71 +1770,15 @@ Widget visitHistory(
useSafeArea: true, useSafeArea: true,
context: context, context: context,
builder: (context) { builder: (context) {
return VisitRequestTemplateComponentWidget( return buildDetails(
vteName: 'Lorem Ipsus', visitaWrapItem,
vteReason: 'Lorem Ipsus', context,
vawDate: 'Lorem Ipsus', changeStatusAction,
vawStatus: 'Lorem Ipsus',
vteMsg: 'Lorem Ipsus',
vteUUID: 'Lorem Ipsus',
cliUUID: FFAppState().cliUUID,
msgUUID: 'Lorem Ipsus',
vawDestino: 'Lorem Ipsus',
vawUUID: 'Lorem Ipsus',
vawName: 'Lorem Ipsus',
vawRef: 'Lorem Ipsus',
labelsHashMap: Map<String, String>.from({
'Nome:': visitaWrapItem['VTE_NOME'] ?? '',
'Inicio:':
visitaWrapItem['VAW_DTINICIO'] ?? '',
'Fim:': visitaWrapItem['VAW_DTFIM'] ?? '',
}),
imageHashMap: Map<String, String>.from({
'key': visitaWrapItem['VTE_DOCUMENTO'] ?? '',
'value': 'E',
}),
statusHashMap: [
visitaWrapItem['VAW_STATUS'] == 'A'
? Map<String, Color>.from({
FFLocalizations.of(context)
.getVariableText(
ptText: 'Ativo',
enText: 'Active',
): FlutterFlowTheme.of(context)
.success,
})
: visitaWrapItem['VAW_STATUS'] == 'F' ||
visitaWrapItem['VAW_STATUS'] ==
'B' ||
visitaWrapItem['VAW_STATUS'] ==
'C' ||
visitaWrapItem['VAW_STATUS'] ==
'I'
? Map<String, Color>.from({
FFLocalizations.of(context)
.getVariableText(
ptText: 'Pendente',
enText: 'Pending',
): FlutterFlowTheme.of(context)
.warning,
})
: Map<String, Color>.from({
FFLocalizations.of(context)
.getVariableText(
ptText: 'Cancelado',
enText: 'Canceled',
): FlutterFlowTheme.of(context)
.error,
}),
],
changeStatusAction: changeStatusAction,
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
); );
}, },
).then((_) { ).then((_) {
// PushNotificationManager _pushNotificationService = // PushNotificationManager _pushNotificationService =
// PushNotificationManager(); // PushNotificationManager();
// _pushNotificationService.onMessageReceived // _pushNotificationService.onMessageReceived
// .listen((received) { // .listen((received) {
// if (received.data['click_action'] == // if (received.data['click_action'] ==
@ -1853,7 +1799,6 @@ Widget visitHistory(
// } // }
// }); // });
}); });
// await showModalBottomSheet( // await showModalBottomSheet(
// isScrollControlled: true, // isScrollControlled: true,
// backgroundColor: Colors.transparent, // backgroundColor: Colors.transparent,