2022-07-31 21:46:27 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-09-02 15:35:25 +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 AvailableUpdatesCard extends StatelessWidget {
|
2022-09-01 12:16:14 +02:00
|
|
|
AvailableUpdatesCard({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>().patchedUpdatableApps;
|
|
|
|
|
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-05 04:32:36 +02:00
|
|
|
const Icon(Icons.update_disabled, size: 40),
|
2022-09-02 01:10:10 +02:00
|
|
|
const SizedBox(height: 16),
|
|
|
|
I18nText(
|
|
|
|
'homeView.noUpdates',
|
|
|
|
child: Text(
|
|
|
|
'',
|
|
|
|
textAlign: TextAlign.center,
|
2022-09-05 04:32:36 +02:00
|
|
|
style: Theme.of(context).textTheme.subtitle1!,
|
2022-09-02 01:10:10 +02:00
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: 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: true,
|
|
|
|
onPressed: () =>
|
|
|
|
locator<HomeViewModel>().navigateToPatcher(
|
|
|
|
app,
|
|
|
|
),
|
|
|
|
))
|
|
|
|
.toList(),
|
|
|
|
);
|
2022-07-31 21:46:27 +02:00
|
|
|
}
|
|
|
|
}
|