summaryrefslogtreecommitdiff
path: root/lib/widgets/debug/os_apps.dart
diff options
context:
space:
mode:
authormirror <mirror@localhost>2026-11-22 08:41:00 +0900
committermirror <mirror@localhost>2026-11-22 08:41:00 +0900
commit449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch)
treec131c3528c4d517f56e19b854a7453fedb097d40 /lib/widgets/debug/os_apps.dart
downloadaves-src-master.tar.gz
aves-src-master.zip
snapshot of aves v1.13.12 (secrets removed: android/app/google-services.json)HEADv1.13.12master
Diffstat (limited to 'lib/widgets/debug/os_apps.dart')
-rw-r--r--lib/widgets/debug/os_apps.dart122
1 files changed, 122 insertions, 0 deletions
diff --git a/lib/widgets/debug/os_apps.dart b/lib/widgets/debug/os_apps.dart
new file mode 100644
index 0000000..d8250a4
--- /dev/null
+++ b/lib/widgets/debug/os_apps.dart
@@ -0,0 +1,122 @@
+import 'package:aves/image_providers/app_icon_image_provider.dart';
+import 'package:aves/model/app_inventory.dart';
+import 'package:aves/services/common/services.dart';
+import 'package:aves/widgets/common/basic/query_bar.dart';
+import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
+import 'package:aves/widgets/viewer/info/common.dart';
+import 'package:collection/collection.dart';
+import 'package:flutter/material.dart';
+
+class DebugOSAppSection extends StatefulWidget {
+ const DebugOSAppSection({super.key});
+
+ @override
+ State<DebugOSAppSection> createState() => _DebugOSAppSectionState();
+}
+
+class _DebugOSAppSectionState extends State<DebugOSAppSection> with AutomaticKeepAliveClientMixin {
+ late Future<Set<Package>> _loader;
+ final ValueNotifier<String> _queryNotifier = ValueNotifier('');
+
+ static const iconSize = 20.0;
+
+ @override
+ void initState() {
+ super.initState();
+ _loader = appService.getPackages();
+ }
+
+ @override
+ void dispose() {
+ _queryNotifier.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ super.build(context);
+
+ return AvesExpansionTile(
+ title: 'OS Apps',
+ children: [
+ Padding(
+ padding: const EdgeInsets.only(left: 8, right: 8, bottom: 8),
+ child: FutureBuilder<Set<Package>>(
+ future: _loader,
+ builder: (context, snapshot) {
+ if (snapshot.hasError) return Text(snapshot.error.toString());
+ if (snapshot.connectionState != ConnectionState.done) return const SizedBox();
+ final packages = snapshot.data!.toList()..sort((a, b) => compareAsciiUpperCase(a.packageName, b.packageName));
+ final enabledTheme = IconTheme.of(context);
+ final disabledTheme = enabledTheme.merge(const IconThemeData(opacity: .2));
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ QueryBar(queryNotifier: _queryNotifier),
+ ...packages.map((package) {
+ return ValueListenableBuilder<String>(
+ valueListenable: _queryNotifier,
+ builder: (context, query, child) {
+ if ({package.packageName, ...package.potentialDirs}.none((v) => v.toLowerCase().contains(query.toLowerCase()))) {
+ return const SizedBox();
+ }
+ return Text.rich(
+ TextSpan(
+ children: [
+ WidgetSpan(
+ alignment: PlaceholderAlignment.middle,
+ child: Image(
+ image: AppIconImage(
+ packageName: package.packageName,
+ size: iconSize,
+ ),
+ width: iconSize,
+ height: iconSize,
+ ),
+ ),
+ TextSpan(
+ text: ' ${package.packageName}\n',
+ style: InfoRowGroup.keyStyle(context),
+ ),
+ WidgetSpan(
+ alignment: PlaceholderAlignment.middle,
+ child: IconTheme(
+ data: package.categoryLauncher ? enabledTheme : disabledTheme,
+ child: const Icon(
+ Icons.launch_outlined,
+ size: iconSize,
+ ),
+ ),
+ ),
+ WidgetSpan(
+ alignment: PlaceholderAlignment.middle,
+ child: IconTheme(
+ data: package.isSystem ? enabledTheme : disabledTheme,
+ child: const Icon(
+ Icons.android,
+ size: iconSize,
+ ),
+ ),
+ ),
+ TextSpan(
+ text: ' ${package.potentialDirs.join(', ')}\n',
+ style: InfoRowGroup.valueStyle,
+ ),
+ ],
+ ),
+ );
+ },
+ );
+ })
+ ],
+ );
+ },
+ ),
+ ),
+ ],
+ );
+ }
+
+ @override
+ bool get wantKeepAlive => true;
+}