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