mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Progress dialog is now a part of the model GET request
This commit is contained in:
parent
ca7505796d
commit
8bd022bccd
10 changed files with 41 additions and 33 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import 'package:InvenTree/api.dart';
|
||||
import 'package:InvenTree/widget/dialogs.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
|
|
@ -15,6 +17,8 @@ class InvenTreeModel {
|
|||
// Override the endpoint URL for each subclass
|
||||
String URL = "";
|
||||
|
||||
String NAME = "Model";
|
||||
|
||||
// JSON data which defines this object
|
||||
Map<String, dynamic> jsondata = {};
|
||||
|
||||
|
|
@ -100,7 +104,7 @@ class InvenTreeModel {
|
|||
}
|
||||
|
||||
// Return the detail view for the associated pk
|
||||
Future<InvenTreeModel> get(int pk, {Map<String, String> filters}) async {
|
||||
Future<InvenTreeModel> get(BuildContext context, int pk, {Map<String, String> filters}) async {
|
||||
|
||||
// TODO - Add "timeout"
|
||||
// TODO - Add error catching
|
||||
|
|
@ -122,8 +126,12 @@ class InvenTreeModel {
|
|||
|
||||
print("GET: $addr ${params.toString()}");
|
||||
|
||||
showProgressDialog(context, "Requesting Data", "Requesting ${NAME} data from server");
|
||||
|
||||
var response = await api.get(addr, params: params);
|
||||
|
||||
hideProgressDialog(context);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
print("Error retrieving data");
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue