Skip App loading on return to foreground

This commit is contained in:
Imran Remtulla
2023-05-22 12:10:58 -04:00
parent ca1371260c
commit 4136734a60
2 changed files with 9 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ class NavigationPageItem {
class _HomePageState extends State<HomePage> {
List<int> selectedIndexHistory = [];
int prevAppCount = -1;
bool prevIsLoading = true;
List<NavigationPageItem> pages = [
NavigationPageItem(tr('appsString'), Icons.apps,
@@ -64,13 +65,15 @@ class _HomePageState extends State<HomePage> {
}
}
if (prevAppCount >= 0 &&
if (!prevIsLoading &&
prevAppCount >= 0 &&
appsProvider.apps.length > prevAppCount &&
selectedIndexHistory.isNotEmpty &&
selectedIndexHistory.last == 1) {
switchToPage(0);
}
prevAppCount = appsProvider.apps.length;
prevIsLoading = appsProvider.loadingApps;
return WillPopScope(
child: Scaffold(