new apps load
This commit is contained in:
parent
1c52e249ba
commit
7a1395220c
1 changed files with 4 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:async';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -83,12 +84,14 @@ class _AppLauncherScreenState extends State<AppLauncherScreen> with WidgetsBindi
|
||||||
List<AppInfo> apps = [];
|
List<AppInfo> apps = [];
|
||||||
List<AppInfo> filteredApps = [];
|
List<AppInfo> filteredApps = [];
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
|
StreamSubscription<ApplicationEvent>? _appsChangeSub;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
_loadInstalledApps();
|
_loadInstalledApps();
|
||||||
|
_appsChangeSub = DeviceApps.listenToAppsChanges().listen((_) => _loadInstalledApps());
|
||||||
searchController.addListener(_filterApps);
|
searchController.addListener(_filterApps);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (context.read<AppSettings>().autoFocus) {
|
if (context.read<AppSettings>().autoFocus) {
|
||||||
|
|
@ -100,6 +103,7 @@ class _AppLauncherScreenState extends State<AppLauncherScreen> with WidgetsBindi
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
|
_appsChangeSub?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue