WIP
This commit is contained in:
parent
ccd63168bd
commit
d26eb5d8fa
|
@ -25,55 +25,16 @@ Widget buildDetails(
|
|||
FlutterFlowIconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () async {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
showAlertDialog(
|
||||
context,
|
||||
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?',
|
||||
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 {
|
||||
), () async {
|
||||
await changeStatusAction
|
||||
?.call(
|
||||
context,
|
||||
|
@ -105,7 +66,6 @@ Widget buildDetails(
|
|||
}
|
||||
}).catchError((err, stack) {
|
||||
Navigator.pop(context);
|
||||
|
||||
showSnackbar(
|
||||
context,
|
||||
FFLocalizations.of(context).getVariableText(
|
||||
|
@ -115,24 +75,6 @@ Widget buildDetails(
|
|||
true,
|
||||
);
|
||||
});
|
||||
},
|
||||
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),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
},
|
||||
),
|
||||
|
|
|
@ -549,8 +549,8 @@ void showSnackbar(
|
|||
);
|
||||
}
|
||||
|
||||
void showAlertDialog(
|
||||
BuildContext context, String title, String content, Future action) {
|
||||
void showAlertDialog(BuildContext context, String title, String content,
|
||||
Future<void> Function() action) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
|
@ -577,6 +577,7 @@ void showAlertDialog(
|
|||
width: 1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
elevation: 0,
|
||||
),
|
||||
text: FFLocalizations.of(context).getVariableText(
|
||||
enText: 'No',
|
||||
|
@ -585,12 +586,13 @@ void showAlertDialog(
|
|||
),
|
||||
FFButtonWidget(
|
||||
onPressed: () async {
|
||||
await action;
|
||||
action();
|
||||
},
|
||||
options: FFButtonOptions(
|
||||
width: MediaQuery.of(context).size.width * 0.3,
|
||||
height: MediaQuery.of(context).size.height * 0.05,
|
||||
color: FlutterFlowTheme.of(context).primaryBackground,
|
||||
elevation: 0,
|
||||
textStyle: TextStyle(
|
||||
color: FlutterFlowTheme.of(context).primaryText,
|
||||
),
|
||||
|
|
|
@ -63,8 +63,6 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
|||
.visitasList(wrapGetVisitsResponse.jsonBody)
|
||||
?.toList() ??
|
||||
[];
|
||||
log('updated');
|
||||
log('visitaWrap: ${visitaWrap[0]}');
|
||||
return ListView.builder(
|
||||
itemCount: visitaWrap.length,
|
||||
shrinkWrap: true,
|
||||
|
@ -147,7 +145,6 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
|||
);
|
||||
},
|
||||
).whenComplete(() async {
|
||||
log('Complete');
|
||||
final newResponseStream =
|
||||
ScheduleCompleteVisitPageModel().visitHistory(
|
||||
requestFn: () => PhpGroup.getVisitsCall.call(
|
||||
|
@ -160,22 +157,13 @@ class _VisitHistoryWidgetState extends State<VisitHistoryWidget> {
|
|||
),
|
||||
);
|
||||
newResponseStream.listen((newResponse) {
|
||||
log('New response received: $newResponse');
|
||||
if (mounted) {
|
||||
safeSetState(() {
|
||||
response = newResponse.jsonBody;
|
||||
log('Response updated: $response');
|
||||
});
|
||||
} else {
|
||||
log('Widget is not mounted, skipping state update.');
|
||||
}
|
||||
}).onError((err) {
|
||||
log('Error: $err');
|
||||
});
|
||||
}).catchError((err, stack) {
|
||||
log('Error: $err');
|
||||
log('Stack: $stack');
|
||||
});
|
||||
} else {}
|
||||
}).onError((err) {});
|
||||
}).catchError((err, stack) {});
|
||||
},
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue