2
0
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:
Oliver Walters
2021-02-11 21:38:48 +11:00
parent dba45c7600
commit b1b85a33f8
8 changed files with 172 additions and 96 deletions

View File

@ -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)