mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-13 18:55:34 +00:00
Add progress indicators to a bunch o' stuff
This commit is contained in:
@ -16,6 +16,11 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
|
||||
// Current tab index (used for widgets which display bottom tabs)
|
||||
int tabIndex = 0;
|
||||
|
||||
// Bool indicator
|
||||
bool loading = false;
|
||||
|
||||
bool get loaded => !loading;
|
||||
|
||||
// Update current tab selection
|
||||
void onTabSelectionChanged(int index) {
|
||||
setState(() {
|
||||
@ -45,8 +50,16 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
|
||||
}
|
||||
|
||||
Future<void> refresh() async {
|
||||
|
||||
setState(() {
|
||||
loading = true;
|
||||
});
|
||||
|
||||
await request(context);
|
||||
setState(() {});
|
||||
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
// Function to construct an appbar (override if needed)
|
||||
|
Reference in New Issue
Block a user