2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 18:25:26 +00:00

Better handling of HttpClientRequest

This commit is contained in:
Oliver Walters
2021-04-20 09:41:50 +10:00
parent fa58cca333
commit f5e1f25dd0
4 changed files with 107 additions and 14 deletions

View File

@ -177,19 +177,24 @@ Future<void> showStatusCodeError(int status, {int expected = 200}) async {
Future<void> showTimeoutError(BuildContext context) async {
await showServerError(I18N.of(context).timeout, I18N.of(context).noResponse);
// Use OneContext as "sometimes" context is null here?
var ctx = OneContext().context;
await showServerError(I18N.of(ctx).timeout, I18N.of(ctx).noResponse);
}
void showFormDialog(String title, {String acceptText, String cancelText, GlobalKey<FormState> key, List<Widget> fields, List<Widget> actions, Function callback}) {
BuildContext dialogContext;
var ctx = OneContext().context;
if (acceptText == null) {
acceptText = I18N.of(OneContext().context).save;
acceptText = I18N.of(ctx).save;
}
if (cancelText == null) {
cancelText = I18N.of(OneContext().context).cancel;
cancelText = I18N.of(ctx).cancel;
}
// Undefined actions = OK + Cancel