2022-08-22 01:55:54 +02:00
|
|
|
import 'package:device_apps/device_apps.dart';
|
2022-07-31 21:46:27 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-09-02 01:10:10 +02:00
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-08-16 15:06:56 +02:00
|
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
2022-08-30 03:07:28 +02:00
|
|
|
import 'package:revanced_manager/models/patched_application.dart';
|
2022-08-16 15:06:56 +02:00
|
|
|
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
2022-08-21 12:47:44 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/shared/application_item.dart';
|
2022-07-31 21:46:27 +02:00
|
|
|
|
2022-08-01 20:15:55 +02:00
|
|
|
class InstalledAppsCard extends StatelessWidget {
|
2022-09-01 12:16:14 +02:00
|
|
|
InstalledAppsCard({Key? key}) : super(key: key);
|
2022-07-31 21:46:27 +02:00
|
|
|
|
2022-08-30 03:07:28 +02:00
|
|
|
final List<PatchedApplication> apps =
|
|
|
|
locator<HomeViewModel>().patchedInstalledApps;
|
|
|
|
|
2022-07-31 21:46:27 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-02 01:10:10 +02:00
|
|
|
return apps.isEmpty
|
|
|
|
? Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
color: Theme.of(context).colorScheme.primary,
|
|
|
|
),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 18, horizontal: 20),
|
|
|
|
child: Center(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Icon(
|
|
|
|
Icons.file_download_off,
|
|
|
|
size: 40,
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
I18nText(
|
|
|
|
'homeView.noInstallations',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
|
|
|
color: Theme.of(context).colorScheme.secondary),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: ListView(
|
|
|
|
shrinkWrap: true,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
children: apps
|
|
|
|
.map((app) => ApplicationItem(
|
|
|
|
icon: app.icon,
|
|
|
|
name: app.name,
|
|
|
|
patchDate: app.patchDate,
|
|
|
|
changelog: app.changelog,
|
|
|
|
isUpdatableApp: false,
|
|
|
|
onPressed: () => DeviceApps.openApp(app.packageName),
|
|
|
|
))
|
|
|
|
.toList(),
|
|
|
|
);
|
2022-07-31 21:46:27 +02:00
|
|
|
}
|
|
|
|
}
|