fix handtap qrcode for async setState
This commit is contained in:
parent
6f3b98ed69
commit
330d86c102
|
@ -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,
|
||||||
|
|
|
@ -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'],
|
||||||
|
);
|
||||||
|
}
|
|
@ -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
|
|
@ -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)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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({
|
||||||
|
|
|
@ -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),
|
||||||
),
|
),
|
||||||
|
|
|
@ -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}',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -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,81 +26,76 @@ 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());
|
||||||
|
|
||||||
// On page load action.
|
// On page load action.
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
SchedulerBinding.instance.addPostFrameCallback((_) async {
|
||||||
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
|
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
|
||||||
animationsMap['barcodeOnActionTriggerAnimation']!.controller.fling();
|
animationsMap['barcodeOnActionTriggerAnimation']!.controller.fling();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
animationsMap.addAll({
|
animationsMap.addAll({
|
||||||
'barcodeOnActionTriggerAnimation': AnimationInfo(
|
'barcodeOnActionTriggerAnimation': AnimationInfo(
|
||||||
trigger: AnimationTrigger.onActionTrigger,
|
trigger: AnimationTrigger.onActionTrigger,
|
||||||
applyInitialState: true,
|
applyInitialState: true,
|
||||||
effectsBuilder: () => [
|
effectsBuilder: () => [
|
||||||
VisibilityEffect(duration: 1.ms),
|
VisibilityEffect(duration: 1.ms),
|
||||||
BlurEffect(
|
BlurEffect(
|
||||||
curve: Curves.linear,
|
curve: Curves.linear,
|
||||||
delay: 0.0.ms,
|
delay: 0.0.ms,
|
||||||
duration: 600.0.ms,
|
duration: 600.0.ms,
|
||||||
begin: const Offset(0.0, 0.0),
|
begin: const Offset(0.0, 0.0),
|
||||||
end: const Offset(10.0, 10.0),
|
end: const Offset(10.0, 10.0),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
setupAnimations(
|
setupAnimations(
|
||||||
animationsMap.values.where((anim) =>
|
animationsMap.values.where((anim) =>
|
||||||
anim.trigger == AnimationTrigger.onActionTrigger ||
|
anim.trigger == AnimationTrigger.onActionTrigger ||
|
||||||
!anim.applyInitialState),
|
!anim.applyInitialState),
|
||||||
this,
|
this,
|
||||||
);
|
);
|
||||||
|
|
||||||
// // Adicionando um ouvinte de status à animação para reiniciá-la após a conclusão
|
// // Adicionando um ouvinte de status à animação para reiniciá-la após a conclusão
|
||||||
// animationsMap['barcodeOnActionTriggerAnimation']?.controller.addStatusListener((status) {
|
// animationsMap['barcodeOnActionTriggerAnimation']?.controller.addStatusListener((status) {
|
||||||
// if (status == AnimationStatus.completed) {
|
// if (status == AnimationStatus.completed) {
|
||||||
// animationsMap['barcodeOnActionTriggerAnimation']!.controller.reset();
|
// animationsMap['barcodeOnActionTriggerAnimation']!.controller.reset();
|
||||||
// animationsMap['barcodeOnActionTriggerAnimation']!.controller.forward();
|
// animationsMap['barcodeOnActionTriggerAnimation']!.controller.forward();
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
// Removendo o ouvinte antes de chamar super.dispose para evitar vazamentos de memória
|
|
||||||
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
|
|
||||||
animationsMap['barcodeOnActionTriggerAnimation']!.controller.removeStatusListener((status) {});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.dispose();
|
@override
|
||||||
}
|
void dispose() {
|
||||||
|
// Removendo o ouvinte antes de chamar super.dispose para evitar vazamentos de memória
|
||||||
|
if (animationsMap['barcodeOnActionTriggerAnimation'] != null) {
|
||||||
|
animationsMap['barcodeOnActionTriggerAnimation']!
|
||||||
|
.controller
|
||||||
|
.removeStatusListener((status) {});
|
||||||
|
}
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -114,46 +108,46 @@ 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 =
|
||||||
double dimension = smallerDimension * 0.75;
|
screenWidth < screenHeight ? screenWidth : screenHeight;
|
||||||
|
double dimension = smallerDimension * 0.75;
|
||||||
double totalTimeInSeconds = 100.0;
|
double totalTimeInSeconds = 100.0;
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
// top: true,
|
// top: true,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
if (_model.isAccess == true && _model.key != null)
|
if (_model.isAccess == true && _model.key != null)
|
||||||
Text(
|
Text(
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Use esse QR Code para acesso',
|
ptText: 'Use esse QR Code para acesso',
|
||||||
enText: 'Use this QR Code for access',
|
enText: 'Use this QR Code for access',
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
fontSize: 20.0,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Stack(
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
children: [
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
if (_model.isAccess == true && _model.key != null)
|
fontSize: 20.0,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Stack(
|
||||||
|
children: [
|
||||||
|
if (_model.isAccess == true && _model.key != null)
|
||||||
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,260 +158,268 @@ 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(
|
||||||
data: 'Barcode',
|
data: 'Barcode',
|
||||||
barcode: Barcode.qrCode(),
|
barcode: Barcode.qrCode(),
|
||||||
|
width: 300.0,
|
||||||
|
height: 200.0,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
errorBuilder: (context, error) => const SizedBox(
|
||||||
width: 300.0,
|
width: 300.0,
|
||||||
height: 200.0,
|
height: 200.0,
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
errorBuilder: (context, error) => const SizedBox(
|
|
||||||
width: 300.0,
|
|
||||||
height: 200.0,
|
|
||||||
),
|
|
||||||
drawText: false,
|
|
||||||
).animateOnActionTrigger(
|
|
||||||
animationsMap['barcodeOnActionTriggerAnimation']!,
|
|
||||||
),
|
),
|
||||||
|
drawText: false,
|
||||||
|
).animateOnActionTrigger(
|
||||||
|
animationsMap['barcodeOnActionTriggerAnimation']!,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (_model.isAccess == false && _model.key == null)
|
if (_model.isAccess == false && _model.key == null)
|
||||||
Align(
|
Align(
|
||||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
focusColor: Colors.transparent,
|
focusColor: Colors.transparent,
|
||||||
hoverColor: Colors.transparent,
|
hoverColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
onLongPress: () async {
|
onLongPress: () async {
|
||||||
await _model.qrCodeEncoder(
|
await _model.qrCodeEncoder(
|
||||||
context,
|
context,
|
||||||
key: _model.key,
|
key: _model.key,
|
||||||
);
|
);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 200.0,
|
width: 200.0,
|
||||||
height: 200.0,
|
height: 200.0,
|
||||||
decoration: const BoxDecoration(),
|
decoration: const BoxDecoration(),
|
||||||
child: Align(
|
child: Align(
|
||||||
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)
|
||||||
text: FFLocalizations.of(context).getVariableText(
|
: await _showQrCodeBottomSheet(context);
|
||||||
ptText: 'Gerar QR Code',
|
},
|
||||||
enText: 'Generate QR Code',
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
),
|
ptText: 'Gerar QR Code',
|
||||||
options: FFButtonOptions(
|
enText: 'Generate QR Code',
|
||||||
height: 40.0,
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
||||||
24.0, 0.0, 24.0, 0.0),
|
|
||||||
iconPadding: const EdgeInsetsDirectional.fromSTEB(
|
|
||||||
0.0, 0.0, 0.0, 0.0),
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
|
||||||
textStyle: FlutterFlowTheme.of(context)
|
|
||||||
.titleSmall
|
|
||||||
.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context)
|
|
||||||
.titleSmallFamily,
|
|
||||||
color: Colors.white,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
|
||||||
.containsKey(
|
|
||||||
FlutterFlowTheme.of(context)
|
|
||||||
.titleSmallFamily),
|
|
||||||
),
|
|
||||||
elevation: 3.0,
|
|
||||||
borderSide: const BorderSide(
|
|
||||||
color: Colors.transparent,
|
|
||||||
width: 1.0,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
options: FFButtonOptions(
|
||||||
),
|
height: 40.0,
|
||||||
),
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
),
|
24.0, 0.0, 24.0, 0.0),
|
||||||
],
|
iconPadding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
),
|
0.0, 0.0, 0.0, 0.0),
|
||||||
if (_model.isAccess == true && _model.key != null)
|
color: FlutterFlowTheme.of(context).primary,
|
||||||
Container(
|
textStyle: FlutterFlowTheme.of(context)
|
||||||
width: 300.0,
|
.titleSmall
|
||||||
decoration: const BoxDecoration(),
|
.override(
|
||||||
child: Visibility(
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
visible: _model.isAccess == true,
|
.titleSmallFamily,
|
||||||
child: Text(
|
color: Colors.white,
|
||||||
FFLocalizations.of(context).getVariableText(
|
letterSpacing: 0.0,
|
||||||
ptText: 'Certifique-se de que o QRCode está visivel para o leitor',
|
useGoogleFonts: GoogleFonts.asMap()
|
||||||
enText: 'Make sure the QRCode is visible to the reader',
|
.containsKey(FlutterFlowTheme.of(context)
|
||||||
// '6z6kvmhl' /* Certifique-se de que o QRCode ... */,
|
.titleSmallFamily),
|
||||||
),
|
|
||||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
||||||
fontFamily:
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (_model.isAccess == true && _model.key != null)
|
|
||||||
Container(
|
|
||||||
width: 250.0,
|
|
||||||
height: 80.0,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(100.0),
|
|
||||||
border: Border.all(
|
|
||||||
color: FlutterFlowTheme.of(context).primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
||||||
10.0, 0.0, 0.0, 0.0),
|
|
||||||
child: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: 'Expirando QR code em',
|
|
||||||
enText: 'Expiring QR code in',
|
|
||||||
// 'wkjkxd2e' /* Trocando QR code em */,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: FlutterFlowTheme.of(context)
|
|
||||||
.bodyMedium
|
|
||||||
.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context)
|
|
||||||
.bodyMediumFamily,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap()
|
|
||||||
.containsKey(FlutterFlowTheme.of(context)
|
|
||||||
.bodyMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Align(
|
|
||||||
alignment: const AlignmentDirectional(0.0, 0.0),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
|
||||||
0.0, 0.0, 20.0, 0.0),
|
|
||||||
child: StreamBuilder<double>(
|
|
||||||
stream: getProgressValue(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
||||||
return CircularProgressIndicator();
|
|
||||||
} else if (snapshot.hasError) {
|
|
||||||
return Text('Error: ${snapshot.error}');
|
|
||||||
} else if (!snapshot.hasData) {
|
|
||||||
return Text('No data');
|
|
||||||
} else {
|
|
||||||
final progress = snapshot.data!;
|
|
||||||
return CircularPercentIndicator(
|
|
||||||
percent: progress,
|
|
||||||
restartAnimation: true,
|
|
||||||
reverse: false,
|
|
||||||
radius: 30.0,
|
|
||||||
lineWidth: 7.0,
|
|
||||||
animation: true,
|
|
||||||
animateFromLastPercent: true,
|
|
||||||
onAnimationEnd: () {
|
|
||||||
_resetAnimationAndToggleAccess();
|
|
||||||
},
|
|
||||||
progressColor: FlutterFlowTheme.of(context).primary,
|
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryText,
|
|
||||||
center: Text(
|
|
||||||
'${(progress * totalTimeInSeconds / 5).toStringAsFixed(1)}s',
|
|
||||||
style: FlutterFlowTheme.of(context).headlineSmall.override(
|
|
||||||
fontFamily: FlutterFlowTheme.of(context).headlineSmallFamily,
|
|
||||||
fontSize: 14.0,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).headlineSmallFamily),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
startAngle: 20.0,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
elevation: 3.0,
|
||||||
|
borderSide: const BorderSide(
|
||||||
|
color: Colors.transparent,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (_model.isAccess == true && _model.key != null)
|
||||||
|
Container(
|
||||||
|
width: 300.0,
|
||||||
|
decoration: const BoxDecoration(),
|
||||||
|
child: Visibility(
|
||||||
|
visible: _model.isAccess == true,
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText:
|
||||||
|
'Certifique-se de que o QRCode está visivel para o leitor',
|
||||||
|
enText: 'Make sure the QRCode is visible to the reader',
|
||||||
|
// '6z6kvmhl' /* Certifique-se de que o QRCode ... */,
|
||||||
|
),
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily:
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
if (_model.isAccess == true && _model.key != null)
|
||||||
);
|
Container(
|
||||||
|
width: 250.0,
|
||||||
|
height: 80.0,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(100.0),
|
||||||
|
border: Border.all(
|
||||||
|
color: FlutterFlowTheme.of(context).primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
10.0, 0.0, 0.0, 0.0),
|
||||||
|
child: Text(
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Expirando QR code em',
|
||||||
|
enText: 'Expiring QR code in',
|
||||||
|
// 'wkjkxd2e' /* Trocando QR code em */,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||||
|
fontFamily:
|
||||||
|
FlutterFlowTheme.of(context).bodyMediumFamily,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.bodyMediumFamily),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: const AlignmentDirectional(0.0, 0.0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsetsDirectional.fromSTEB(
|
||||||
|
0.0, 0.0, 20.0, 0.0),
|
||||||
|
child: StreamBuilder<double>(
|
||||||
|
stream: getProgressValue(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState ==
|
||||||
|
ConnectionState.waiting) {
|
||||||
|
return CircularProgressIndicator();
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text('Error: ${snapshot.error}');
|
||||||
|
} else if (!snapshot.hasData) {
|
||||||
|
return Text('No data');
|
||||||
|
} else {
|
||||||
|
final progress = snapshot.data!;
|
||||||
|
return CircularPercentIndicator(
|
||||||
|
percent: progress,
|
||||||
|
restartAnimation: true,
|
||||||
|
reverse: false,
|
||||||
|
radius: 30.0,
|
||||||
|
lineWidth: 7.0,
|
||||||
|
animation: true,
|
||||||
|
animateFromLastPercent: true,
|
||||||
|
onAnimationEnd: () {
|
||||||
|
_resetAnimationAndToggleAccess();
|
||||||
|
},
|
||||||
|
progressColor:
|
||||||
|
FlutterFlowTheme.of(context).primary,
|
||||||
|
backgroundColor:
|
||||||
|
FlutterFlowTheme.of(context).primaryText,
|
||||||
|
center: Text(
|
||||||
|
'${(progress * totalTimeInSeconds / 5).toStringAsFixed(1)}s',
|
||||||
|
style: FlutterFlowTheme.of(context)
|
||||||
|
.headlineSmall
|
||||||
|
.override(
|
||||||
|
fontFamily: FlutterFlowTheme.of(context)
|
||||||
|
.headlineSmallFamily,
|
||||||
|
fontSize: 14.0,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap()
|
||||||
|
.containsKey(
|
||||||
|
FlutterFlowTheme.of(context)
|
||||||
|
.headlineSmallFamily),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
startAngle: 20.0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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();
|
||||||
_model.isAccess = !_model.isAccess;
|
animationsMap['barcodeOnActionTriggerAnimation']!
|
||||||
_model.key = FFAppState().fingerprintPass;
|
.controller
|
||||||
});
|
.reverse();
|
||||||
} ))
|
}
|
||||||
.onError((error, StackTrace) {
|
_model.isAccess = !_model.isAccess;
|
||||||
_showQrCodeBottomSheet(context);
|
_model.key = FFAppState().fingerprintPass;
|
||||||
});
|
});
|
||||||
|
}))
|
||||||
|
.onError((error, StackTrace) {
|
||||||
|
_showQrCodeBottomSheet(context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showQrCodeBottomSheet(BuildContext context) async {
|
Future<void> _showQrCodeBottomSheet(BuildContext context) async {
|
||||||
await showModalBottomSheet(
|
await showModalBottomSheet(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
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;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
).catchError((error) => safeSetState(() {
|
||||||
|
log('Error: $error');
|
||||||
.catchError((error) => safeSetState((){
|
_resetAnimationAndToggleAccess();
|
||||||
log('Error: $error');
|
|
||||||
_resetAnimationAndToggleAccess();
|
|
||||||
}));
|
}));
|
||||||
unawaited(
|
unawaited(
|
||||||
() async {
|
() async {
|
||||||
|
@ -431,50 +433,50 @@ void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _resetAnimationAndToggleAccess() {
|
void _resetAnimationAndToggleAccess() {
|
||||||
safeSetState(() {
|
safeSetState(() {
|
||||||
// Reinicia a animação
|
// Reinicia a animação
|
||||||
animationsMap['barcodeOnActionTriggerAnimation']!.controller.reset();
|
animationsMap['barcodeOnActionTriggerAnimation']!.controller.reset();
|
||||||
animationsMap['barcodeOnActionTriggerAnimation']!.controller.forward();
|
animationsMap['barcodeOnActionTriggerAnimation']!.controller.forward();
|
||||||
// Alterna o estado de acesso
|
// Alterna o estado de acesso
|
||||||
_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(
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
backgroundColor: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
leading: FlutterFlowIconButton(
|
leading: FlutterFlowIconButton(
|
||||||
borderColor: Colors.transparent,
|
borderColor: Colors.transparent,
|
||||||
borderRadius: 30.0,
|
borderRadius: 30.0,
|
||||||
borderWidth: 1.0,
|
borderWidth: 1.0,
|
||||||
buttonSize: 60.0,
|
buttonSize: 60.0,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.keyboard_arrow_left,
|
Icons.keyboard_arrow_left,
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
size: 30.0,
|
size: 30.0,
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
context.pop();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
title: Text(
|
onPressed: () async {
|
||||||
FFLocalizations.of(context).getText(
|
context.pop();
|
||||||
'ku7jqe53' /* QR Code de Acesso */,
|
},
|
||||||
),
|
),
|
||||||
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
title: Text(
|
||||||
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
FFLocalizations.of(context).getText(
|
||||||
color: FlutterFlowTheme.of(context).primaryText,
|
'ku7jqe53' /* QR Code de Acesso */,
|
||||||
fontSize: 16.0,
|
|
||||||
letterSpacing: 0.0,
|
|
||||||
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
||||||
FlutterFlowTheme.of(context).headlineMediumFamily),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
actions: const [],
|
style: FlutterFlowTheme.of(context).headlineMedium.override(
|
||||||
centerTitle: true,
|
fontFamily: FlutterFlowTheme.of(context).headlineMediumFamily,
|
||||||
elevation: 0.0,
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
);
|
fontSize: 16.0,
|
||||||
|
letterSpacing: 0.0,
|
||||||
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
||||||
|
FlutterFlowTheme.of(context).headlineMediumFamily),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: const [],
|
||||||
|
centerTitle: true,
|
||||||
|
elevation: 0.0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue