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

Disable some more natty dialogs

This commit is contained in:
Oliver Walters
2021-02-04 23:56:06 +11:00
parent 1ee54a00de
commit e77b9539f9
2 changed files with 24 additions and 9 deletions

View File

@ -65,21 +65,26 @@ class BarcodeHandler {
);
}
Future<void> processBarcode(BuildContext context, QRViewController _controller, String barcode) {
Future<void> processBarcode(BuildContext context, QRViewController _controller, String barcode, {String url = "barcode/", bool show_dialog = false}) {
this._context = context;
this._controller = _controller;
print("Scanned barcode data: ${barcode}");
showProgressDialog(context, "Scanning", "Sending barcode data to server");
if (show_dialog) {
showProgressDialog(context, "Scanning", "Sending barcode data to server");
}
// Send barcode request to server
InvenTreeAPI().post(
"barcode/",
url,
body: {
"barcode": barcode
}
).then((var response) {
hideProgressDialog(context);
if (show_dialog) {
hideProgressDialog(context);
}
if (response.statusCode != 200) {
showErrorDialog(
@ -112,7 +117,11 @@ class BarcodeHandler {
}).timeout(
Duration(seconds: 5)
).catchError((error) {
hideProgressDialog(context);
if (show_dialog) {
hideProgressDialog(context);
}
showErrorDialog(
context,
"Error",