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-09-05 04:32:36 +02:00
|
|
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.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
|
2022-09-05 04:32:36 +02:00
|
|
|
? CustomCard(
|
2022-09-02 01:10:10 +02:00
|
|
|
child: Center(
|
|
|
|
child: Column(
|
2022-09-02 15:35:25 +02:00
|
|
|
children: <Widget>[
|
2022-09-07 13:01:04 +02:00
|
|
|
Icon(
|
|
|
|
size: 40,
|
|
|
|
Icons.file_download_off,
|
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
),
|
2022-09-02 01:10:10 +02:00
|
|
|
const SizedBox(height: 16),
|
|
|
|
I18nText(
|
|
|
|
'homeView.noInstallations',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
textAlign: TextAlign.center,
|
2023-02-19 04:16:49 +01:00
|
|
|
style: Theme.of(context).textTheme.titleMedium!.copyWith(
|
2022-09-07 13:01:04 +02:00
|
|
|
color: Theme.of(context).colorScheme.secondary,
|
|
|
|
),
|
2022-09-02 01:10:10 +02:00
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: ListView(
|
|
|
|
shrinkWrap: true,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
children: apps
|
2022-09-05 14:43:13 +02:00
|
|
|
.map(
|
2022-09-05 16:30:26 +02:00
|
|
|
(app) => ApplicationItem(
|
|
|
|
icon: app.icon,
|
|
|
|
name: app.name,
|
|
|
|
patchDate: app.patchDate,
|
|
|
|
changelog: app.changelog,
|
|
|
|
isUpdatableApp: false,
|
|
|
|
onPressed: () =>
|
|
|
|
locator<HomeViewModel>().navigateToAppInfo(app),
|
2022-09-05 14:43:13 +02:00
|
|
|
),
|
|
|
|
)
|
2022-09-02 01:10:10 +02:00
|
|
|
.toList(),
|
|
|
|
);
|
2022-07-31 21:46:27 +02:00
|
|
|
}
|
|
|
|
}
|