mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-03 07:48:53 +00:00
Fixed "await" for refreshable states
- Progress indicator stays in place until calls are completed
This commit is contained in:
parent
0cfac69d16
commit
12f4a4fa38
@ -62,7 +62,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
int pk = category?.pk ?? -1;
|
int pk = category?.pk ?? -1;
|
||||||
|
|
||||||
// Request a list of sub-categories under this one
|
// Request a list of sub-categories under this one
|
||||||
InvenTreePartCategory().list(context, filters: {"parent": "$pk"}).then((var cats) {
|
await InvenTreePartCategory().list(context, filters: {"parent": "$pk"}).then((var cats) {
|
||||||
_subcategories.clear();
|
_subcategories.clear();
|
||||||
|
|
||||||
for (var cat in cats) {
|
for (var cat in cats) {
|
||||||
@ -76,7 +76,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Request a list of parts under this category
|
// Request a list of parts under this category
|
||||||
InvenTreePart().list(context, filters: {"category": "$pk"}).then((var parts) {
|
await InvenTreePart().list(context, filters: {"category": "$pk"}).then((var parts) {
|
||||||
_parts.clear();
|
_parts.clear();
|
||||||
|
|
||||||
for (var part in parts) {
|
for (var part in parts) {
|
||||||
|
@ -60,7 +60,7 @@ class _CompanyListState extends RefreshableState<CompanyListWidget> {
|
|||||||
@override
|
@override
|
||||||
Future<void> request(BuildContext context) async {
|
Future<void> request(BuildContext context) async {
|
||||||
|
|
||||||
InvenTreeCompany().list(context, filters: _filters).then((var companies) {
|
await InvenTreeCompany().list(context, filters: _filters).then((var companies) {
|
||||||
|
|
||||||
_companies.clear();
|
_companies.clear();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
int pk = location?.pk ?? -1;
|
int pk = location?.pk ?? -1;
|
||||||
|
|
||||||
// Request a list of sub-locations under this one
|
// Request a list of sub-locations under this one
|
||||||
InvenTreeStockLocation().list(context, filters: {"parent": "$pk"}).then((var locs) {
|
await InvenTreeStockLocation().list(context, filters: {"parent": "$pk"}).then((var locs) {
|
||||||
_sublocations.clear();
|
_sublocations.clear();
|
||||||
|
|
||||||
for (var loc in locs) {
|
for (var loc in locs) {
|
||||||
@ -76,23 +76,21 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
_sublocations.add(loc);
|
_sublocations.add(loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
|
|
||||||
// Request a list of stock-items under this one
|
|
||||||
InvenTreeStockItem().list(context, filters: {"location": "$pk"}).then((var items) {
|
|
||||||
_items.clear();
|
|
||||||
|
|
||||||
for (var item in items) {
|
|
||||||
if (item is InvenTreeStockItem) {
|
|
||||||
_items.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
|
||||||
|
await InvenTreeStockItem().list(context, filters: {"location": "$pk"}).then((var items) {
|
||||||
|
_items.clear();
|
||||||
|
|
||||||
|
for (var item in items) {
|
||||||
|
if (item is InvenTreeStockItem) {
|
||||||
|
_items.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget locationDescriptionCard() {
|
Widget locationDescriptionCard() {
|
||||||
|
@ -46,7 +46,6 @@ class _PartStockDisplayState extends RefreshableState<PartStockDetailWidget> {
|
|||||||
await part.reload(context);
|
await part.reload(context);
|
||||||
await part.getStockItems(context);
|
await part.getStockItems(context);
|
||||||
|
|
||||||
print("request");
|
|
||||||
setState(() {
|
setState(() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user