fix: Fix setState calls in message history page widget
This commit is contained in:
parent
976205b096
commit
d2cf5b4252
|
@ -491,57 +491,17 @@ class NotificationHandler {
|
||||||
FlutterFlowIconButton(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
showDialog(
|
showAlertDialog(
|
||||||
context: context,
|
context,
|
||||||
builder: (context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText: 'Bloquear Visita',
|
ptText: 'Bloquear Visita',
|
||||||
enText: 'Block Visit',
|
enText: 'Block Visit',
|
||||||
),
|
),
|
||||||
),
|
|
||||||
content: Text(
|
|
||||||
FFLocalizations.of(context).getVariableText(
|
FFLocalizations.of(context).getVariableText(
|
||||||
ptText:
|
ptText:
|
||||||
'Você tem certeza que deseja bloquear essa visita?',
|
'Você tem certeza que deseja bloquear essa visita?',
|
||||||
enText:
|
enText: 'Are you sure you want to block this visit?',
|
||||||
'Are you sure you want to block this visit?',
|
), () async {
|
||||||
),
|
|
||||||
),
|
|
||||||
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 answersRequest.call(
|
await answersRequest.call(
|
||||||
context,
|
context,
|
||||||
message['referencia'].toString(),
|
message['referencia'].toString(),
|
||||||
|
@ -549,26 +509,6 @@ class NotificationHandler {
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
message['idVisitante'].toString(),
|
message['idVisitante'].toString(),
|
||||||
);
|
);
|
||||||
},
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import 'dart:math';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hub/actions/actions.dart';
|
import 'package:hub/actions/actions.dart';
|
||||||
|
@ -18,11 +18,16 @@ Widget buildDetails(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
Future<dynamic> Function(BuildContext, int, int, String, String)?
|
Future<dynamic> Function(BuildContext, int, int, String, String)?
|
||||||
changeStatusAction) {
|
changeStatusAction) {
|
||||||
|
log('visitaWrapItem: ${visitaWrapItem.toString()}');
|
||||||
return VisitRequestTemplateComponentWidget(
|
return VisitRequestTemplateComponentWidget(
|
||||||
buttons: [
|
buttons: [
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
status.active) // REJECT ACTION
|
status.active) // REJECT ACTION
|
||||||
FlutterFlowIconButton(
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Cancelar',
|
||||||
|
enText: 'Cancel',
|
||||||
|
),
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
showAlertDialog(
|
showAlertDialog(
|
||||||
|
@ -77,6 +82,20 @@ Widget buildDetails(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) !=
|
if (getStatus(visitaWrapItem['VAW_STATUS']) !=
|
||||||
status.active) // RECALL ACTION
|
status.active) // RECALL ACTION
|
||||||
|
@ -89,9 +108,15 @@ Widget buildDetails(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|
||||||
context.pushNamed(
|
context.pushNamed(
|
||||||
'scheduleCompleteVisitPage',
|
'scheduleCompleteVisitPage',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
|
'dropdownValue1': visitaWrapItem['MOT_DESCRICAO'],
|
||||||
|
'dropdownValue2': serializeParam(
|
||||||
|
visitaWrapItem['NAC_DESCRICAO'],
|
||||||
|
ParamType.String,
|
||||||
|
),
|
||||||
'visitorStrList': serializeParam(
|
'visitorStrList': serializeParam(
|
||||||
visitaWrapItem['VTE_DOCUMENTO'],
|
visitaWrapItem['VTE_DOCUMENTO'],
|
||||||
ParamType.String,
|
ParamType.String,
|
||||||
|
@ -121,7 +146,11 @@ Widget buildDetails(
|
||||||
),
|
),
|
||||||
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
if (getStatus(visitaWrapItem['VAW_STATUS']) ==
|
||||||
status.active) // SHARE ACTION
|
status.active) // SHARE ACTION
|
||||||
FlutterFlowIconButton(
|
FFButtonWidget(
|
||||||
|
text: FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: 'Reagendar',
|
||||||
|
enText: 'Reschedule',
|
||||||
|
),
|
||||||
icon: const Icon(Icons.share),
|
icon: const Icon(Icons.share),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Share.share('''
|
Share.share('''
|
||||||
|
@ -134,6 +163,20 @@ Olá, \*${visitaWrapItem['VTE_NOME']}\*! Você foi convidado para \*${visitaWrap
|
||||||
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
|
URL do Convite: https://visita.freaccess.com.br/${visitaWrapItem['VAW_ID']}/${visitaWrapItem['CLI_ID']}/${visitaWrapItem['VAW_CHAVE']}
|
||||||
''');
|
''');
|
||||||
},
|
},
|
||||||
|
options: FFButtonOptions(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
elevation: 0,
|
||||||
|
textStyle: TextStyle(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryText,
|
||||||
|
),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
// borderRadius: 12,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: Map<String, String>.from({
|
||||||
|
|
|
@ -37,7 +37,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
late VisitorSearchModalTemplateComponentModel _model;
|
late VisitorSearchModalTemplateComponentModel _model;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void setState(VoidCallback callback) {
|
safeSetState(VoidCallback callback) {
|
||||||
super.setState(callback);
|
super.setState(callback);
|
||||||
_model.onUpdate();
|
_model.onUpdate();
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
focusNode: _model.textFieldFocusNode,
|
focusNode: _model.textFieldFocusNode,
|
||||||
onFieldSubmitted: (_) async {
|
onFieldSubmitted: (_) async {
|
||||||
await addVisitor(context);
|
await addVisitor(context);
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
|
@ -356,7 +356,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
_model.removeFromVisitors(
|
_model.removeFromVisitors(
|
||||||
visitorItem);
|
visitorItem);
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -391,7 +391,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
? () async {
|
? () async {
|
||||||
await addVisitor(context);
|
await addVisitor(context);
|
||||||
|
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
: () async {
|
: () async {
|
||||||
await sendVisitors(context);
|
await sendVisitors(context);
|
||||||
|
@ -437,7 +437,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10.0,
|
height: 20.0,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -456,7 +456,7 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addVisitor(BuildContext context) async {
|
Future<void> addVisitor(BuildContext context) async {
|
||||||
setState(() {
|
safeSetState(() {
|
||||||
_model.textController?.text = _model.textController.text;
|
_model.textController?.text = _model.textController.text;
|
||||||
_model.textController?.selection =
|
_model.textController?.selection =
|
||||||
TextSelection.collapsed(offset: _model.textController!.text.length);
|
TextSelection.collapsed(offset: _model.textController!.text.length);
|
||||||
|
@ -472,13 +472,20 @@ class _VisitorSearchModalTemplateComponentWidgetState
|
||||||
if (PhpGroup.getVisitorByDocCall.vistanteId(
|
if (PhpGroup.getVisitorByDocCall.vistanteId(
|
||||||
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
||||||
) !=
|
) !=
|
||||||
'0') {
|
'0' &&
|
||||||
|
PhpGroup.getVisitorByDocCall
|
||||||
|
.error((_model.getVisitorByDoc?.jsonBody ?? '')) ==
|
||||||
|
false &&
|
||||||
|
PhpGroup.getVisitorByDocCall
|
||||||
|
.vistanteId((_model.getVisitorByDoc?.jsonBody ?? '')) !=
|
||||||
|
null) {
|
||||||
|
log('visitor found: ${PhpGroup.getVisitorByDocCall.vistanteId((_model.getVisitorByDoc?.jsonBody ?? ''))}');
|
||||||
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
|
_model.addToVisitors(PhpGroup.getVisitorByDocCall.visitante(
|
||||||
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
(_model.getVisitorByDoc?.jsonBody ?? ''),
|
||||||
));
|
));
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
_model.addToDocs(_model.textController.text);
|
_model.addToDocs(_model.textController.text);
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
} else {
|
} else {
|
||||||
await showAdaptiveDialog(
|
await showAdaptiveDialog(
|
||||||
useSafeArea: true,
|
useSafeArea: true,
|
||||||
|
|
|
@ -53,7 +53,7 @@ class _LiberationHistoryWidgetState extends State<LiberationHistoryWidget> {
|
||||||
|
|
||||||
void onUpdate(BuildContext context) {
|
void onUpdate(BuildContext context) {
|
||||||
_model.clearGetLiberationsCache();
|
_model.clearGetLiberationsCache();
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -338,20 +338,6 @@ Widget liberationHistoryItemCard(
|
||||||
return Dialog(
|
return Dialog(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: VisitRequestTemplateComponentWidget(
|
child: VisitRequestTemplateComponentWidget(
|
||||||
// vteName: liberationHistoryItem['VTE_NOME'],
|
|
||||||
// vteReason: liberationHistoryItem['NOT_MOTIVO'],
|
|
||||||
// vawDate: liberationHistoryItem['NOT_STATUS'] == 'S'
|
|
||||||
// ? liberationHistoryItem['NOT_DTENVIO']
|
|
||||||
// : liberationHistoryItem['NOT_DTRESPOSTA'],
|
|
||||||
// vawStatus: liberationHistoryItem['NOT_STATUS'],
|
|
||||||
// vteMsg: liberationHistoryItem['NOT_MSGENVIO'],
|
|
||||||
// vteUUID: liberationHistoryItem['VTE_ID'],
|
|
||||||
// cliUUID: FFAppState().cliUUID,
|
|
||||||
// msgUUID: liberationHistoryItem['NOT_ID'],
|
|
||||||
// vawDestino: liberationHistoryItem['NOT_DESTINO'],
|
|
||||||
// vawUUID: liberationHistoryItem['NOT_ID'],
|
|
||||||
// vawName: liberationHistoryItem['NOT_NOME'],
|
|
||||||
// vawRef: liberationHistoryItem['NOT_ID'],
|
|
||||||
labelsHashMap: Map<String, String>.from({
|
labelsHashMap: Map<String, String>.from({
|
||||||
'Nome:': liberationHistoryItem['VTE_NOME'],
|
'Nome:': liberationHistoryItem['VTE_NOME'],
|
||||||
'Data:': liberationHistoryItem['NOT_DTENVIO'],
|
'Data:': liberationHistoryItem['NOT_DTENVIO'],
|
||||||
|
@ -364,181 +350,31 @@ Widget liberationHistoryItemCard(
|
||||||
FlutterFlowIconButton(
|
FlutterFlowIconButton(
|
||||||
icon: const Icon(Icons.done),
|
icon: const Icon(Icons.done),
|
||||||
onPressed: () async {
|
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 {
|
|
||||||
Navigator.pop(context);
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
await answersRequest
|
await answersRequest
|
||||||
.call(
|
.call(
|
||||||
context,
|
context,
|
||||||
liberationHistoryItem['NOT_ID']
|
liberationHistoryItem['NOT_ID'].toString(),
|
||||||
.toString(),
|
|
||||||
'L',
|
'L',
|
||||||
'Mensagem',
|
'Mensagem',
|
||||||
liberationHistoryItem['VTE_ID']
|
liberationHistoryItem['VTE_ID'].toString(),
|
||||||
.toString(),
|
|
||||||
)
|
)
|
||||||
.then((value) {});
|
.then((value) {
|
||||||
},
|
if (value) {
|
||||||
options: FFButtonOptions(
|
return showSnackbar(
|
||||||
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 (liberationHistoryItem['NOT_STATUS'] == 'S')
|
|
||||||
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 answersRequest.call(
|
|
||||||
context,
|
context,
|
||||||
liberationHistoryItem['NOT_ID']
|
FFLocalizations.of(context).getVariableText(
|
||||||
.toString(),
|
enText: 'Successfully resolved visit',
|
||||||
'B',
|
ptText: 'Visita resolvida com sucesso'),
|
||||||
'Mensagem',
|
false);
|
||||||
liberationHistoryItem['VTE_ID']
|
} else {
|
||||||
.toString(),
|
return showSnackbar(
|
||||||
);
|
context,
|
||||||
},
|
FFLocalizations.of(context).getVariableText(
|
||||||
options: FFButtonOptions(
|
enText: 'Error resolving visit',
|
||||||
width: 100,
|
ptText: 'Erro ao resolver visita'),
|
||||||
height: 40,
|
true);
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -567,9 +403,6 @@ Widget liberationHistoryItemCard(
|
||||||
],
|
],
|
||||||
imagePath:
|
imagePath:
|
||||||
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
|
'https://freaccess.com.br/freaccess/getImage.php?cliID=${FFAppState().cliUUID}&atividade=getFoto&Documento=${liberationHistoryItem['VTE_ID'] ?? ''}&tipo=E',
|
||||||
|
|
||||||
// changeStatusAction: answersRequest,
|
|
||||||
// vteDocument: liberationHistoryItem['VTE_DOCUMENTO'],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -580,7 +413,12 @@ Widget liberationHistoryItemCard(
|
||||||
_pushNotificationService.onMessageReceived.listen((received) {
|
_pushNotificationService.onMessageReceived.listen((received) {
|
||||||
if (received.data['click_action'] == 'cancel_request') {
|
if (received.data['click_action'] == 'cancel_request') {
|
||||||
_pushNotificationService.dispose();
|
_pushNotificationService.dispose();
|
||||||
snackbar(context, opt: true);
|
showSnackbar(
|
||||||
|
context,
|
||||||
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
enText: 'Successfully resolved visit',
|
||||||
|
ptText: 'Visita resolvida com sucesso'),
|
||||||
|
false);
|
||||||
context.pushReplacementNamed(
|
context.pushReplacementNamed(
|
||||||
'liberationHistory',
|
'liberationHistory',
|
||||||
extra: <String, dynamic>{
|
extra: <String, dynamic>{
|
||||||
|
|
|
@ -20,10 +20,12 @@ class MessageHistoryPageWidget extends StatefulWidget {
|
||||||
const MessageHistoryPageWidget({super.key});
|
const MessageHistoryPageWidget({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<MessageHistoryPageWidget> createState() => _MessageHistoryPageWidgetState();
|
State<MessageHistoryPageWidget> createState() =>
|
||||||
|
_MessageHistoryPageWidgetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> with TickerProviderStateMixin {
|
class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
late MessageHistoryPageModel _model;
|
late MessageHistoryPageModel _model;
|
||||||
|
|
||||||
final scaffoldKey = GlobalKey<ScaffoldState>();
|
final scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
@ -47,13 +49,17 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
|
|
||||||
_messageFuture = fetchMessage();
|
_messageFuture = fetchMessage();
|
||||||
|
|
||||||
_scrollController = ScrollController()..addListener(() {
|
_scrollController = ScrollController()
|
||||||
if (_scrollController.position.atEdge && _scrollController.position.pixels != 0) {
|
..addListener(() {
|
||||||
|
if (_scrollController.position.atEdge &&
|
||||||
|
_scrollController.position.pixels != 0) {
|
||||||
_loadMore();
|
_loadMore();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_model.tabBarController = TabController(vsync: this, length: 3, initialIndex: 0)..addListener(() {
|
_model.tabBarController =
|
||||||
|
TabController(vsync: this, length: 3, initialIndex: 0)
|
||||||
|
..addListener(() {
|
||||||
if (_model.tabBarController?.index == 0) {
|
if (_model.tabBarController?.index == 0) {
|
||||||
_destinyType = "P";
|
_destinyType = "P";
|
||||||
} else if (_model.tabBarController?.index == 1) {
|
} else if (_model.tabBarController?.index == 1) {
|
||||||
|
@ -80,7 +86,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
|
|
||||||
void onUpdate(BuildContext context) {
|
void onUpdate(BuildContext context) {
|
||||||
_model.clearGetLiberationsCache();
|
_model.clearGetLiberationsCache();
|
||||||
setState(() {});
|
safeSetState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -129,7 +135,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
return null;
|
return null;
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
DialogUtil.errorDefault(context);
|
DialogUtil.errorDefault(context);
|
||||||
LogUtil.requestAPIFailed("proccessRequest.php", "", "Consulta de Mensagems", e, s);
|
LogUtil.requestAPIFailed(
|
||||||
|
"proccessRequest.php", "", "Consulta de Mensagems", e, s);
|
||||||
setState(() {
|
setState(() {
|
||||||
_hasData = false;
|
_hasData = false;
|
||||||
_loading = false;
|
_loading = false;
|
||||||
|
@ -232,12 +239,9 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(FFLocalizations.of(context).getVariableText(
|
||||||
FFLocalizations.of(context).getVariableText(
|
|
||||||
ptText: "Nenhuma mensagem encontrada!",
|
ptText: "Nenhuma mensagem encontrada!",
|
||||||
enText: "No message found"
|
enText: "No message found")),
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -255,8 +259,7 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final item = _messageWrap[index];
|
final item = _messageWrap[index];
|
||||||
return _item(context, item);
|
return _item(context, item);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -280,7 +283,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
FFLocalizations.of(context).getVariableText(ptText: "Não há mais dados.", enText: "No more data."),
|
FFLocalizations.of(context).getVariableText(
|
||||||
|
ptText: "Não há mais dados.", enText: "No more data."),
|
||||||
),
|
),
|
||||||
duration: const Duration(seconds: 3),
|
duration: const Duration(seconds: 3),
|
||||||
backgroundColor: FlutterFlowTheme.of(context).primary,
|
backgroundColor: FlutterFlowTheme.of(context).primary,
|
||||||
|
@ -288,7 +292,6 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Widget _item(BuildContext context, dynamic jsonBody) {
|
Widget _item(BuildContext context, dynamic jsonBody) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
|
@ -340,7 +343,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
padding: const EdgeInsets.only(left: 5),
|
padding: const EdgeInsets.only(left: 5),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.history,
|
Icons.history,
|
||||||
color: FlutterFlowTheme.of(context).customColor6,
|
color:
|
||||||
|
FlutterFlowTheme.of(context).customColor6,
|
||||||
size: 15,
|
size: 15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -366,7 +370,8 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
padding: const EdgeInsets.only(left: 5),
|
padding: const EdgeInsets.only(left: 5),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.message,
|
Icons.message,
|
||||||
color: FlutterFlowTheme.of(context).customColor6,
|
color:
|
||||||
|
FlutterFlowTheme.of(context).customColor6,
|
||||||
size: 15,
|
size: 15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -388,7 +393,4 @@ class _MessageHistoryPageWidgetState extends State<MessageHistoryPageWidget> wit
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue